Determine where the included page came from

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have a page include that is called from 3 pages.  When the included page is executed on of 3 models wins.  

Each models has UI field to determine if this model was used.

or

or


I am trying to create a template that is conditioned on the 3 fields in the parent model

Something like this where Engage_CR is parent model

{{#{{$Model.Engage_CR.From_Object}}}}{{CR_Member_DNA__r.Member_DNA__r.View_Member_Stacked__c}}
{{/{{$Model.Engage_CR.From_Object}}}}

 
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

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

I would add a URL parameter and send this into the page include.  Something like 'pagefrom=page1'.  Just make the 'page1' different for each page where you open the page include.  You can then use this parameter in your page include to handle conditional rendering.

Thanks,

Bill
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb
Do I reference the Page1 in the included as {{Page1}} ?  Is this where I reference it:  {{#{{$Model.Engage_CR.From_Object}}}} and what would it look like?
Photo of Bill McCullough

Bill McCullough, Champion

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

When you open the page include, send this string 'into' the include.

id={{Id}}&pagefrom=Page1


When you want to reference the page parameter, use the following:

{{$Param.pagefrom}}

Thanks,

Bill
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb
I thought I had it right?  
This is the query string:
Member_Id_CR_Open={{{$Model.Member.data.0.Id}}}&ViewCR=Member

I then use the parm in 2 places.

The first is a template field which i put {{$Param.ViewCR}} in the field

The query shows no data


I also set up a UI-Only field

That also is blank

Cant figure it out??
(Edited)
Photo of Bill McCullough

Bill McCullough, Champion

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

It looks like I took you down the wrong path.  See the comments here about page includes not being able to show page parameters.  This approach won't work for your case.

https://community.skuidify.com/skuid/topics/-param-not-making-it-into-a-pop-up-with-a-page-include

Maybe you can modify your ModelUI field to check the length of the model. 
I think you were saying that only 1 of the 3 models will have any data so it's length will be >0.

IF({{$Model.Account.data.length}}>0,"Offer","")

Thanks,

Bill
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Another option would be to set up a ui-only text field in your include page with a url param condition on it to store the pagefrom param. Then you can reference that field instead of referencing the param.
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb
Hello Matt,

I thought this would work but must have something wrong.  I passed the following:
Member_Id_CR_Open={{{$Model.Member.data.0.Id}}}&ViewCR=Member

Like this:


Or like this?

My formula must be wrong.  Any suggestions?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Matt and Bill McCullough:  Thanks for working with Bill Fox on this problem.   The fact that URL parameters sent to page includes are not included in the Javscript API for use inside the page include is going to make your ideas problematic. 

Bill Fox:  I think we should go back to the beginning and review your merge syntax.  Your problem is there. 

A few pointers.  
1. The conditional block takes both the conditional symbol (#) and the global merge syntaxt ($).  They need to both be inside a single set of curly braces.

2. Your global merge syntax does not have the full syntax.  It needs "data.0" to be included between the model name and the field name. 

3.  Four braces is going to mess things up good. 

So things should look like this: 

{{#$Model.Engage_CR.data.0.From_Object}}{{CR_Member_DNA__r.Member_DNA__r.View_Member_Stacked__c}}
{{/$Model.Engage_CR.data.0.From_Object}}

Note:  I'm not confident in the merge syntax for the field value you are trying to display.  But I have not changed it. 
Photo of Matt Sones

Matt Sones, Champion

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

If I create a ui-only text field on an included page, and create a url/param condition on it's model to point that field to the param passed in the query string, shouldn't the ui-only field get that value?
Photo of Bill Fox

Bill Fox

  • 7,904 Points 5k badge 2x thumb
Rob,
That worked.  Thanks.
Bill
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You are welcome Bill.  Thanks for your patience.