The CreatorCon Call for Content is officially open! Get started here.

How to create UI action context menu to create a problem ticket on the change_request table

Joshua Comeau
Kilo Sage

I can see the Create Problem UI action but when I click it, it does create the problem but doesn't bring me to the problem ticket

 

Script:

createProblem();

 

function createProblem() {

 

  var prblm = new GlideRecord('problem');

 

  prblm.initialize();

 

  prblm.assignment_group = current.assignment_group;

 

// more stuff

 

  prblm.insert();

 

}

 

action.setRedirectURL(current);

 

can someone please provide a script for this to work

1 ACCEPTED SOLUTION

Eswar Chappa
Mega Sage

Hi @Joshua Comeau  write the below code in the UI action

 

 

var newProblem = new GlideRecord("problem");

newProblem.initialize();

newProblem.setValue("short_description", current.getValue("short_description");

//similarly copy other fields as per your requirement

var problemSysID = newProblem.insert(); // returns sys_id of the newly created problem

current.setValue("problem_id",problemSysID);

current.update();

action.setRedirect(current); // if you set "current", will stay on same page. If you set "newProblem" it will redirect to newly created problem record.

Thanks & Regards,

Eswar Chappa

Mark my answer correct and Helpful if this helps you 😀

View solution in original post

1 REPLY 1

Eswar Chappa
Mega Sage

Hi @Joshua Comeau  write the below code in the UI action

 

 

var newProblem = new GlideRecord("problem");

newProblem.initialize();

newProblem.setValue("short_description", current.getValue("short_description");

//similarly copy other fields as per your requirement

var problemSysID = newProblem.insert(); // returns sys_id of the newly created problem

current.setValue("problem_id",problemSysID);

current.update();

action.setRedirect(current); // if you set "current", will stay on same page. If you set "newProblem" it will redirect to newly created problem record.

Thanks & Regards,

Eswar Chappa

Mark my answer correct and Helpful if this helps you 😀