Need help in coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 06:34 AM
Hi ,
I have a field "text field" called Grade code in sys_user table.
When a requested for's grade code is greater than Level 11(example we have next Level 12 then Level 13 and soo on ) then a task should trigger for certain group.
Please help me in coding for this specific scenerio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 06:43 AM
You can look at Client Scripts for examples. Those that have Type = 'onChange'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:02 AM - edited 03-11-2024 07:03 AM
Hi @Laxmi18 ,
You can create Business rule on sys_user table
if (current.grade_code > 11) {
var task = new GlideRecord('sc_task');
task.initialize();
task.short_description = 'Task for user grade code greater than 11';
task.assignment_group.setDisplayValue('Your Group Name');
task.insert();
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:06 AM
Hi Anand,
Thanks for the script. I want to update workflow. Through workflow i want to trigger task based on this script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 07:27 AM
Hi @Laxmi18 ,
If you want this for Service catalog then You need to do this in Workflow. Create a if block with the below condition and create task if condition is yes.
Here is the sample screenshot:
Script:
answer = ifScript();
function ifScript() {
if (current.variables.grade_code >11 ) { // Update the field name with original field name
return 'yes';
}
return 'no';
}
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda