Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

how to get created record in plugin

$
0
0

Entity entity = (Entity)context.InputParameters["Target"];


if (entity.LogicalName == "account")
{

Entity Account = (Entity)service.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true));
tracingService.Trace("1");

Guid ContactGuid = Account.Id;
string id = entity.Id.ToString();
tracingService.Trace("9");
//throw new Exception("Contact guid" + ContactGuid);
Entity objContact = service.Retrieve("contact", ContactGuid, new ColumnSet(true));
//Entity objContact = (Entity)service.Retrieve("contact", ((EntityReference)entity.Attributes["new_account"]).Id, new ColumnSet(true));
//Entity objContact = (Entity)service.Retrieve("contact", ((EntityReference)Account.Attributes["new_account"]).Id, new ColumnSet(true));
tracingService.Trace("2");
string Updatename = Account.GetAttributeValue<string>("name");
tracingService.Trace("3");
objContact.Attributes["fullname"] = Updatename;
tracingService.Trace("4");
string Updateemail = Account.GetAttributeValue<string>("emailaddress1");
tracingService.Trace("5");
objContact.Attributes["emailaddress1"] = Updateemail;
tracingService.Trace("6");
string Updateaddress = Account.GetAttributeValue<string>("address1_composite");
tracingService.Trace("7");
objContact.Attributes["address1_composite"] = Updateaddress;

service.Update(objContact);
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>