3 Replies Latest reply on Feb 12, 2017 5:04 AM by florian1

    How to create an incident without the reference of a link recid (how to get a recid for a business object)?

    twg_nick Rookie


      I was trying to setup a c# application to automate the process of creating incidents but am having a difficult time understanding the recid generation of a single business object (incident). The examples all specify a link with a pre-existing recid business object. How would one go about to create a new business object in this case that has no links.

       

      Additionally, if I created an incident, do I have to manage getting an incident number as a unique value? Or is there another way to get the number?

       

      Thanks

        • 1. Re: How to create an incident without the reference of a link recid (how to get a recid for a business object)?
          florian1 Expert

          Hi Nick,

           

          here's an XML example how an easy "CreateObject" request looks like:

           

          <soapenv:Envelope xmlns:soapenv="
          http://schemas.xmlsoap.org/soap/envelope/
          " xmlns:saas="SaaS.Services">
          
            <soapenv:Header/>
            <soapenv:Body>
                <saas:CreateObject>
                  <saas:sessionKey>yoursessionkey=##0#False</saas:sessionKey>
                  <saas:tenantId>yourtenant</saas:tenantId>
                  <saas:commandData>
                      <saas:ObjectType>Incident#</saas:ObjectType>
                      <saas:Fields>
                        <!--get the ProfileLink_RecID in a Search query:-->
                        <saas:ObjectCommandDataFieldValue>
                            <saas:Name>ProfileLink</saas:Name>
                            <saas:Value>947F824D482F4FF4865549814FA3F935</saas:Value>
                        </saas:ObjectCommandDataFieldValue>
                        <saas:ObjectCommandDataFieldValue>
                            <saas:Name>OwningOrgUnitId</saas:Name>
                            <saas:Value>Your Company B.V.</saas:Value>
                        </saas:ObjectCommandDataFieldValue>
                        <saas:ObjectCommandDataFieldValue>
                            <saas:Name>Subject</saas:Name>
                            <saas:Value>Test</saas:Value>
                        </saas:ObjectCommandDataFieldValue>
                        <saas:ObjectCommandDataFieldValue>
                            <saas:Name>Status</saas:Name>
                            <saas:Value>Logged</saas:Value>
                        </saas:ObjectCommandDataFieldValue>
                        <saas:ObjectCommandDataFieldValue>
                            <saas:Name>Symptom</saas:Name>
                            <saas:Value>Description</saas:Value>
                        </saas:ObjectCommandDataFieldValue>
                      </saas:Fields>
                  </saas:commandData>
                </saas:CreateObject>
            </soapenv:Body>
          </soapenv:Envelope>
          
          

           

          You will receive a RecId (and all the other fields) as a result of this request because there's an initialization rule in the Incident object:

          This function just runs the following SQL statement:

          SELECT replace(newid(),'-','')
          
          

           

          Here's the Incident Number for example:

          It just increments the current counter found here:

           

           

          You can go with any unique field for an Incident. So either RecId or IncidentNumber.

          4 of 4 people found this helpful
          • 2. Re: How to create an incident without the reference of a link recid (how to get a recid for a business object)?
            daveb1 Apprentice

            Florian,

             

            Thank you, that's makes sense.  Now that you have a valid SOAP envelope, where do you POST it?  And is this documented?  If so, where?

             

            Thanks,

            David

            • 3. Re: How to create an incident without the reference of a link recid (how to get a recid for a business object)?
              florian1 Expert

              I normally use soapUI in the first place to query an available WSDL source.

              You just have to use the same Integration Service URL as you do in Visual Studio as a service reference.

               

              - Add a new project

              - refer to https://yourtenant/HEAT/ServiceAPI/FRSHEATIntegration.asmx?wsdl 

              - you will now see the different webservice methods you can use:

               

              Double click on any method and you will see the raw envelope as it's described in WSDL.

              Provide the neccessary values and press play:

              You will see the result (your API session key in this case) on the right hand side:

               

              For debugging purposes you can later on modify your request by adding headers attachments etc.