Monday, May 9, 2022

OIC - Generate Random number using Javascript function in Oracle integrations

Use Case: We will generate Random number based on number of digits required using Javascript function.

Example, if we put input digit = 3 that means it will generate a random number between 1 and 1000.

Javascript function:

RandomNumber.js

function generateRandomNumber(digit){

var RandomNum=Math.floor((Math.random() * digit) + 1);

return RandomNum;

}

Steps in detail(With Screenshots):

Upload the Javascript code to OIC Libraries




Create a lookup for random digit 


Create App driven Integration


Call Rest Trigger and configure







Call Javascript action and select the created randomNumber function.




Provide the digit value with LookupValue









Map the js response to trigger reply.



Test



No comments:

Post a Comment

Featured Post

OIC - "Dynamically Configuring Relative URLs for REST API Invocations in Oracle Integration Cloud" | Dynamically invoke local integration

Use Case: In Oracle Integration Cloud (OIC), there is often a need to dynamically determine the Relative URI while invoking REST APIs. This ...