string fetchXML = string.Format(@"<fetch version='1.0' output-format='xml-platform' no-lock='true' mapping='logical'>
<entity name='account'>
<attribute name='name' />
<filter type='and'>
<condition attribute='statuscode' operator='eq' value='1' />
<condition attribute='accountid' operator='eq' value='{0}' />
</filter>
<link-entity name='contact' from='contactid' to='primarycontactid' alias='ab'>
<attribute name='fullname' alias='as_fullname' />
<attribute name='firstname' alias='as_firstname' />
<attribute name='lastname' alias='as_lastname' />
</link-entity>
</entity>
</fetch>", accountId.ToString());
var fetchExp = new FetchExpression(fetchXML);
EntityCollection accountEntity = orgService.RetrieveMultiple(fetchExp);
if (accountEntity.Entities.Count > 0)
{
//Primary Contact Fullname
AliasedValue avContactFullname = accountEntity.Entities[0].GetAttributeValue<AliasedValue>("as_fullname");
if (avContactFullname != null)
contactFullName = avContactFullname.Value;
//Primary Contact Firstname
AliasedValue avContactFirstname = accountEntity.Entities[0].GetAttributeValue<AliasedValue>("as_firstname");
if (avContactFirstname != null)
contactFirstName = avContactFirstname.Value;
//Primary Contact Lastname
AliasedValue avContactLastname = accountEntity.Entities[0].GetAttributeValue<AliasedValue>("as_lastname");
if (avContactLastname != null)
contactLastName = avContactLastname.Value;
}
RAJEEV KUMAR, Azure Architect, Azure Data Engineer, AZURE Developer, Prince2®, SAFe®, CSM®, ITIL® (Linkedin: www.linkedin.com/pub/rajeev-kumar/13/459/663)
Subscribe to:
Post Comments (Atom)
Get files of last hour in Azure Data Factory
Case I have a Data Factory pipeline that should run each hour and collect all new files added to the data lake since the last run. What is...
-
I find that using workflow id might be problematic across deployment, so I wrote a function to retrieve workflow’s guid given the workflow...
-
Object-Oriented Programming (OOP) Terms Basics Object-Oriented Programming (OOP) : An approach to designing and building applicatio...
-
Microsoft Dynamics CRM supports two types of parameters for a workflow activity. Input Parameters Output Parameters Input Paramete...
No comments:
Post a Comment