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

Well, Id say that yes, as long as you have a similar UI Action as a button on the RITM form, where the user, by pressing it, can assume the RITM (automatically populating the assigned_to field as himself).



So, in the end you will have:



1. A UI Action as a REQ Form button that assumes that Request for himself, named "Assume", "Assign to me", etc. This code will fulfill the assigned_to of the person on the Request and all Requested Items that are below the Request. The code will look like this:



var user = gs.getUserID();


current.assigned_to = user;


var glrRitm = new GlideRecord("sc_req_item");


glrRitm.addQuery("request",current.sys_id);


glrRitm.addQuery("active",true);


glrRitm.query();


while(glrRitm.next()) {


        glrRitm.assigned_to = user;


        glrRitm.update();


}


current.update();




2. An UI Action as a Requested Item form button, just like the previous, should be named as something that tells users that pressing that button will assign that req_item for himself (only that req_item, leave alone the REQ and other RITMs), and the code will look like this:



var user = gs.getUserID();


current.assigned_to = user;


current.update();




Those codes can be incremented with nice features to stay on the same page, show a message at the top of the screen and etc.



I hope this help you on your feature design.



Best regards,




Felipe


Hi Felipe,



I followed what you wrote and it works; however, when I click the button, it doesn't keep me on the REQ form page.   It takes me back to the REQ list.   Is there a way that when I select this button that it says on the REQ form?



I appreciate all your help


NiccoleREQ - RITM Question.dib


Hi Nicole,



I think that if you add this line after all the code in the UI Actions you created:



gs.setReturn (current.getLink(true));



It won ´t redirect you to the list of REQs, instead, the form you're currently seeing will be saved with the new info (assigned_to = you) and you will stay in the same form.



Please try it, and in case it works, I would humbly ask you to mark this as answered



Best regards,



Felipe


Sadly that didn't seem to work.



Name: Assign to Me


Table: sc_request


Show Insert: true


Show update: true


Form button: true


Form Context menu: true



Here is the code:


var user = gs.getUserID();



current.assigned_to = user;



var glrRitm = new GlideRecord("sc_req_item");



glrRitm.addQuery("request",current.sys_id);



glrRitm.addQuery("active",true);



glrRitm.query();



while(glrRitm.next()) {



        glrRitm.assigned_to = user;



        glrRitm.update();



}



current.update();



gs.setReturn (current.getLink(true));


Hi Niccole,



My mistake, try this instead:



action.setRedirectURL(current);