Page include inside a page Include & query string issue

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
Until today I thought I understood how it works , but now after trying for 2h, I have an issue I cannot seem to fix

I'm passing parent record ID( id={{{Account__c}}} )to a Page include we will call "Master PI"
This Page include , has multiple other Page Include inside it. Let's Call them "Child PI"

It seems my query string is being passed properly to the Master PI page
but Child PI (with query string" id={{$Param.id}} ) are not grabbing the Parameter Id from the Master PI

Looking a console i see this:


Any idea what I'm doing wrong?


Thx
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Maybe try to use id= {{Id}} for the query to pass to the children. This assumes that the receiving condition is on the Id field of the model. The parent include is setting the Id field to Account__c. So if you pass the id field to the children you should get the result you are looking for. If you are setting a different field in the parent include page model to Account__c, then use that field in the query instead of Id.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Dave,

{{$Param.id}} exposes the skuid.page.params API, which will look at the parameters of the actual URL that you see on your screen, in this case the url of your primary page. It will not see the parameters that you passed to your page include.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Thx Matt,

But I need a clarification,as this is not what i'm experiencing

In the Master PI , my model has condition: Id =  page parameters and it works no problem. I see info for proper Account
Only having issues with the Child Page Include, which has same condition as model mentioned above....
If I use those same Page Includes giving me issues, directly from main popup (not as a page include, in a page include) they render properly as well.

So the Id is being passed as a Parameter it seems to the Master PI , just seems the child PI cannot pick it up for a reason.

Let me know
(Edited)
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Probably have to use &id={{$Model.YourModel.Id}} instead of just Id
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Thank you Raymond and Matt,

I tried that as well earlier with the same result. Both are not working

I tried:

id={{Id}}

id={{$Model.accountQFR.Data.0.Id}}     (accountQFR is the Account model on Master PI)

Even tried syntax u proposed above: &id={{$Model.accountQFR.Id}}

From what I see on Console None of my Child PI are getting an Id passed to them.





Starting to lose the little hair I have left on my head lol
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Dave,

Could you have a conflict between the 2 parameters you are using?  Just like your model names need to be different, I have seen problems where naming a condition the same as another condition on another model has caused problems.  I think both of your models are expecting a parameter called 'id'. Try changing the child page model parameter from 'id' to 'childid'.

Thanks,

Bill
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
The syntax I sent was incorrect (both times), as you discovered. I think the syntax you tried is right, but I think the "d" in data should be lower case. As Bill points out, I would also try making your parameter name different between the Master PI and Child PI. Maybe use &cid={{$Model.accountQFR.data.0.Id}} and change the model condition on your child PI to match the cid parameter name. I posted this last night, but I don't see it on here.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Here is another wrinkle.  URL parameters passed into page includes can be used for server side processing (for conditions on models in the PI)  but they are not available for client side use.  This means they cannot be used in merge syntax,  or passed down into subsequent included pages.  This is because the query string passed to the include does not really become part of the url parameter of the page.  API method   "skuid.page.params"   will never show these page include parameters.  This is the basis for all the client side use of parameters (Merge text,  conditional rendering, etc)

What we do is build a model in the first PI that returns the data we want to pass into the second model, or use to drive client side processing.  You could use this model data in PI#1 as a query string to be passed into the PI#2. 

Confusing,  I know.  But that's they way it is right now.... 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Dave,

To further what Rob said...

The only way to access the url parameters that are passed to a page include is through url param conditions (which is why the param condition on your Master PI is working,  but the merge syntax on Child PI is not working).
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Thx to all of you!

With your help I was finally able to resolve this issue. :)