This is a very common requirement to have a conditional mapping in OIC processes. Basically, we need to check the input payload element and set values to target element based on certain condition.
Let’s see with a quick example
This is an example of a receiving transaction Api in which if the Line type id of a PO line = 6 We need to set the Receiving Router header id = 3
Since this is a single Condition we can just use the If Condition in the OIC mapper.
Steps
- Create target element (Routing header id in our case)
- Enable XSLT Developer mode
- Toggle Functions
- Select XSLT Tab
- Select the If condition
- Drag the if condition to Routing header id. make sure that the icon is just below the element
Drag line type id to the expression box and set the value = 6
ns28:LineTypeId =6
Finally, The mapper looks like below
Adding multiple Conditions in OIC Mapper
Similarly, we can add multiple conditions with choose statement. follow the same process
example
(IF Line type id =2 Routing header id =9 )
Drag choose under routing header id
then drag when condition under choose
set line type id =1 in expression ( drag line type id to expression builder and set =1)
Drag Value of statement under When and Set =3 in expression (this sets the value of routing header id to 3)
so now the condition applied is if line type id =1 , routing header id =3
similarly, you can add another condition e.g If line type id =2, routing header id =9
So this covers 2 conditions
If linetype =1 routing header id =3
if line type =2 routing header id =9
Similarly, you can add more complex and Conditional Mapping in OIC mapper.
Become a Oracle Cloud Application Integration Architect with the below courses
Covers: All Major OIC and Application Skills required to do Major integrations. Support for One Year with Money Back Gurantee
This training covers Fusion Technical and OIC bundle (OIC /PCS/VBCS)
A Good Training Overall!
The course will help you to prepare for the 1Z0 1042: oracle cloud platform application integration specialist exam.
You may like