- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 07:21 AM
Here is the scenario:
In Stories, in the Related Links area, I have some related lists: Affected CI's, Change Requests, etc.
I can do the usual Edit or New to add records to - lets use Change Request for example. No problem.
I have created a UI action to Create a Change Request from Story which works just fine.
The problem is: How do I add the change request number (or sys_id) to the Change Requests Related List in my UI Action script?
I cannot find where that data is stored.
Thanks!
Dan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 07:50 AM
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.setValue("parent", current.sys_id); // Adds to related records
changeRequest.insert();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 07:48 AM
It should be
changeRequest.setValue("parent", current.sys_id);
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 07:50 AM
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.setValue("parent", current.sys_id); // Adds to related records
changeRequest.insert();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 07:52 AM
Thank you very much!! That worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 08:09 AM
Sorry, I have a quick followup - In that change record that I am creating from the UI Action above, how do I relate the story back?
In Change Requests, I also have Stories under Related Links.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 08:19 AM
Please modify the code within these lines and see if it works
changeRequest.setValue("parent", current.sys_id); // Adds to related records
var id = changeRequest.insert();
current.parent = id;
current.rfc = changeRequest.getGlideRecord().getUniqueValue();
current.update();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response