Not able to relate the change request to related list in Problem

kulkarnivivekn
Tera Contributor

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.

1 ACCEPTED SOLUTION

It worked for me. Please check your work closely to my notes.



I added this Change Request -> Parent list on my related lists.



find_real_file.png



And here's the complete business rule used to trigger the script:



find_real_file.png


find_real_file.png


find_real_file.png


find_real_file.png


If that doesn't work, check your permissions closely to make sure the tester has create and write permission on the change_request table.


View solution in original post

19 REPLIES 19

For maximum effectiveness and best community etiquette, please mark one of my responses above as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



Open the new requirement in a new discussion thread so others will see it as new and unanswered.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


This worked perfectly for me.  I'd mark it as answered if I could.  Thanks. 

Hi Chuck,



Seems like a slick solution; I have a similar requirement, whereby I am providing users the ability to create a change request from a problem via a UI Action. However the Change Request related list mentioned by Vivekanand does not auto populate with the change. To my understanding I need to set change.parent to the sys_id of the problem I am relating the change to. But my UI action isn't functioning as I want, and updating the related list. Do I need a separate BR like Vivekanand or can I do it in the UI action script?


relatedlistCodeSnippit.PNG


Thanks in Advance,


Robert


Hi Robert,



Is the change request getting created and just not linked?


Also, check line 13. I think it should be:



current.rfc = changeRequest.getUniqueValue();


zia
Tera Contributor

@Chuck Tomasi Thankyou so much for your reply Chuck. It was extremely helpful for me.