web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Nishant Rana’s Weblog / Understanding TargetRelated...

Understanding TargetRelatedLeadToAccount class in CRM

Nishant Rana Profile Picture Nishant Rana 11,325 Microsoft Employee

Hi,

I saw one question in Microsoft CRM Development forum, it was regarding the TargetRelatedLeadToAccount class. The user was using this class to update the originatinglead attribute in the account record.

This is how we would be using that class

CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.CrmAuthenticationTokenValue = new CrmAuthenticationToken();
service.CrmAuthenticationTokenValue.AuthenticationType = 0;
service.CrmAuthenticationTokenValue.OrganizationName = “orgName”;

TargetRelatedLeadToAccount targetRlTA = new TargetRelatedLeadToAccount();
targetRlTA.AccountId = new Guid(“accountGuid”);
targetRlTA.LeadId = new Guid(“leadGuid”);

SetRelatedRequest srelReq = new SetRelatedRequest();
srelReq.Target = targetRlTA;
SetRelatedResponse srelRes = (SetRelatedResponse)service.Execute(srelReq);

However as it turned out, this class associates an account record to a particular lead record. It doesn’t update the originatinglead attribute in the account record.

We can find a N:N relationships defined between lead and account named “accountleads_association”. Every time we use the above message a particular account record gets associated to the lead.

We can check for it in the following filtered view “FilteredAccountLeads”.

Bye..


Filed under: CRM, Microsoft Dynamics CRM Tagged: CRM, CRM 4.0

This was originally posted here.

Comments

*This post is locked for comments