UpdatePropertyTab Method |
Sample Code for updating a Lead Object item using the UpdatePropertyTab method of CampusNexus CRM COF iService.
In the following sample code we will be updating the following Properties details of an existing Lead item, John Peter with Lead ID 76 in CampusNexus CRM.
-
Phone – 566-523-4373
-
Education Level - High School
-
Lead Category – High School
The Lead Category Property is an enumerated Property. For this Property, you must pass the ID of the index of the enumerated value of this Property as the value. For example, the ID of the index of the High School enumerated value of the Lead Category Property is 1. You must pass 1 as the value for the Lead Category Property.
For information on finding the ID of the index of an enumerated Property value, see Querying Main Database.
public void UpdateLeadCOFiService () { //Creating an Instance of COF iService COFWebService COFService = new COFWebService(); //Generating the UsernameToken UsernameToken userToken = getUserToken("ParkerRoy", "password"); //Associating the Username Token with the COF iService instance COFService.RequestSoapContext.Security.Tokens.Add(userToken); COFService.RequireMtom = false; //Initializing the PropertyInfo list with required Information PropertyInfo[] propertyData = new PropertyInfo[3]; // 3 Properties are passed for creating a Lead item. //Setting the values of the PropertyInfo class for the Phone Property of the Lead Object PropertyInfo propPhone = new PropertyInfo(); propPhone.propertyID = 4810086; //ID of the Phone Property of the Lead Object. propPhone.propValue = "566-523-4373";//Value of the Phone Property of the Lead Object. propertyData[0] = propPhone; //Setting the values of the PropertyInfo class for the Education Level Property of the Lead Object PropertyInfo propEducationLevel = new PropertyInfo(); propEducationLevel.propertyID = 4810019; //ID of the Education Level Property of the Lead Object. propEducationLevel.propValue = "1";//Instance ID of High School propertyData[1] = propEducationLevel; //Setting the values of the PropertyInfo class for the Lead Category Property of the Lead Object PropertyInfo propLeadCategory = new PropertyInfo(); propLeadCategory.propertyID = 4810074; //ID of the Lead Category Property of the Lead Object. propLeadCategory.propValue = "1"; // Index of the enumerated value of the Lead Category Property. propertyData[2] = propLeadCategory; long result=0; long objectType= 20005;// Object type of the Lead Object long instanceID=76; //ID of Lead item to be Updated string error = ""; //Calling UpdatePropertyTab method for Lead Updation result = COFService.UpdatePropertyTab(objectType, instanceID, propertyData, out error); if (result != 0) { //Operation Failed, Handle Failure. } }