Get parent data within a Page collection

Wybren1
Tera Guru

Hi,

 

I need help with getting the "parent" data/values (aka Form data controller) from within a page collection.

So this is for a shared "tab" between experiences that needs to get the data from the parent it's coming from.

 

Already tried: data.gform.nowRecordformBlob.table / sys_id, but this only seems to work within viewports and not within page collections.
Also tried adding URL parameters (after) I created it in the sys_ux_app_route, which crashed the page funny enough.

 

Does anybody have an idea on this?
@Brad Tilton You mentioned already you knew a solution for this 🙂

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Wybren1
Tera Guru

Alright managed to find it, not sure why it didn't work before.

Let me also make a short tutorial for it for other people!

 

Step 1
Make sure you are using the latest "record" default template.
You can tell by going to the Data Sources and check the form controller:
Old ID is called "gform", new ID is called "record" 
Old:

Wybren1_1-1690311765588.png

New:

Wybren1_2-1690311808189.png

If you still have the old one, add a new page variant and select it from template (select the latest one).
*I know both standard record and CSM default record has the new controller

Wybren1_3-1690311959397.png

Step 2
Create your page collection
Goto your newly created record page, select the "Tab sidebar"
+ Add a new tab

Wybren1_4-1690312110217.png

Select "Add a page collection", and click "Next"
And click "Create collection"

Wybren1_5-1690312185298.png

This will send you to the backend specifically "sys_ux_extension_point" table.
Click "New"
Name: Up to you
Component: Tabs
App shell: UXR Base Experience Shell (Default)
Controller: Form

Wybren1_6-1690312334272.png

Go ahead and just click "Submit"
*Just leave the page open we will change the icon in a later state.


Step 3
Go back to the UI Builder, "Refresh list"
And go ahead select your create Page collection and press "Continue"

Wybren1_7-1690312470533.png


Step 4
Let's add a tab page to actually show up within the tab.
Click on your "Page collection", and select the button "Edit Content"

Wybren1_8-1690312605443.png

This will now open a new UI Builder Tab.
Within the "Page collection" add a new page. "Create new Page"
The name is also used for the "Tab" name itself.

 

Step 5

Access the form controller data
Within the Data resources you will now see the "Inherited data resource instances" > Form

Wybren1_9-1690312907940.png

It's called "controller", for my example I've simply just used a "stylized text" to show the parent sys_id.
Simply just call them by @Data.controller.sysId and @Data.controller.table

On the page collection the "Test values" are the parent values given as an example in the controller.

Wybren1_10-1690313129442.png

Click "Save"

Step 6

Add an icon to the tab!
First go back to the tab you left open, or open the sys_ux_extension_point table.
Click your page collection open, now in the bottom you have a related list called "UX App Routes"
There is a column called "Icon", fill in the icon you want for your tab.
These can easily be found by using the "icon" component, and simply doing everything lowercase with "-"

Wybren1_13-1690313880455.png

In my case it going to be "ai-sparkle-fill"

 

AND voilà

Wybren1_14-1690314093548.png

 

Bonus step
Setting up Context props

Usually what I'd like to do is actually setting this up with the @context.props
Goto the Body on your content tree, and select "config" on the configuration pane
Click "Edit"

Wybren1_11-1690313295176.png

Click "+ Add" next to properties
Fill in Property name: parentTable (or whatever you like to name it)
Click "Add"
Click once more on "+ Add"
Property name: parentSysId
Click "Add"
Then "Save"
Now within the properties fill in the @Data.controller, for me it didn't auto fill. But you can simply add them.

Wybren1_12-1690313581589.png

After this you can now simply call them with @context.props.parentSysId and @context.props.parentTable

 

Hope this helps anybody that came across this!

View solution in original post

10 REPLIES 10

@Johnny32 

I was just meaning that the "Controller" on the Parent Page and the "UX Extension Point" - need to match.

 

In Utah the SRP generated has a "Form Controller" (as per attached) - which would match Wybren1s guide - BUT an SRP generated in an earlier version (like the example app) seems to have a "UI Controller Record Page" and I wouldn't expect them to work.   

 

Is was just flagging the issue if you have a "hybrid" setup.

 

I would expect - if you used "Create Collection" (as per Wybren1's Step 2, second picture) then UI Build should create a collection of the right type from your Parent page - but may be worth checking.