This is a public Forum  publicRSS

Topic

    Ajith Errabelly
    Update a row/field in RightNow, where the criteria is not...Answered
    Topic posted June 11, 2018 by Ajith ErrabellyRegular 
    57 Views, 3 Comments
    Title:
    Update a row/field in RightNow, where the criteria is not primary key to search the row
    Content:

    The Below is the block of code where I search for a row using ID of that table, but my search criteria needs one more column along with the primary key. How do I add that column in search criteria in the below code block.

    We would like to create the update query with the "and" condition from the column that is not the primary key.
    Eg.
    We would like to update the status to "Complete" for the ID = 123 "and" 124 for the regular SQL we would like something like below.

    update Artrim set STATUS_ID= '3', COMMENT = 'Update Pending to Complete' where STATUS_ID= '2' and ID in (123, 124);

    How about the RightNow Service API? We tried to put the "and" condition for non Primary key

    Version:
    Feb 2017
    Code Block:

    Best Answer

    Anuj Behl

    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.

    Answer

     

    • Anuj Behl

      Service Cloud has ROQL where you can write SQL-like queries to get the data. Try that with QueryCSV to get the required data.

    • Anuj Behl

      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.

    • 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.