- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2023 07:51 AM - edited ‎01-20-2023 07:53 AM
we have to create a related list on service offering records, under this related list we have to show related "Plans" via plan asset records.
here we have a common field "item" in service offering and plan asset tables. plan asset record has 'plan' field. based on this we will find the related plan records to the current service offering records.
we have created related list like Applies to table : service_offering
and Queries from table : plan_asset
current.addQuery('item',parent.sys_id); // querying to get the associated plan assets based on item field in current parent record.
but how we have to get plan records from related plan asset records. we have plan field in plan asset records
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2023 04:10 AM
That is exactly what my last response is doing. The screens shows exactly that: a service offering shows the related plans (connected through assets).
Have you tried what I proposed?
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2023 08:35 AM
So what you are creating is called a "Relationship" element.
As far as I understand you have the "connection" between service_offering and plan_asset done through the item field.
I don't have the plan_asset table in my developer instance but I am installing the "Business Continuity" plugin where I think that table is.
Anyway, you should be creating the "relationship" element on the "plan asset record" table (not the plan_asset) since that is what you want to show on the service_offering record as a related list. Then the script should do the complicated daisy chain to connect the "plan asset record" to the service_offering.
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2023 09:24 AM
I think I got it.
Create this relationship
Then go to the Service Offerings form and add the "Related Plans" related list.
I added my "Test SO" service offering to two plans (as plan asset) and it displays like this. Modify the columns on the "Related plans" related list (in reality is a relationship) to remove what it doesn't add value.
If I helped you with your case, please click the Thumb Icon and mark as Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2023 03:15 AM
Thanks for the response @Sebas Di Loreto
this relationship queries from "plan" table, and applies to service_offering table
we have to display the plan records, as ia said before "item" field is the common for service offering and plan asset tables. plan asst records contains plan field which is reference to plan records.
so we have to get displayed the plan records on the service offering table with the help of plan asset.
here is the sample script we tried but no luck
var pln = new GlideRecord('sn_bcp_plan_asset');
pln.addQuery('item',parent.sys_id);
pln.query();
while(pln.next()){
current.addQuery('plan',pln.plan);
current.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2023 04:10 AM
That is exactly what my last response is doing. The screens shows exactly that: a service offering shows the related plans (connected through assets).
Have you tried what I proposed?
If I helped you with your case, please click the Thumb Icon and mark as Correct.