- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 04:51 PM
In Order Management:
How can I script a Relationship from the 'Oder Line Item' to the 'Product Order'?
System Defenition > Relationships
Order Line Item: sn_ind_tmt_orm_order_line_item
Product Order: sn_ind_tmt_orm_product_order
Field on Order Line Item table: order_line_item
Field on Product Order Table: number
See attached.
I need to create a Related List on the Product Order table that displays the associated Order Line Items.
Greatly appreciate help!!!
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 07:22 PM
No worries @Su522,
I see, so you want to show all the Order Line Items under the same Order. I don't have much experience with Order Management but I don't think this is how you should be using it. An Order Line Item should be linked to a Product Order and the PO shouldn't be shared across multiple OLIs.
But once again, you can use the below script:
(function refineQuery(current, parent) {
current.addEncodedQuery('order=' + parent.order_line_item.order);
})(current, parent);
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 06:28 PM
Hey @Su522,
Is there a need to create a related list here? The reference record to the Order Line Item is already there, so you can use that to show dot-walked fields on the form instead of creating a related list.
If you do need to create a new related list, you can use the script below:
(function refineQuery(current, parent) {
current.addEncodedQuery('sys_id=' + parent.order_line_item);
})(current, parent);
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 07:02 PM
Yes, we need the Related List because there are several 'Order Line Items' associated with a 'Product Order'
That field on the 'Product Order' form only displays 1 of the 'Order Line Items' and we will probably be removing it from the form, (since it is misleading- as there are several 'Order Line Items' that are assoicated with a 'Product Order'.
Your code worked, however it only displays 1 'Order Line Item' (the one in that field) in the Related List.
So I dont think we can use "parent" for this purpose? We need to get all associcatd 'Order Line Items' to show in the Related List on the 'Product Order form.
See screenshots (with descriptions in the title)
I really appreciate your help!!!
Thakn you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 07:22 PM
No worries @Su522,
I see, so you want to show all the Order Line Items under the same Order. I don't have much experience with Order Management but I don't think this is how you should be using it. An Order Line Item should be linked to a Product Order and the PO shouldn't be shared across multiple OLIs.
But once again, you can use the below script:
(function refineQuery(current, parent) {
current.addEncodedQuery('order=' + parent.order_line_item.order);
})(current, parent);
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 07:35 PM