client script help needed

pramn
Tera Guru

Hey team, 

Need a client script for below conditions 

pramn_0-1690278139623.png

Then 

output would be 

pramn_1-1690278248268.png

currency -usd
country -US

also work not should be mandatory  

pramn_2-1690278394451.png

 

1 ACCEPTED SOLUTION

Hello @pramn 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@pramn 

so based on subcategory and Request type the other 3 values should be set or become mandatory?

what did you start with and where are you stuck?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

need a client script 

Hello @pramn 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

Samaksh Wani
Giga Sage
Giga Sage

Hello @pramn 

 

You need to use onChange Client Script :-

 

 

 

 

 

 

 

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

   if ( isLoading || newValue == '') {

      return;

          }

var subcat = g_form.getValue('sub_category');
var request = g_form.getValue('request_type');

if(subcat == 'US OTC...' && request == 'Payment Log'){
g_form.setValue('currency', 'USD');
g_form.setValue('country', 'US');
g_form.setMandatory('work_notes',true);
}

}

 

 

 

 

 

 

 

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh