How to add multiple entries (numbers) in MRVS and add to a variable on the Catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 02:34 PM
Hello,
I am trying to take the information from the MRVS ( Final price - Single line text) and copy the data into the Price variable on my Catalog item. If there are multiple Final price items, the Price variable should display only one amount.
Ex:
MRVS Catalog item
Final price entries Price
10 53
33
10
How would this be possible to do?
Thanks
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 06:33 PM
Hi @IB98
I can help you with summing up the price from MRVS, but setting the price of the item can't be set from this client script, as far as I know.
Create a catalog client script, and use this code,
var mrvs_data = JSON.parse(g_form.getValue('YOUR_MRVS_NAME')); //Replace with your multi row variable set internal name
var total_price = 0;
for (key in mrvs_data) {
total_price += mrvs_data[key].final_price; //Change your final price Variable name as per your configuration
}
alert("Total Price: " + total_price); //You can use the total_price variable for the remaining requirement like setting another variable value etc.
Please mark my answer helpful and accept as solution if it helped you 👍✅
Anvesh