Integrations and APIs for Service

Get Involved. Join the Conversation.


    Peter Keegan
    SOAP API Contacts - convert code from Custom Field to Obj...
    Topic posted October 8, 2019 by Peter KeeganGreen Ribbon: 100+ Points, last edited October 9, 2019, tagged SOAP 
    30 Views, 2 Comments
    SOAP API Contacts - convert code from Custom Field to Obj Designer Package fields
    how do we convert our C# code to update Contact package fields instead of Custom Fields

    We've been updated Contact custom fields successfully for years, however in OSvC we are converting these CFs to fields in the Object Designer in a Contacts package "CO".

    What is the simplest way to convert our C# code to update Contact package fields instead of custom fields?

    (the package fields will have the same name). Code snippet is the skeleton of the c# that is currently used to update on CF "dept".

    On attached PNG, there is the new "Dept" field in Object Designer package.

    ***UPDATED: I attached a document of new code that is attempting to add an object as a child field to Contact package "CO".

    using the sample code from

    I am getting an null reference error when I run a CREATE with the new object:  StackTrace: " at <>x.<>m0(RightNowClient <>4__this)"

    In sample code, what are Namespace and Typename?

    Do these correspond to the OSvC package name?

                    objType.Namespace = "CO";
                    objType.TypeName = "RMA";

    WSDL 1.3
    Code Snippet:



    • Peter Keegan

      How should these be set given a custom object under Contact (see screen shot)?

                      objType.Namespace = "***";
                      objType.TypeName = "***";

    • Peter Keegan

      Nevermind! :)

      We realized that we can treat the fields in packages exactly like the Custom Fields. We just added a 2nd array element with the new fields names.



                      /* BEGIN CO */
                      GenericObject customFieldsCO = new GenericObject
                          GenericFields = new GenericField[1]
                      customFieldsCO.GenericFields[0] = _customField4;

                      customFieldsCO.ObjectType = new RNObjectType
                          TypeName = "ContactCustomFieldsc"

                      GenericField COField = new GenericField
                          name = "CO",
                          dataType = DataTypeEnum.OBJECT,
                          dataTypeSpecified = true,
                          DataValue = new DataValue
                              Items = new object[1]

                      COField.DataValue.Items[0] = customFieldsCO;
                      COField.DataValue.ItemsElementName = new ItemsChoiceType[1];
                      COField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue;
      /*END CO*/

                      _rnContact.Name = _newName;
                      _rnContact.Emails = _emailArray;
                      _rnContact.Phones = _phoneArray;

                      //new custom field handling in WSDL v1.3
                      //Adding 2nd element to array for CO custom fields 20191014
                      _rnContact.CustomFields = new GenericObject
                          GenericFields = new GenericField[2]
                      _rnContact.CustomFields.GenericFields[0] = cField;
                      _rnContact.CustomFields.GenericFields[1] = COField;
                      _rnContact.CustomFields.ObjectType = new RNObjectType
                          TypeName = "ContactCustomFields"