Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action creating problem task from problem

Community Alums
Not applicable

Hi,

 

I am creating a problem task from a problem table using UI Action. I tried it, but it is not working. Kindly help.

 

1p.png

 

2p.png

 

var gr = new GlideRecord('problem_task');
gr.initialize();
gr.short_description = current.short_description;
gr.assigned_to = current.assigned_to;
gr.insert();
action.setRedirectURL(current);

 

3p.png

 

4p.png

 

Regards

Suman P.

1 ACCEPTED SOLUTION

Bhavya11
Kilo Patron
Kilo Patron

Hi @Community Alums ,

 

Please update the script below

 

var gr = new GlideRecord('problem_task');
gr.initialize();
gr.short_description = current.short_description;
gr.assigned_to = current.assigned_to;
gr.problem=current.sys_id;// link problem to problem task
gr.insert();
action.setRedirectURL(current);

 

 

 

Please mark helpful & correct answer if it's really worthy for you.

 

Thanks,

BK

View solution in original post

3 REPLIES 3

Bhavya11
Kilo Patron
Kilo Patron

Hi @Community Alums ,

 

Please update the script below

 

var gr = new GlideRecord('problem_task');
gr.initialize();
gr.short_description = current.short_description;
gr.assigned_to = current.assigned_to;
gr.problem=current.sys_id;// link problem to problem task
gr.insert();
action.setRedirectURL(current);

 

 

 

Please mark helpful & correct answer if it's really worthy for you.

 

Thanks,

BK

ShuklaAnkit
Tera Expert

@Community Alums  As mentioned above by @Bhavya11  You also need to assign the Problem task with the parent record which would be the Problem on which you initiate the UI action.

Please mark helpful & correct answer if it's really worthy for you.

 

Thanks,

Ankit Shukla

Ehab Pilloor
Mega Sage

Hi @Community Alums,

Problem task is being created but without linking to the problem record. If you want to link problem to problem task record, use 

gr.problem = current.sys_id;

If you found my response helpful, please mark it as Solution and Helpful.

 

Thanks and Regards,

Ehab