- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 04:47 AM - edited 05-30-2024 06:20 AM
Hello
I have a question regarding Business Rule Script.
When the caller is Abraham Lincoln, I want Channel to be populated as Self-service. (As you can see in the image below)
Here is the script but it is not working.
(function executeRule(current, previous /*null when async*/) {
// Ensure the caller ID is present
if (current.caller_id) {
// Get the caller's record from the sys_user table
var caller = new GlideRecord('sys_user');
if (caller.get(current.caller_id)) {
// Check if the caller's name is Abraham Lincoln
if (caller.name == 'Abraham Lincoln') {
// Set the channel to Self Service
current.channel = 'self-service';
}
}
}
})(current, previous);
I appreciate any help.
TIA 😃
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 08:02 AM
Hi @AysenurU ,
You can write onChange client script and populate the Channel value,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var caller = g_form.getReference('caller_id', currentUser1);
}
function currentUser1(caller){
if(caller.name == 'Abraham Lincoln'){
g_form.setValue('contact_type','self-service');
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 08:06 AM
Thanks for your reply. I have just seen that you also answered my friend's very same question. Your solution works well. Thank you. 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 08:10 AM
@AysenurU Thank you for this ! Please close this thread by accepting the appropriate answer