Tuesday, September 9, 2008

Setting the Primary through EAI

We have an inbound EAI service based on a business service that processes a complex Contact message. One of the child elements in the Contact message is the personal address. We've observed that the inbound message, in an upsert, will insert a new address but not mark it as primary for the Contact. Siebel provides a property called "IsPrimaryMVG" which can be sent with the Address record as an element or attribute. However, since we cannot ask our integrated app to send this, nor should we, we have to ammend the incoming message on the fly. This was done by traversing the IOHierarchy and setting the property as follows:

/* Below Code is Required to Parse Opportunity Role & Opportunity Id from Given XML */
if (xmlOutputs.GetChildCount() > 0)
{
MessageElement = xmlOutputs.GetChild(0);
if (MessageElement.GetType() == "SiebelMessage")
{
ListElement = MessageElement.GetChild(0);
if (ListElement.GetType() == "ListOfContact")
{
ContactEle = ListElement.GetChild(0);
if (ContactEle.GetType() == "CEB WebV2 Contact Int")
{
OptyRole = ContactEle.GetProperty("Opty Role");
OptyEle = ContactEle.GetChild(0);
if (OptyEle.GetType() == "ListOf WebV2 Contact Int_Opportunity")
{
OptyIdEle = OptyEle.GetChild(0);
OpportunityId = OptyIdEle.GetProperty("Opty Id");
}
//mwd 090908 added to set address as primary
var PrimaryEle;
var AddrEle;
AddrEle = ContactEle.GetChild(1);
if (AddrEle.GetType() == "ListOf WebV2 Contact Int_Personal Address")
{
PrimaryEle = AddrEle.GetChild(0);
PrimaryEle.SetProperty("IsPrimaryMVG", "Y");
}
//end mwd 090908
}
}
}
}

Key lesson here is that the GetChild(0) is used.

1 comment:

Unknown said...

hey,
Try this, may work though not recommended,
Set the Auto Primary of that MVL to AutoPrimar. This is what we used as we are having same situation. So if our external system do not set it then it would get set automatically.