- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 05:51 AM
I created BR, after insert/update
(function executeRule(current, previous /*null when async*/) {
var num = new GlideRecord('problem');
num.addQuery('number',current.parent.number);
num.query();
while(num.next())
{
num.problem_id = current.number;
num.update();
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 10:29 AM
I think you can have it on the same 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.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 10:29 AM
I think you can have it on the same 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.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 01:43 AM
Hi, Thanks for the answer, i have the same problem, i use your code and when i click on the button for create problem, an new incident form is created (same as create new record for incident).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2022 06:45 AM
What have you done, if you can share the code/snapshot, I will be able to guide.
Hope you have followed this as well:
action.setRedirect(current); // if you set "current", will stay on same page. If you set "newProblem" it will redirect to newly created problem record.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2025 03:48 AM
hello @Aman Kumar S
can you please help in understanding why my ui action script is not working. I added few alert messages and alert 3 is not getting displayed :
Client : true