- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:11 AM
Hi,
I've got a table, lets call it Shops and on the table Shops there is a field for ShopID which is the shops unique ID. The field db name is u_shopid.
Then I have another table, lets call it Asset which includes the assets for the shop. On this table there is also a ShopID that is the shops unique ID. The field db name is u_shopid.
Then i created a Relationship for these two tables.
And the query is:
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
})('u_shopid', parent.u_shopid);
And the result I want is that when i go into the Shops table, I will see the related lists with the assets for this shop. So I add the relationship i created as a related lists to the shop form.
But somehow I can't get the related list to show the assets for that spesific shop that i see on the screen when i'm in the form.
What am I doing wrong
Best regards,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:21 AM
Hello Rody,
Replace your code with this.
(function refineQuery(current, parent) {
current.addQuery('u_shopid', parent.sys_id);
})(current, parent);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:21 AM
Hello Rody,
Replace your code with this.
(function refineQuery(current, parent) {
current.addQuery('u_shopid', parent.sys_id);
})(current, parent);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:32 AM
Hi Pradeep,
That worked, thanks. Now I know alot about related lists
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:34 AM
Excellent!
Let me know if that answered your question. If so, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2016 12:30 AM
Hi Rody,
Pradeep should work, In case if it does not, I presume that might be because the shop_id field is not a reference field on your Asset table so, something like below should work
(function refineQuery(current, parent) {
current.addQuery('u_shopid', parent.u_shopid);
})(current, parent);