0
我在我的实体“new_trialxrmservicetoolkit”查找“new_lookuptransactionheader”。此查询从“new_transactionheader”实体链接而来。我如何插入数据使用c#crm插件? 这mycode的:如何通过插件C#插入使用查找CRM 365数据
public void InsertDataUsingLookup(XrmServiceContext xrm, Entity entitiy, ITracingService tracer)
{
new_trialxrmservicetoolkit trial = new new_trialxrmservicetoolkit();
trial.new_name = "testplugin";
trial.new_LookupTransactionHeader = null; //this is i don't know how to get value from new_LookupTransactionHeader
trial.new_Notes = "this is test plugin using c#";
xrm.AddObject(trial);
xrm.SaveChanges();
}
我更新mycode的,这解决:
public void InsertDataUsingLookup(XrmServiceContext xrm, Entity entitiy, ITracingService tracer)
{
new_trialxrmservicetoolkit trial = new new_trialxrmservicetoolkit();
trial.new_name = "testplugin";
trial.new_LookupTransactionHeader = new EntityReference("new_transactionheader", Guid.Parse("5564B5F0-0292-E711-8122-E3FE48DB937B"));
trial.new_Notes = "this is test plugin using c#";
xrm.AddObject(trial);
xrm.SaveChanges();
}
我仍然不明白使用'new_transactionheaderId-GUID'我粘贴在我的代码,但我得到错误。 – aminvincent
你有什么指导?你得到的错误是什么? –
我的错误:new_transactionheaderId的名称在curent中不存在 – aminvincent