我已经创建了一个新的CRM实体,它包含两个字段Name和Value。在我的C#代码中,我从获取相同的两个值及其名称。现在我在我的C#代码中有了这些记录,现在我想将这些记录保存在CRM实体中。我现在使用下面的代码来获取值,
string QuestionAnswer = string.Empty;
if (dialog.QuestionControlValidate)
{
if (ContextParameterName != string.Empty)
{
var ctx = Context.GetContext();
if (dialog.QuestionControlType == "TextBox")
QuestionAnswer = dialog.QuestionControlTextQuestionAnswer.ToString();
else if (dialog.QuestionControlType == "RadioButton")
QuestionAnswer = dialog.QuestionControlRadioButtonSelectionAnswer.ToString();
var updatedContext = new Context(ctx)
{
[ContextParameterName] = QuestionAnswer
};
// Code to be added here
}我在ContextParameterName中获取名称,在QuestionAnswer.中获取值我想将这些记录存储在具有名称和值字段的CRM实体中。
发布于 2019-04-04 11:35:09
我是从C#代码中从微软美元获得数据,然后想把它保存在客户关系管理实体。因为在美元中,连接是用CRM环境自动创建的,所以我实现了它,而没有显式地定义连接。
dictionary.Add("name", new CrmDataTypeWrapper(ContextParameterName, CrmFieldType.Raw));
dictionary.Add("value", new CrmDataTypeWrapper(QuestionAnswer, CrmFieldType.Raw));
dictionary.Add("id", new CrmDataTypeWrapper(updatedContext["Id"], CrmFieldType.Raw));
Guid EvntId = _client.CrmInterface.CreateNewRecord("historicaldata",dictionary,"",false,new System.Guid());CreateNewRecord方法针对目标实体类型创建新的活动。
发布于 2019-04-04 08:42:20
在CRM中创建记录的代码如下所示
实体customEntity =新实体
Entity abc = new Entity()
{
LogicalName = "new_EntityName",
["fieldName"] = ContextParameterName,
["fieldValue"] = QuestionAnswer
};
Guid newEntityRecordGuid = CrmConn.Create(abc);newEntityRecordGuid将有新创建的记录Guid
发布于 2019-04-04 20:31:30
您可以使用Global托管控件并使用CreateEntity操作。检查这个链接https://learn.microsoft.com/en-us/dynamics365/customer-engagement/unified-service-desk/global-manager-hosted-control?view=dynamics-usd-4.1
https://stackoverflow.com/questions/55510162
复制相似问题