How to set the Quantity and Price Value according to the Records added in multi row variable set in

ServicenowDev19
Tera Contributor

logivention_0-1679658239108.png

Here i want to set the quantity value according to the records added in the multi row variable set and after setting the quantity the price should also be set according to the Quantity.

5 REPLIES 5

Mohan raj
Mega Sage

Hi @ServicenowDev19,

 

Try this client script 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    if (newValue) {
		
        var multiRowVariableSet = JSON.parse(g_form.getValue('demo_variable_set')); // Replace "demo_variable_set" with your Variable Set Name. Make sure to replace it with Name and not with Label of Multi Row Variable Set
        var numberOfRows = multiRowVariableSet.length;
		g_cart.setQuantity(numberOfRows);
    }


    //Type appropriate comment here, and begin script below

}

 

​If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.

Regards

Mohan

ServicenowDev19
Tera Contributor

This solution is not working for me.

 

Hi @ServicenowDev19,

 

write the client script in variable set not in catalog item where your adding

logivention_0-1679715612921.png

I am writing this script in variable set but not working.