get reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 11:04 AM
Hi guys ,
here I am trying to display a message " please look into it urgently as its issue related to VIP user when caller is VIP " and priority is one on submit but its not going inside the loop to check can you please help you figure out if I am checking it correctly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 11:39 AM
Hi @tghadage124
Please make changes in the script as user.vip == "true" instead of user = vip.
Please mark it helpful and correct , if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 11:44 AM
It's probably hoisting the 'pri' variable, but I wouldn't count on it, so it's safer to put it first - and you need to use the correct syntax in the getReference callback
function onSubmit() {
var pri = g_form.getValue('priority');
var user = g_form.getReference('caller_id',getcaller);
function getcaller(user) {
if (user.vip == 'true' && pri == 1) {
g_form.addErrorMessage('please look into it urgently as its issue related to VIP user');
} else {
g_form.addInfoMessage('everything looks good as of now');
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 02:50 AM
you were correct , its the hosting of the pri variable , it worked ,thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2024 07:20 PM
Hi @tghadage124
The problem in your script is the way you are trying to check the VIP user. Refer below updated script and give it a try :
function onSubmit() {
//Type appropriate comment here, and begin script below
var pri = g_form.getValue('priority');
var user = g_form.getReference('caller_id',getcaller);
function getcaller(user) {
if (user .vip == 'true' && pri == 1) {
g_form.addErrorMessage('please look into it urgently as its issue related to VIP user');
} else {
g_form.addInfoMessage('everything looks good as of now');
}
}
}
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.