- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 09:10 AM
Hi
i would like to know how this scenario can be done.
I have a variable named "Expenditure type" and this expenditure type has a value named"Lease"
the "Lease" should be visible only for the users from the US. (i,e) when the user's email id ends with @usa.com
Can you please help me with this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 02:49 AM
Hi @Abdul ,
create this client callable script include
var CheckUserEmailDomain = Class.create();
CheckUserEmailDomain.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isParklandUser: function() {
var email = gs.getUser().getEmail();
return email && email.endsWith('@usa.com');
}
});
you may see the highlighted field as Client callable ( check it )
create onload client script
function onLoad() {
var expenditureType = 'u_expenditure_type'; //update this with expenditure type varialbe name if required
var ga = new GlideAjax('CheckUserEmailDomain');
ga.addParam('sysparm_name', 'isParklandUser');
ga.getXMLAnswer(function(response) {
if (response == 'true' || response == true)
g_form.removeOption(expenditureType, 'lease'); // is lease is the backend value of lease choice else update it with correct value
});
}
update the variable names and choice values if required with correct values
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 02:21 AM
can you please help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 02:49 AM
Hi @Abdul ,
create this client callable script include
var CheckUserEmailDomain = Class.create();
CheckUserEmailDomain.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isParklandUser: function() {
var email = gs.getUser().getEmail();
return email && email.endsWith('@usa.com');
}
});
you may see the highlighted field as Client callable ( check it )
create onload client script
function onLoad() {
var expenditureType = 'u_expenditure_type'; //update this with expenditure type varialbe name if required
var ga = new GlideAjax('CheckUserEmailDomain');
ga.addParam('sysparm_name', 'isParklandUser');
ga.getXMLAnswer(function(response) {
if (response == 'true' || response == true)
g_form.removeOption(expenditureType, 'lease'); // is lease is the backend value of lease choice else update it with correct value
});
}
update the variable names and choice values if required with correct values
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2025 07:46 AM
Thanks for helping @Chaitanya ILCR
@Abdul looks like you had the script include and glide ajax correct...just needed to use g_form.