In the Oracle Integration Cloud (OIC) we can add custom libraries that give the option to implement requirements not covered with the out of the box standard functions.
Some time ago I got a requirement to create a Unique Identifier with a specific length. The below JavaScript function takes a parameter as input (the length of the integer to return), and then it generates a random number with that exact length.
There is an out of the box function to generate an ID, but we have no control on the length of that ID.
So I save this file as a .js and will use it to create a new library.
All the details can be found in the documentation!
Home > Integrations > Libraries
You can now see the newly created function, the input and output parameters. Please note that you can create multiple functions in the same .js file.
Now in the mapping action from any Integration, when you expand the User-Defined menu, you can see the custom libraries.