how to stop passing 'special instructions' value to before sc task activity in workflow

raj765_32
Tera Contributor

hi can anyone help me with scenario for 

when i submit a catalog item there are three sc tasks in where i have written a code in 2 and 3 rd sc task to display some value in special instructions field.

 

What happening is that after i close complete 1 st sc task, the data/value written in  2 and 3 sc task is getting displayed when 1 st sc task is closed complete. 
please help me how to fix this and where to fix this in which sc task.

below is the code :
i have written this code in workflow 2nd and 3rd  catalog task activity

var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id', current.request);
gr.query();
 
if(gr.next())
{
gr.special_instructions = "1. Complete template to request EP End User Access form Blue Yonder. \n\n2. Submit request (Medium priority) via Blue Yonder portal.";
gr.update();
}

my requirment is that special instructions value should not display in 1 st sc task when the task is completed  and what ever state it should display in 2 and 3 rd sc task only
1 ACCEPTED SOLUTION

So I added the line in the catalog task and it was updated in the tasks.

u_special_instructions = 

Dhanashree1_1-1714203336251.png

 

and it was updated in the task. It was not updated in the 1st one as per your requirement. If you have created the field check the name of the field that you have created. 

 

Dhanashree1_0-1714203083091.png

 

View solution in original post

12 REPLIES 12

If i update on sc_task it is not showing in all the 3 sc tasks? Can u please help me with the code for sc_task? 

Ankur Bawiskar
Tera Patron
Tera Patron

@raj765_32 

so where is the code which adds the special instruction to 1st sc_task?

you need to search that and update the logic there

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

this code i have written in 2 and 3 rd catalog task activity and it is showing in 1 st catalog task after 1 st one gets closed complete

Dhanashree1
Tera Expert

Here you have used sc_request table, but i think the sc_task should be refered as you are updating the task right? and maybe you can it can be simple update like -

task.special_instructions = "1. Complete template to request EP End User Access form Blue Yonder. \n\n2. Submit request (Medium priority) via Blue Yonder portal."

 

as you can see below variables can be updated by the following statements in sc task activity as given by servicenow :

Dhanashree1_0-1714147529193.png

is this what you are looking for or am i missing something?

If i use task.special instructions it is not at all populating and when i confugure the special instructions field its parent is sc_req_item table 

 

can you please show with querying sc_task table as when i replace with sc_task 

nothing is generating in other two tasks as well