Setting If Conditions on Catalog Client Script

Blitz
Tera Expert

This is my catalog client script, I basically  autopopulated the data to the portal , the data is coming from the backend (I also used script include for this) but I want to have a If statement that depends on  the other variable

 

Note:  I already got the values (autopopulated)  coming form the backend, but I want a if statement on when it will be showing to the portal.  I want if "select_request_type" (this is my other variable) is "new_privileged_admin_account" (its option) is selected then it will only populate show/set value the data on that time, else it will be blank since my variable ("team") is not mandatory & it is read only.

code.png

2 REPLIES 2

Prince Arora
Tera Sage
Tera Sage

@Blitz 

 

You can do one thing just create the onChange client script on "select_request_type" and mentioned below script:

 

if(newValue == "new_privileged_admin_account"){

//your Script here

}

 

 

OR if you want to update the same script, you can mention like below

 

if(g_form.getValue("select_request_type") == "new_privileged_admin_account"){

//your script here and dont make glideAjax if you dont want to set the values

}

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

Sohithanjan G
Kilo Sage
Kilo Sage

hi @Blitz ,


you can use this after line 14 & delete line 15

if(g_form.getValue("select_request_type") == "new_privileged_admin_account"){

g_form.setValue('team',answer);

}

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)