我有以下代码通过 C# 在 SugarCRM 中创建案例。
我在问,有人知道我将如何通过 c# 将这个案例的回复添加到 SugarCRM api 吗?
NameValueCollection fieldListCollection = new NameValueCollection();
fieldListCollection.Add("id", string.Empty);
fieldListCollection.Add("name", "Something went wrong");
fieldListCollection.Add("description", "This software is not working");
fieldListCollection.Add("status", "test"); //New, Assigned, Closed, Pending Input, Rejected, Duplicate
fieldListCollection.Add("priority", "test"); //High, Medium, Low
fieldListCollection.Add("account_id", AccountId); // Don't pass this if you don't want to associate an account with it
fieldListCollection.Add("contact_id", ContactId); // Don't pass this if you don't want to associate with this contact with it
SugarCRM.name_value[] fieldList = new SugarCRM.name_value[fieldListCollection.Count];
int count = 0;
foreach (string name in fieldListCollection)
{
foreach (string value in fieldListCollection.GetValues(name))
{
SugarCRM.name_value field = new SugarCRM.name_value();
field.name = name; field.value = value;
fieldList[count] = field;
}
count++;
}
SugarCRM.new_set_entry_result result = SugarClient.set_entry(SessionID, "Cases", fieldList); //Accounts, Incidents, Contacts, Cases
Console.WriteLine("New ID: " + result.id);