Tuesday, May 17, 2022

VBCS - Create Custom Javascript function in Visual Builder

Use Case: Here, we will create a Javascript function which will accept a name string as input and return concatenated greetings.

Javascript code:

PageModule.prototype.greetingsFunction = function(name) {

var result = "Hello " + name + ". Have a nice day !!";

};

High level Steps:

  • Create a javascript function code.
  • Take an input text (name) and a text area(greetings) and create 2 variables varName  and varGreetings and map them to the name and greetings element.
  • From name element >> create an event and call the javascript using call function and feed input with varNane and take the result and map back to grestings variable.

Steps with Screenshots:

Create a new web application


Take a input test (Name), divider, a text area(greetings)


Create 2 variables. varName and varGreetings.





Map the data variables with the Name and Greetings elements.



Select Name element >> events >> New event >> On Value


Drag and drop JS call function



Add the JS function code.




Map the varName to Function input name.





Take a assign and map the function result to varGreetings .




Go Live and test.


Provide name and tab any where on the page.





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...