使用c#和API将回复插入现有SugarCRM案例

时间:2013-04-21 17:41:43

标签: c# .net sugarcrm

我有以下代码通过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);

0 个答案:

没有答案