The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Populate Assigned To on Request & RITM

barnesn
Kilo Explorer

Hi all,

 

I have been trying to find a way to populate the RITM 'Assigned To' field with the Request's 'Assigned To' info.   Basically when someone submits an order guide via the Service Catalog a request is created and the 'Assignment Group' field on the request gets populated via an assignment rule.   When a person from that assignment group sees the request come in and they decides to work that request, they then assign that request to themselves.   It is at this point in time, that I want the RITM's attached to that request to update its 'Assigned To' field automatically with the same user information that is in the Request's 'Assigned To' field.

 

Overall, I am trying to eliminate the need for the service desk person to assign both the request and the RITM's manually.   If they can assign it to themselves once via the request and have that information trickle down to its child(ren) (RITM(s)) that would be awesome !

 

Is this even possible?   I am not a developer, thus I cannot code.   If this is possible via code can you please attach the necessary script I will need to use.

 

Thanks a bunch!

1 ACCEPTED SOLUTION

Hi Niccole,



My mistake, try this instead:



action.setRedirectURL(current);


View solution in original post

11 REPLIES 11

Ken83
Mega Guru

Well Niccole,



        It is definitely possible. What you will want to do is create a Business Rule that runs 'After' 'Update' that will run a query to the Requested Item table and search for all records that have a 'Request' field that matches the current Request sys_id. See below..



Business Rule Name : < insert whatever you want to name it >


When to Run : After > Update


Condition : current.requested_for.changes && !current.requested_for.nil();



var gr = new GlideRecord(sc_req_item);


gr.addQuery('request', current.sys_id); <!-- This is to get all records where the 'request' field matches the current request sys_id-->


gr.addActiveQuery(); <!-- This is to capture only the request items that are active -->


gr.query();


while(gr.next()){


gr.assignment_group = current.assigned_to.u_default_group; <!-- this should pull from the persons default group field on their user record.-->


gr.assigned_to = current.assigned_to; <!-- this should set the assigned to on the associated request items to the person that assigned the request to themselves. -->


gr.update();


}



I think that should work for you!


felipe_barbosa
ServiceNow Employee
ServiceNow Employee

Hi Niccole, yes, this is possible and should be pretty simple. I would not use the dictionary "Default Value" of the assigned_to field on the table ´s dictionary because when both are created (Both the REQ and the RITM) it is not assigned to somebody so it would have no effect.



I can see this done in two ways:



1. Create an UI Action on the REQ form named "Assume", "Assign this to me" or something like this, and inside the code, you would do the current.assigned_to = g_user.getUserId();



1.1 Also, you would need to perform a check on RITMs that belongs to the current REQ and then change their respective assigned_to to the same g_user.getUserId();



2. Instead of the UI Action, if people are manually searching for people in the Assigned to field and populating it, then, I would say that an "after" business rule on the table sc_request will do the trick.



If you can tell me which solution fit the best for you, I am able to provide you with some coding.



Also, I think you should ask yourself if inside the same REQ if there ´s any possibility of having two RITMs that should be done by totally different groups or personel, then this customization can generate some headaches...



Best regards,




Felipe


Hi Felipe,



Solution 1 sounds like it would be a better fit.



Essentially, I am looking for a way that when the "Assigned To" field on the request form is populated and saved, that the information in that field trickles down into the RITMs "Assigned To" field.   That way the user only has to assign the REQ to themselves and the requested items follow suit.  



Currently, as it stands, our company doesn't see the need for having two people inside the same REQ working different RITMs.   However, with that being said, if for some reason John Doe assigns the REQ to himself and as a consequence the RITMs get assigned to him, are we still able to drill down into a particular or multiple RITMs and then assign them to another user, if we are to implement solution 1?


With this solution(1), it will automatically assign all RITMs associated with the REQ. That will happen each time that assigned to person changes. So if John Doe does it first, he is going to get those RITMs assigned to him. Then if Jane Doe takes over the REQ, she will then inherit the associated RITMs. You would have to manually re-assign the RITMs that you don't want Jane Doe to have.