how can sum of two variables and populate in third one on catalog form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 09:44 AM
Hi team,
There are three fields total amount, P.Amount, and L.Amount. here total amount = P.Amount + L.Amount.
All fields accept number values on the catalog form, I want if the value gets a change of any variables (P.Amount + L.Amount) the total amount value should be changed.
How can I achieve this?
Thanks
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 09:51 AM
Hi,
You can try it using on-change Catalog client scripts.
Sample scripts -
var value1 = newValue;
var value2 = g_form.getValue("variable_2");
var sum = parseInt(value1) + parseInt(value2);
alert("sum: " + sum);
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 10:00 AM
Hello @Sagar Pagar ,
Type is on-change but there there are 2 fields (P.Amount + L.Amount) which field needs to select in the client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 10:06 AM - edited 10-11-2022 10:07 AM
Hi,
Select 2nd field for on-change and try updated scripts.
var value1 = g_form.getValue("variable_1");
var value2 = newValue;
var sum = parseInt(value1) + parseInt(value2);
alert("sum: " + sum);
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 10:21 AM