gpt4 book ai didi

dynamics-crm - 将契约(Contract)行添加到契约(Contract) CRM 2011

转载 作者:行者123 更新时间:2023-12-04 05:45:40 25 4
gpt4 key购买 nike

我希望有人能帮助我进一步,因为我真的很困在这里。我试图从创建后插件向我的契约(Contract)实体添加契约(Contract)行。我的代码:

Guid c_Id = (Guid)entity.Attributes["contractid"];
DateTime start = (DateTime)entity["activeon"];
DateTime end = (DateTime)entity["expireson"];
Money money = new Money();
money.Value = 0;


//Set Instance for Contract Line
Entity ContractLine = new Entity();
ContractLine.LogicalName = "contractdetail";

//Create Contract Line for the Contract
ContractLine["title"] = "PLUGIN FIRED";
ContractLine["activeon"] = start;
ContractLine["expireson"] = end;
ContractLine["totalallotments"] = 1;
//ContractLine["customerid"] = entity["customerid"];
//ContractLine["productid"] = entity["productid"];
ContractLine["price"] = money;
ContractLine["contractid"] = c_Id;

service.Create(ContractLine);

出于某种原因,我收到了“属性:contractid 不能设置为 NULL”的错误,这真的很奇怪,因为它实际上确实获得了 contractid 的 GUID,因为我在另一个实体的另一个字段上检查了它。如果有人能在这里帮助我,我将不胜感激。谢谢。

最佳答案

ContractLine["contractid"] = c_Id;是 ContractLine["contractid"] = new EntityReference("contract", c_Id); ?

c_Id 也应该是 EntityReference 而不是 GUID?

关于dynamics-crm - 将契约(Contract)行添加到契约(Contract) CRM 2011,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10723074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com