- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:24 AM
Hi, I want to display pop-up when form loads when contact field is guest (his userID is guest).
I wrote the script, but it fails. Any ideas why?
function onLoad() {
//Type appropriate comment here, and begin script below
var user = g_user.UserID();
if (user == 'guest'){
alert("Please update Contact field to actual customer reporting the issue before proceeding");
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:28 AM
Hi,
I was wondering how you have allowed the guest user to login to the system. What you can do is to fetch the contact field value itself by
g_form.getValue('name of contact field')
var user = g_form.getValue('name of contact field');
if (user == 'guest'){
alert("Please update Contact field to actual customer reporting the issue before proceeding");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:28 AM
Hi,
I was wondering how you have allowed the guest user to login to the system. What you can do is to fetch the contact field value itself by
g_form.getValue('name of contact field')
var user = g_form.getValue('name of contact field');
if (user == 'guest'){
alert("Please update Contact field to actual customer reporting the issue before proceeding");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 05:45 AM
Works like a charm now, thank you.
One more question - how can I cancel any updates on the ticket if Contact hasn't been updated? For example - someone updates field state, but leave caller as guest, I want cancel update then.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 06:34 AM
Hi,
You can write an after update business rule and check the value of contact field, if its still guest then you can setaction abort value as true, which means update wont work and throw an error to user.
You can also add up a custom message.
var contactField=current.u_contact_field;
if(contactField=='guest'){
gs.addErrorMessage("Please update teh caller field value");
current.setAbortAction(true);
}
Replace the u_contact_field with your field name.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 05:24 AM
Thanks for this. Funny thing is, even though I get the error AND invalid update, the update is not being aborted and after reloading the form, whatever was changed, remains changed. Any ideas? I already lowered the order, to no avail.