CampusNexus CRM iServices Help
UpdateAssociation Method |
Sample Code for updating POR (Properties on Relationship) Properties using the UpdateAssociation method of CampusNexus CRM Higher Education Foundation iService.
In the following sample code we will be updating the following POR Properties of the Contact and Account Objects Relationship.
-
Graduation date – 2014-08-12 (YYYY-MM-DD)
-
GPA – 3.7
For information on finding the ID of POR Properties, see Querying Main Database.
Sample Code for the UpdateAssociation Method
public void UpdatePORHEiServiceSample() { //Creating an Instance of SIS Connector iService SISConnectorWebService SISService = new SISConnectorWebService(); //Setting the value of the SuppressMsgFlag flag to true. SISService.SuppressMsgValue = new SuppressMsg(); SISService.SuppressMsgValue.SuppressMsgFlag = true; //Generating the Username Token Information UsernameToken userToken = getUserToken("ParkerRoy", "password"); //Associating the Username Token with the HE iService Instance SISService.RequestSoapContext.Security.Tokens.Add(userToken); SISService.RequireMtom = false; //Creating an instance of the RelationInformation Class RelationInformation relationInformation = new RelationInformation(); //Setting the values of the Source Object relationInformation.SourceObjectType=3; //Object type of the Contact Object relationInformation.SourceInstanceId=120; //ID of the Contact item //Setting the values of the Target Object relationInformation.TargetObjectType = 2; //Object type of the Account Object relationInformation.TargetInstanceId=2; //ID of the Account item //Setting the value of the Relationship relationInformation.RelationshipId = 4810702; //ID of the Relationship between Contact and Account Objects //Initializing the PropertiesInformation structure with required Information relationInformation.PropertiesInformation = new PropertyInformation[2]; //Setting the values for the Graduation date Property relationInformation.PropertiesInformation[0] = new PropertyInformation(); relationInformation.PropertiesInformation[0].Id = 6010007;//ID of the Graduation date Property relationInformation.PropertiesInformation[0].Value = "2014-08-12"; //Value of the Graduation date Property //Setting the values for the GPA Property relationInformation.PropertiesInformation[1] = new PropertyInformation(); relationInformation.PropertiesInformation[1].Id = 6010010; //ID of the GPA Property relationInformation.PropertiesInformation[1].Value = "3.7"; //Value of the GPA Property //Declaring the output parameters long transactionID=-1; ReturnStatus returnStatus = new ReturnStatus(); //Calling the UpdateAssociation Method returnStatus= SISService.UpdateAssociation(relationInformation, out transactionID); if (returnStatus.ErrorCode != 0) { //Handle Error } }