- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2016 06:58 AM
Hi,
In Problem,i have created the one reference field for change request based on if change required is YES and Problem state is resolved then the attached
change should display in related list->change request tab.
I have written below business rule but its not pushing to the change request in related field.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rec = new GlideRecord('change_request');
rec.initialize();
rec.change_request = current.rfc;
rec.task = current.sys_id;
rec.insert();
})(current, previous);
Please help me to do this.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 08:35 AM
It worked for me. Please check your work closely to my notes.
I added this Change Request -> Parent list on my related lists.
And here's the complete business rule used to trigger the script:
If that doesn't work, check your permissions closely to make sure the tester has create and write permission on the change_request table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 08:12 AM
Hi,
Still its not pushing change to related list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 08:35 AM
It worked for me. Please check your work closely to my notes.
I added this Change Request -> Parent list on my related lists.
And here's the complete business rule used to trigger the script:
If that doesn't work, check your permissions closely to make sure the tester has create and write permission on the change_request table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 11:31 PM
Thank you so much now i am able to push change to related list.
Now i have one more query :
Problem state is 'resolved' and change required is 'yes' based on this condition only
Related list-->change request(Change request->Parent) should visible to user and Edit and New button should Omit.
Please help me to achieve this.
Please help me

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 05:54 PM
If you want to make the visibility of the related list condition (show sometimes and hide others) use a client script using the method g_form.showRelatedList() and g_form.hideRelatedList().
Docs: Client Scripts
Docs: GlideForm
Client Script Best Practices - ServiceNow Wiki
To hide the New and Edit button, use the Configure> List Control option and check those boxes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2016 11:38 PM
Thank you so much its working fine for me.
If we add a new button "Download" that if selected it will download the Document from ServiceNow
above is the one more requirement if possible please help to achieve,