Need to increment a field value when clicked on UI action.

Rajendra0823
Tera Contributor
I have a requirement that when clicked on UI action the field value should get increment. Can anyone please help me with this...
1 ACCEPTED SOLUTION

Aylee Andersen
Kilo Sage

You should be able to cast the field value to an Integer and then increment it in the UI Action's script. For example:

var previousValue = parseInt(current.getValue('u_counter')); // get the field value as an integer
current.u_counter = previousValue + 1; // increment the value
current.update(); // update the record
action.setRedirectURL(current); // redirect back to the current record

 

Hope that helps!

View solution in original post

2 REPLIES 2

Aylee Andersen
Kilo Sage

You should be able to cast the field value to an Integer and then increment it in the UI Action's script. For example:

var previousValue = parseInt(current.getValue('u_counter')); // get the field value as an integer
current.u_counter = previousValue + 1; // increment the value
current.update(); // update the record
action.setRedirectURL(current); // redirect back to the current record

 

Hope that helps!

Rajendra0823
Tera Contributor

Thank you....