- 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-15-2024 12:26 PM
Hi @Swati k1 ,
Create script Include and On-Change Client script.
Please refer to below thread
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:35 PM
Hi @Swati k1,
Can you try changing your code to something below:
if (email2) {
g_form.setValue('assignment_group', '1519fcdadbe2830027f17db33c961949');
} else {
g_form.setValue('assignment_group', '214d4cd68718c210f505cbb5cebb359a');
}
If it still doesn't work, can you elaborate on what 'alert' you are getting?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:40 PM
Hi, instead of adding to your technical debt can you not leverage the auto assignment rules?
Please mark as helpful or if it’s resolved the issue, CORRECT!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 12:56 AM
Which form are you working on? Incident, SCTASK etc?
I would suggest you to create Business Rule on the form (table) you work on.
You can achieve your requirement without coding.