CATALOG ITEM: How to make a variable mandatory and visible based on 2 conditions in client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2024 07:07 AM
Hi,
Greetings for the day!
I have a requirement where Division (String variable) should be visible and mandatory when Company (reference variable) has business area "India" and Payment type (choice variable) is "Write Off".
I have created a Catalog Client script on change of company code which is working fine if we select payment type and company (having business area as India) but when we change payment type (not Write Off) after selecting company code still it shows Division as mandatory which shouldn't be there.
CATALOG CLIENT SCRIPT:
Please assist here, Thanks in advance!
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2024 09:09 AM
Hi @Ridhima_1
you have forgotten to use callback function in getReference.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var loc=g_form.getReference('location',callback);
function callback(loc){
var latitude=loc.latitude;
var longitude=loc.longitude;
g_form.setValue('latitude',latitude);
g_form.setValue('longitude',longitude);
}
//Type appropriate comment here, and begin script below
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2024 09:12 AM
Hi @Ridhima_1
You have forgotten to use call back function in get Reference
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var loc=g_form.getReference('location',callback);
function callback(loc){
var latitude=loc.latitude;
var longitude=loc.longitude;
g_form.setValue('latitude',latitude);
g_form.setValue('longitude',longitude);
}
//Type appropriate comment here, and begin script below
}
Thanks and Regards
Sai Venkatesh