How to hide a variable based on country
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 09:51 PM
Hi,
How to hide a variable based on country
EX: Varaible(Buyer Group) needs to hide when Requested For country is France & Ireland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 09:57 PM - edited 11-20-2023 09:58 PM
Hi @sriram7 ,
You can create an load/onchange client script for above requirement.Providing u an on load script example if u want u can use onChange as well based upon if manually requested for is selected. Just change the type of the script rest code will remain same
function onLoad() {
var requestedFor = g_form.getReference('requested_for', setCountryAndHideField);
}
function setCountryAndHideField(requestedFor) {
if (requestedFor && requestedFor.country) {
var requestedForCountry = requestedFor.country.getDisplayValue(); // Get the display value of the country field of the requested user
// Check if the Requested For country is France or Ireland, then hide the Buyer Group field
if (requestedForCountry === 'France' || requestedForCountry === 'Ireland') {
g_form.setDisplay('buyer_group',false);
}
}
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 10:35 PM
as suggested I have written onload client script, However it is not working
Below is the code
function onLoad() {
//Type appropriate comment here, and begin script below
var requestedFor = g_form.getReference('request_for', HideField);
}
function HideField(requestedFor) {
if (requestedFor && requestedFor.company) {
var requestedForCompany = requestedFor.company.getDisplayValue(); // Get the display value of the country field of the requested user
if (requestedForCompany == 'Cubis Industries UK, Ireland & France') {
g_form.setDisplay('buyer_groups', false);
}
}
}
Do I need to modify any code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 11:22 PM
Hi @sriram7 ,
Can u put an alert on requestedForCompany variable n tell me wht u receiving?
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 01:03 AM