- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 09:42 AM - edited 08-28-2023 10:09 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 10:57 AM
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 😀
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 10:57 AM
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 😀