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

How to set value for lookup field when create record by plugin in CRM 2016 on-premise

$
0
0

Dear all,

I have problem with plugin as subject.

I have entity test_contract which have field "Parent Contract", when plugin create new contract from currentContract, after that test_ParentContract will lookup to currentContract(old contract).

But I can't set value for that field.

Below my code:

var currentContract = serviceContext.test_contractSet.FirstOrDefault(x => x.Id == contract.Id);

Entity newContract = new Entity("test_contract");

{

......some fields;

newContract["test_ParentContract"] = new EntityReference("test_contract", new Guid(currentContract.Id.ToString()));

service.Create(newContract);

}

Please help to resolve this case.

Thanks,

SonDang


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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