How to auto populate related list with business rule?

jonsr20
Tera Expert

Hey everyone,

 

I have added a project field to the sc_req_item table and a related list to the pm_project table for sc_req_item.number. I am trying to create a business rule for it to populate this related list with the sc_req_item.number if there is a project populated in the req item. I am pretty new to the platform and have tried several things from other post but none seem to be working. Attached several pictures below, I just want that related list to populate with whatever req item numbers that project is on.

 

Thanks everyone,

Jon

10 REPLIES 10

Thank you for your response, I already have the related list on the project table. I am attempted to make that list auto populate with the RITM number I have the specified project listed on. I attached some pictures below, basically if I populated that project field on the Request item I would like it to auto populate that related list for that project with the RITM number. Any idea how to achieve that?

 

Thanks,

Jon

Hi, 

In this case just change the "Applies to table" as Project and "Queries from table" as Requested Item in the Relationships. It should work.

 

Thanks!

Lavanya

I can manually select an RITM from the related list, but it does not auto populate for whatever RITM I put that project on. I think I may need to create a business rule, but I am not proficient enough in scripting to know how to write the script to accomplish this goal. Any other thoughts are much appreciated!

 

Thanks,

Jonathan

KevinBellardine
Kilo Sage

Related lists are pre-defined relationships, and if you use reference fields the relationships already exist. For example, if I'm on the Problem table there's a related list for Incidents. On the Incident table there's a field called "Problem" (I think it's actually called Parent and references task but work with me here).

 

That means that in order to get an Incident to show up on a related list for a problem, I need to:

1. Create an Incident

2. Create a Problem

3. Add the Problem to the reference field on the Incident form

4. Add the related list to the Problem form (if required)

 

If I do this then I'll see a single incident when I open the problem I associated it to. That's the OOB behavior, a reference field created on any table creates a related list relationship between the table the field is on and the table the field is referencing.

 

You can also code your own relationships by going to system definition --> relationships. Here the syntax is similar to a query business rule, you're defining the parent (where the list will be) and child (what table is being queried) then writing a gliderecord query.

 

I hope that helps. The TLDR here is that you don't 'add' anything to a related list. You configure the related list or custom relationship to display the records you want, then in order to get those records to show up on the list you just make sure they meet the criteria of the list you're using.

Something like this? Forgive me I am new with JavaScript and still learning any assistance with the syntax would be helpful. If the relationship already exists, would it be better to use a business rule? 

 

(function refineQuery(current, parent) {

	current.addQuery('number', parent.sys_id);

})(current, parent);