- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:12 PM
Hi All,
I have one requirement to auto populate group name based on user's email but below not working , tried so many ways but could not achieve please help
NOTE: Atul please dont reply on my question your always giving irrelevant reply diluted question plz dont do
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('requested_for', doAlert);
}
function doAlert(caller) {
var email = g_form.setValue('email', caller.email);
var email1 = g_form.getValue('email');
var email2 = email1.toString().includes('@brillio.com');
alert("sgsg" + email1);
alert("sjsj" + email2);
if (email2) {
g_form.setValue('assignment_group', '1519fcdadbe2830027f17db33c961949', 'Helpdesk Team');
alert(assignment_group);
} else {
// g_form.setValue('assignment_group', '214d4cd68718c210f505cbb5cebb359a', 'IMG Helpdesk Team');
g_form.setValue('assignment_group.sys_id', '214d4cd68718c210f505cbb5cebb359a');
alert(assignment_group);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 02:54 AM
Please replace your code with the below code. It is working fine for me. I just replaced few commands.
Also I noticed that you've removed the isLoading line in your code & because of it the script will execute onLoad & onChange as well(In my code I added that condition as well).
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') { //If you want your code to execute on Load as well you can comment if condition.
return;
}
var caller = g_form.getReference('caller_id', doAlert);
}
function doAlert(caller) {
var email = g_form.setValue('description', caller.email);
var email1 = g_form.getValue('description'); //replace description with your variable i.e email
var email2 = email1.toString().includes('@example.com');
alert("sgsg" + email1);
alert("sjsj" + email2);
if (email2) {
g_form.setValue('assignment_group', 'b85d44954a3623120004689b2d5dd60a', 'CAB Approval');
alert(assignment_group);
} else {
// g_form.setValue('assignment_group', '214d4cd68718c210f505cbb5cebb359a', 'IMG Helpdesk Team');
g_form.setValue('assignment_group', '477a05d153013010b846ddeeff7b1225');
alert(assignment_group);
}
}
Please mark it as "Accept as Solution" and " Helpful. if this solution helped you.
Thanks & Regards,
Madhan Somesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 02:19 AM
If the data is coming from email, then it's worth using inbound email flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 02:54 AM
Please replace your code with the below code. It is working fine for me. I just replaced few commands.
Also I noticed that you've removed the isLoading line in your code & because of it the script will execute onLoad & onChange as well(In my code I added that condition as well).
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') { //If you want your code to execute on Load as well you can comment if condition.
return;
}
var caller = g_form.getReference('caller_id', doAlert);
}
function doAlert(caller) {
var email = g_form.setValue('description', caller.email);
var email1 = g_form.getValue('description'); //replace description with your variable i.e email
var email2 = email1.toString().includes('@example.com');
alert("sgsg" + email1);
alert("sjsj" + email2);
if (email2) {
g_form.setValue('assignment_group', 'b85d44954a3623120004689b2d5dd60a', 'CAB Approval');
alert(assignment_group);
} else {
// g_form.setValue('assignment_group', '214d4cd68718c210f505cbb5cebb359a', 'IMG Helpdesk Team');
g_form.setValue('assignment_group', '477a05d153013010b846ddeeff7b1225');
alert(assignment_group);
}
}
Please mark it as "Accept as Solution" and " Helpful. if this solution helped you.
Thanks & Regards,
Madhan Somesh.