- 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 06:02 AM
Hello kartik,
That business rule is running in which table?
Why aren't you doing this directly in the ui action when creating the problem record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 06:02 AM
Hi Kartik,
ServiceNow actually provide this functionality for you ' Out Of Box'.
You'll be able to see this functionality by right clicking at the top of the incident form and selecting the 'Create problem' menu option as shown below.
To also enable this functionality as a button on the Incident form, go to:
'Configure' > 'UI Actions' (Again from right clicking at the top of the incident form.
Open the 'Create Problem' UI Action against the Incident table, and check the 'Form button' check box on the right hand side. (Again, shown below)
To help others, please mark correct and/or helpful.
Thanks,
Robbie
Screen shot 2: Create Problem and 'Form button' check box:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 06:10 AM
Hi,
We already have OOTB UI action which does this job, is that UI action not showing problem created in problem field?
FYI : UI action is available in context menu which will be visible when Problem field is empty and state is not closed.
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Community Rising Star 2022
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2022 06:21 AM
Thanks all for your quick responses.
No worries with UI action which i have created.
here i will elaborate more
1. I have created UI action named "Problem" on incident.
2. and i have made configuration that if i click on button which will create one problem record.
Nothing to worry about above steps.
NOTE: What i want to achieve is
1. Once the problem record is created, i want to populate that record number on incident form
(field - Peoblem (problem_id))