Comments

  • 1-2 of 2
  • Ajith Errabelly
    Allan Schrum said:

    This is a simple example of using a chaining in a single request (not quite yours, but it should demonstrate the ability). Within a Batch request I can have:

    <rnm:BatchRequestItem>
      <rnm:QueryCSVMsg>
        <rnm:Query>
          SELECT ID AS '@Con', Name FROM Contact WHERE Login = 'Fred'
        </rnm:Query>
      </rnm:QueryCSVMsg>
    </rnm:BatchRequestItem>

    <rnm:BatchRequestItem>
      <rnm:GetMsg>
        <rnm:RNObjects xsi:type='rno:Contact'>
          <rnok:ID xsi:type='rnb:ChainDestinationID' variableName='Con'/>
        </rnm:RNObjects>
        <rnm:ProcessingOptions>
          <rnm:FetchAllNames>true</rnm:FetchAllNames>
        </rnm:ProcessingOptions>
      </rnm:GetMsg>
    </rnm:BatchRequestItem>

    Obviously this could be done in a single QueryObjects request, but the demonstration is how we can set the variable using QueryCSV and, using that variable, perform another operation. The first BatchRequestItem will return results that you will ignore but will have the side-effect of setting the Chain variable 'Con'. The follow-up request creates a ChainDestinationID with variable name 'Con' and uses it however it is needed to be used (such as setting the Primary Contact of an Incident).

    Regards,

    -Allan

     

    View original

    This batch chain works for only one record, if the select query returns more than one record how to implement this chaining concept? 

  • Ajith Errabelly
    Anuj Behl said:

    Update is a separate operation of Connect Web Services. You would need make 2 web service calls: one to get the data and then use the ID to update with second API call.

    View original

    Thank you for your quick reply. Currently we did implement this two separate get and update concept. But we have some records discrepancy issue by some other threads updating the record before the 2nd step executed.

    So we wanted to do this retrieve query for 100 records based on the criteria of non primary key  and do an update of these 100 records in the same batch transaction using chaining concept. Can we do it if, yes how can we do chaining for list of records ?

     

    <rnm:BatchRequestItem>
      <rnm:QueryCSVMsg>
        <rnm:Query>
          SELECT ID AS '@Con', Name FROM Contact WHERE Login = 'Fred'
        </rnm:Query>
      </rnm:QueryCSVMsg>
    </rnm:BatchRequestItem>

    <rnm:BatchRequestItem>
      <rnm:GetMsg>
        <rnm:RNObjects xsi:type='rno:Contact'>
          <rnok:ID xsi:type='rnb:ChainDestinationID' variableName='Con'/>
        </rnm:RNObjects>
        <rnm:ProcessingOptions>
          <rnm:FetchAllNames>true</rnm:FetchAllNames>
        </rnm:ProcessingOptions>
      </rnm:GetMsg>
    </rnm:BatchRequestItem> 

    I tried the above request but I get "Attempted to set column as chained source ID more than once"  error b/c select query has more than one output.