How do I get list of RITMs for a given REQ in flow designer?

aryanjain27
Tera Contributor

Hi,
I am using a "Look up Record" to get the REQ record. I am able to get that but in the output I do not see anything that says Requested Items. When I go to the REQ record and scroll down, I do see the list of RITMs on it under requested items tab, but how do I get those numbers/their sys ids, in flow designer? If not directly in flow designer, is it possible to create an action and write a script to get that?

 

Thnx in advance!

2 ACCEPTED SOLUTIONS

M Iftikhar
Kilo Sage

Hi @aryanjain27 ,

When you look up a REQ (sc_request) record with Look Up Record, you’re only getting the fields from the sc_request table itself. The Requested Items (RITMs) you see on the form are from the related table sc_req_item, which has a reference field request pointing back to sc_request.

Options:

1. Use Look Up Records 

  • In Flow Designer, instead of "Look up Record" , use Look up Records.
  • Table: sc_req_item
  • Condition: request =  map the REQ sys_id you got earlier.
  • This will return a list of RITMs for that REQ.
  • You can then loop over them using For Each to get each RITM number or sys_id.

2. Script Action

Yes, you can create a custom action with a Script step to achieve the same.

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

View solution in original post

Instead of mapping the data pill to the request number, keep it mapped to the request record itself.

View solution in original post

15 REPLIES 15

SunilKumar_P
Giga Sage

Hi @aryanjain27 - If the REQ contains multiple RITMs under it then I sugegst to use the "Look Up Records" action on RITM with condition Request is and then you can use For Each logic.

Brad Bowman
Kilo Patron
Kilo Patron

REQs don't have a field that relates them to an RITM, but RITMs have this for REQs, so once you have the REQ record, look up records on the sc_req_item table that have this value in the request field. 

This is pretty neat. But when I try to look for record on sc_req_item with request=REQxyz, it returns no record and fails with error "No record found". However, when I list the sc_req_item in console, and filter the table with request=REQxyz, I do get all the RITMs under that Req. Also, I see only 2 choices for the option: If multiple records are found - "Fail the step" or "Return only 1st one"

Can you share the code screenshot? I think you might be passing the request number directly, because if that’s the case, then you need to filter using the request.number field.