For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
I make an API call to change the contact on an incident. But it seems to set the contact, I need to know the c_id. So I have to make 2 api calls... 1 to look up the contact via a custom field or email address and then a second to set the contacts primary contact to the id I found in the lookup. But one of my external applications has a technical limitation that makes 2 calls difficult.
Thanks!
Use chaining within a Batch request. A ROQL query to look up the Contact and associating it to a ChainSourceID. Then use it in the Update call on the Incident. See the documentation on how to set chains with ROQL, but it is like this:
SELECT ID AS '@MyContact' FROM Contact WHERE ...
That set the ChainSourceID variable MyContact. Use that variable in the Update request. Just to round things out, ROQL can use chaining in its WHERE clause:
SELECT ID FROM Contact WHERE Organization = @MyOrganization
Regards,
-Allan
The ROQL request isn't an issue. Writing the chaining in C# is the issue. I've been playing around with the demo code but the way those source and destination variables work is what's confusing me. Do you have any links/examples of an ROQL request that provides the data required for the update? This whole thing is building an XML request that somehow tells the API "Make the results of X the input of Y" and that XML is my real goal.
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
Perfect, thank you! I'll try and piece it together from there.
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?
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