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 - how can I use XSLT functions to remove leading zeros from numeric and alphanumeric fields?

To remove leading zeros from an numeric field in Oracle Integration Cloud (OIC) using XSLT, you can Use number() Function The number() funct...