Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

REQ RITM parent relationship

Brendan Hallida
Kilo Guru

Hi all,

I have found something uncanny - however it may be uncanny to me, but not to others.

I am looking to dot walk from Catalog Task form to the request - via parent.parent.watch list, however I have found that OOB the request is not set as the RITM's parent.

find_real_file.png

I have a few questions regarding this:

  1. Is there a reason for this?   Should I leave it how it is, or is it ok for me to fill in the RITM parent?
  2. If it is ok to do so - what is the best way to approach this?   A run script in the workflow?   A BR?
  3. Or - is there a better way to display the request.watch list on the catalog task form?   (I have posted that question here request watch list on catalog task form )

Cheers,

Brendan

1 ACCEPTED SOLUTION

srinivasthelu
Tera Guru

Hi Brendan,



Reference fields expect sys_id's



so,


  1. current.parent = current.request ;


Should do



Thanks


Srinivas


View solution in original post

15 REPLIES 15

Hi Srini,



Yes it does - however I need to have the RITM field not read only on the catalog task form, and the request field not read only on the ritm form...



This is not the end of the world - however would prefer to have them both read only so fulfillers are not able to change the request the request item is a part of by accident...



You wouldnt happen to know what acls (if any) define these permissions would you?


Cheers,


Brendan


I do not think it is possible or I do not know any such possibility.



You either have make parent field not read only, or create a new watch list field and sync between catalog task and request.



With the first option, to avoid any possibility of unintended updates to request field, You could write a Before business rule to abort the action



Hope that helps



Thanks


Srinivas


Brendan Hallida
Kilo Guru

so after all of that - I think the best way forward is to fill the request item parent to be the current request number.   This will then allow me to use the watch list how I would like with out any issues.



However I am having trouble with the script.



I have tried both a business rule and a run script - however I am not having any luck.



the run script in the workflow is a very simple one, however the request item parent field is not updating:


current.parent = current.request.number;




I have also tried with a business rule


Table: Request


When to run: Before, Insert, Update



(function() {


  //get the gliderecord for the parent request item


  var reqitem = new GlideRecord('sc_req_item');


  if (reqitem.get(current.request_item)) {


          reqitem.parent = current.number;


    reqitem.update();


  }


})();



Can anyone see where I am going wrong?



Cheers,


Brendan


srinivasthelu
Tera Guru

Hi Brendan,



Reference fields expect sys_id's



so,


  1. current.parent = current.request ;


Should do



Thanks


Srinivas


That'll do it!



Thanks Srini, you rock!