Thursday, September 27, 2018

Add a value to a custom field of type SelectCustomFieldRef usingC#.net

The snippet below shows how to add a value to a custom field of type SelectCustomFieldRef ( Drop down list)

CustomFieldRef[] custFieldRef = new CustomFieldRef[2];
SelectCustomFieldRef selectField = new SelectCustomFieldRef();
selectField.internalId = "custbody_estimatelist"; //name of the custom field
ListOrRecordRef val = new ListOrRecordRef();
val.internalId = "1"; //id of the selected list
selectField.value = val;
//add the customfield in the list
custFieldRef[0] = selectField;

SelectCustomFieldRef selectField2 = new SelectCustomFieldRef();
selectField2 .internalId = "custbody_productlist"; //name of the custom field
ListOrRecordRef val = new ListOrRecordRef();
val.internalId = "4"; //id of the selected list
selectField2 .value = val;
//add the customfield in the list
custFieldRef[1] = selectField2 ;

//add it to contact record
so.customFieldList = custFieldRef;

No comments:

Post a Comment