我在尝试获取 CRM2011 中合同的 GUID 时遇到问题。首先,我有一个创建实体记录的工作流,然后触发插件来更新合同。当我将合同 ID 设置为新的 GUID 时,它可以正常工作,如下所示:
RenewContractRequest req = new RenewContractRequest();
req.IncludeCanceledLines = true;
req.ContractId = new Guid("1767AD4E-CAF4-E011-8D97-1CC1DEF1B5FF");
req.Status = 1;
RenewContractResponse resp = (RenewContractResponse)service.Execute(req);
但是,当我尝试这样做时:
Guid getContract_id = (Guid)((Entity)context.InputParameters["Target"])["contractid"];
RenewContractRequest req = new RenewContractRequest();
req.ContractId = getContract_id;
req.IncludeCanceledLines = true;
req.Status = 1;
RenewContractResponse resp = (RenewContractResponse)service.Execute(req);
我得到一个例外,即字典中不存在给定的键,我理解为,它没有识别出我将其设置为的 GUID?这可能是我正在做的非常愚蠢的事情,我希望有人能在这里帮助我。