Issue with Related Attachments" Related List

Edxavier Robert
Mega Sage

Hi, I have been trying to follow the instructions from this article from @Jim Coyne  but I am unable to find a way to apply the same logic per my requirements. I am working on a scoped application and I am facing an issue to get the table_sys_id to filter to the correct records.

 

What I am trying to do is show in a related list all the attachments from the parent table into the child table. Table1 is the parent table and table 2 is the child table. Everytime an attachment gets added at the parent table I wanted to show at the child table, so I don't have to use the copyAttachment option. 

 

So far I can get

 

Any guidance will be appreciated!

 

1 ACCEPTED SOLUTION

Edxavier Robert
Mega Sage

After many tries, found my solution. Posting here for anyone that is interested. 

 

Went to System Definition --> Relationships

Create new record

In Applies to table - Add the table where you want the Related list to show. In my case my child table.

Queries from Table - the sys_attachment table

in the box Query from add this code: 

current.addQuery('table_name',parent.parent_case.sys_class_name);
current.addQuery('table_sys_id',parent.parent_case.sys_id);

In my case the parent_case is the field on the child table that reference the parent table. 

 

Hope this help others!

View solution in original post

1 REPLY 1

Edxavier Robert
Mega Sage

After many tries, found my solution. Posting here for anyone that is interested. 

 

Went to System Definition --> Relationships

Create new record

In Applies to table - Add the table where you want the Related list to show. In my case my child table.

Queries from Table - the sys_attachment table

in the box Query from add this code: 

current.addQuery('table_name',parent.parent_case.sys_class_name);
current.addQuery('table_sys_id',parent.parent_case.sys_id);

In my case the parent_case is the field on the child table that reference the parent table. 

 

Hope this help others!