- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 05:00 PM - edited 04-28-2024 05:10 PM
I need to display an alert (pop up message with 'OK' to acknowledge) on a case when ever it is updated but only if it is from a certain contact, I have tried the foillowing client script but does not work, any assistance please?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 10:44 PM
Hi @Jason116
Thanks for your response
May be something is happening with you because the same script i have tested on my instance it's working.
Tips: Please check you account value and backend name of your field
//onSubmit client script
var test="test";
var account=g_form.getValue('account');// take the account value so that can be mapped with specifiec account value in this case we used "test"
if(account==test&&!g_form.isNewRecord())
{
g_form.setValue('account',account);
alert('ok');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 07:01 PM - edited 04-28-2024 07:07 PM
Hi @Jason116 ,
You created onChange client script instead of you have to create onSubmit client script than it will work when you save or submit the form
Client sciprt
function onSubmit() {
//Type appropriate comment here, and begin script below
alert('here');
var contact = g_form.getValue('customer_contact');
if (customer_contact == 'TEST') {
// Display pop-up message
alert('Case has been updated.');
}
}
For reference you can check above images
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 09:00 PM
Your example script has 2 alerts in it? and is displaying on every case regardless of the contact?
Also can we change this so that it happens on account not contact?
i.e. I need the alert to be displayed when any update is made to the case and the account = TEST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 07:06 PM
Hello @Jason116
function onChange(control, oldValue, newValue, isLoading) {
// Check if the case is from the contact "TEST"
var contact = g_form.getValue('customer_contact');
if (contact == 'TEST') { //updated here because you assigning the value to the contact variable
// Display pop-up message
alert('Case has been updated.');
}
}
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 09:01 PM
This is not doing anything?
Also can we change this so that it happens on account not contact?
i.e. I need the alert to be displayed when any update is made to the case and the account = TEST