Need help in coding

Laxmi18
Tera Expert

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

 

4 REPLIES 4

Bert_c1
Kilo Patron

You can look at Client Scripts for examples. Those that have Type = 'onChange'.

Anand Kumar P
Giga Patron
Giga Patron

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

Hi Anand,

 

Thanks for the script. I want to update workflow. Through workflow i want to trigger task based on this script

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:

 

Sumanth16_0-1710167113696.png

 

 

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