Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    s k
    pass custom field when creating incidents
    Topic posted February 12, 2016 by s kRed Ribbon: 250+ Points 
    417 Views, 19 Comments
    Title:
    pass custom field when creating incidents
    Content:

    I create incidents by consuming RightNow WDSL using the xml file.
    But I can't add custom field while creating an incident.
    My xml file:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <soapenv:Header>
            <ns7:ClientInfoHeader xmlns:ns7="urn:messages.ws.rightnow.com/v1_2" soapenv:mustUnderstand="0">
                <ns7:AppID>Incident Create</ns7:AppID>
            </ns7:ClientInfoHeader>
            <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                           mustUnderstand="1">
                <wsse:UsernameToken>
                    <wsse:Username>test</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/sdsd">test</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </soapenv:Header>
        <soapenv:Body>
            <ns7:Create xmlns:ns7="urn:messages.ws.rightnow.com/v1_2">
                <ns7:RNObjects xmlns:ns4="urn:objects.ws.rightnow.com/v1_2"
                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:Incident">
                    <ns4:PrimaryContact>
                        <ns4:Contact>
                            <ID xmlns="urn:base.ws.rightnow.com/v1_2" id="325"/>
                        </ns4:Contact>
                    </ns4:PrimaryContact>
                    <ns4:Subject>Conversation</ns4:Subject>
                    <ns4:Threads>
                        <ns4:ThreadList action="add">
                            <ns4:EntryType>
                                <ID xmlns="urn:base.ws.rightnow.com/v1_2" id="1"/>
                            </ns4:EntryType>
                            <ns4:Text>Test</ns4:Text>
                        </ns4:ThreadList>
                    </ns4:Threads>
                    <ns4:CustomFields xmlns:ns2="urn:generic.ws.rightnow.com/v1_3" xsi:type="ns2:GenericObject">
                        <ns2:ObjectType>
                            <ns2:TypeName>IncidentCustomFields</ns2:TypeName>
                        </ns2:ObjectType>
                        <ns2:GenericFields dataType="OBJECT" name="c">
                            <ns2:DataValue>
                                <ns2:ObjectValue xsi:type="ns2:GenericObject">
                                    <ns2:ObjectType>
                                        <ns2:TypeName>IncidentCustomFieldsc</ns2:TypeName>
                                    </ns2:ObjectType>
                                    <ns2:GenericFields dataType="STRING" name="Name of custom field">
                                        <ns2:DataValue>
                                            <ns2:StringValue>Setting Custom Field!</ns2:StringValue>
                                        </ns2:DataValue>
                                    </ns2:GenericFields>
                                </ns2:ObjectValue>
                            </ns2:DataValue>
                        </ns2:GenericFields>
                    </ns4:CustomFields>
                </ns7:RNObjects>
                <ns7:ProcessingOptions>
                    <ns7:SuppressExternalEvents>false</ns7:SuppressExternalEvents>
                    <ns7:SuppressRules>false</ns7:SuppressRules>
                </ns7:ProcessingOptions>
            </ns7:Create>
        </soapenv:Body>
    </soapenv:Envelope>

     

    if I remove following part from xml, incident will be created, BUT I need to add value of this custom field

    <ns4:CustomFields xmlns:ns2="urn:generic.ws.rightnow.com/v1_3" xsi:type="ns2:GenericObject">
    <ns2:ObjectType>
        <ns2:TypeName>IncidentCustomFields</ns2:TypeName>
    </ns2:ObjectType>
    <ns2:GenericFields dataType="OBJECT" name="c">
        <ns2:DataValue>
            <ns2:ObjectValue xsi:type="ns2:GenericObject">
                <ns2:ObjectType>
                    <ns2:TypeName>IncidentCustomFieldsc</ns2:TypeName>
                </ns2:ObjectType>
                <ns2:GenericFields dataType="STRING" name="custom field name ">
                    <ns2:DataValue>
                        <ns2:StringValue>Setting Custom Field!</ns2:StringValue>
                    </ns2:DataValue>
                </ns2:GenericFields>
            </ns2:ObjectValue>
        </ns2:DataValue>
    </ns2:GenericFields>
    </ns4:CustomFields>
    

    Name of custom field is custom field name (three separete words - maybe this is the reason for the error???)

    id is 117

    Error:
    

    RightNowSyncService|urn:wsdl.ws.rightnow.com/v1_2 failed Found out-of-order or unrecognized node CustomFields|urn:objects.ws.rightnow.com/v1_2 while parsing node of type Incident|urn:objects.ws.rightnow.com/v1_2 Failed in constructing object CreateMsg : NULL input can not be deserialized Failed in setting value for element RNObjects array position 0 of object CreateMsg Failure in setting value for object Create element Create of type messages_ws_rightnow_com_v1_2::CreateMsg NULL returned from the Create deserializer due to missing or invalid XML

    Could you help me please?

    Comment

    • Pramod Vasudeva Murthy

      Check the name of it using Agent Console. You will understand the error perhaps.

    • Allan Schrum

      Fields within objects are xs:sequence as defined in the XML schema. Your placement of "CustomFields" must follow how it is defined within the XML schema found in the WSDL. In general, fields are placed in alphabetical order. CustomFields must appear before PrimaryContact.

      Regards,

      -Allan

    • s k

      Allan, you're right
      I needed to change order of fields
      Now incidents're created smiley
      Guys, thank you so much

       

    • Pramod Vasudeva Murthy

      Great!! Please choose Allan's response thread as best answer as it will help others who come across same issue smiley

      - VIP