Passing URL Parameters to a Page Include

Hey guys, no luck here. 

My WhoId is working fine so I left that be and tried lower-casing the WhatId like so: 

?id={{$Model.ContactData.data.0.Id}}&whatid={{$Model.Contact.data.0.accountid}}

It passed nothing and gave an error message again.

I also reverted to the $Param method and tried all lower case and got nothing in both cases. 

The challenge here is I am sure that the parameters being passed are correct for the included page (id and whatid, both lowercase). 

Now I need to correctly refer to the variables on the source model that I want to pass. Those variables appear in uppercase to me and when I lower case them they don’t pass anything. 

AccountId does pass successfully when uppercased but then it only renders as the ID (not name) and gives the error messages. 

Do I need to be looking at URL params on the source page too? I would think those are separate but I am a bit lost now. 

Thanks for continued help. 

Thought I’d take a stab at this one…are you sure the “Account.Name” field is also being pulled into the model which contains AccountId? Usually with reference fields I find the model needs to contain both the Id and and Name field to pass the actual name of the Account. I’d double check this field is in both the source & destination pages.


One way to ensure that the Name value will pass in is to add a URL Parameter Condition on the “What.Name” field as well as on the “WhatId” field, and then pass in a value for What.Name via a “whatname” parameter, like this:

?id={{$Model.ContactData.data.0.Id}}&whatid={{$Model.Contact.data.0.AccountId}}&whatname={{$Model.Contact.data.0.Account.Name}}

Hey Zach, 

Thanks for that - I have good news and bad news :) 

The good news is I used your querystring (I just changed “Contact” for the second two parameters to match my model name)

?id={{$Model.ContactData.data.0.Id}}&whatid={{$Model.ContactData.data.0.AccountId}}&whatname={{$Model.ContactData.data.0.Account.Name}}

And the page include now worked like a charm! WhoId and WhatId were rendered with names perfectly. 

However…(the bad news), it only works the first time. By this I mean, if I go to the page, click on the button to log a call, close the pop up window, then click on it again, the WhatId field is now blank

??

Even more weird, I added another pop up with a page include for my New Task page using a very similar querystring, and it will only work once between the two pop ups. So if I click New Task first, it will populate there  but then not again and not for Log a Call. Same thing in reverse if I click Log a Call first. 

I am very confused by this page’s behaviour and more generally by how Skuid is using parameters and conditions to populate these fields. I’m sure there is an underlying order to things that I am not seeing, but right now it feels very sporadic. 

Please help me understand what is happening here :) 

Use Javascript to update the page include. I had a similar issue and it worked for me like a charm. Put it in a snippet that is loaded after the popup using the multiple actions framework. 

Make sure your Page Include component has a Unique Id set, so that we can reference it via JavaScript:

var contactRow = skuid.model.getModel('Contact').getFirstRow(); var contactDataRow = skuid.model.getModel('ContactData').getFirstRow();<br>var pageInclude = skuid.$('#MyPageInclude').data('object');<br>pageInclude.pagename = 'TaskLogCall';<br>pageInclude.querystring = '?id=' + contactDataRow.Id + '&amp;whatid=' + contactRow.AccountId + '&amp;whatname=' + contactRow.Account.Name;<br>pageInclude.load(function(){<br>&nbsp; &nbsp;console.log('done loading');<br>});


Javascript API taken from https://community.skuid.com/t/change-the-page-included-in-javascript

K. Something has gone wonky. Should be straight forward. This is driving me nuts. Let me know if you want to do a screenshare meeting on Skype. pat.vachon.77

@Menachem, thank you very much for the code snippet. I tried it out and it doesn’t seem to be changing anything unfortunately. 

When you say “Make sure your Page Include component has a Unique ID set” what does that mean exactly? 

Also note my page doesn’t include any model called “Contact,” I wasn’t sure if that would make a difference here. For fun I did try the code and change it all to “ContactDataRow” and nothing changed. I am stumped. 

@Pat, I’d gladly take you up on it. Very nice of you. I’ll add you on Skype and message me if you happen to be around. 

You were correct, you should only use contactDataRow (and you can remove the first line ‘var contactRow…’). The reason why it didnt work is because the page include Id property needs to be set to ‘MyPageInclude’ (no quotes). (You can set the Id to whatever you want provided that the code is updated with it.)

@Menachem, I tried again and added the ID property to the page include. Unfortunately same results!

This is the code I’m using by the way: 

var params = arguments[0], $ = skuid.$;<br>var contactDataRow = skuid.model.getModel('ContactData').getFirstRow();<br>var pageInclude = skuid.$('#MyPageInclude').data('object');<br>pageInclude.pagename = 'TaskLogCall';<br>pageInclude.querystring = '?id=' + contactDataRow.Id + '&amp;whatid=' + contactDataRow.AccountId + '&amp;whatname=' + contactDataRow.Account.Name;<br>pageInclude.load(function(){<br>&nbsp; &nbsp;console.log('done loading');<br>});

@Pat, I also tried adding a “field from another model” condition to pull the Account ID (and also tried pulling Account Name) from the Account model instead of taking directly from the URL parameter into the Task model. 

In all cases I’m getting the same results – perfect rendering the first time, bubkas the second time. 

I am open to all further suggestions. Thanks to you both very much again. 

Yeah. Use this method on the TaskLog model.
https://community.skuid.com/t/new-way-for-the-new-record-page

You’re saying that you click on the log a call button once, save the record and close the popup. You do this again and the second time the account data isn’t showing up?

Exactly!

K. Can’t be the page include page. Something is affecting a model on your main page from the page include. Are any of the models in the page include named the same as the main page? Are any of the parameters in the query string named the same as the URL parameters on your main page.

The only model that overlaps is the ContactData model, which also exist on the TaskLogCall page. 

The parameter “id” passing into the TaskLogCall page also exists as “id” on the ContactDetail page. 

So yes – however, this field is working beautifully whereas it is the Account field that is messed up. 

For sure you will get problems if a model name is the same between include and main page. My guess is that this is what is happening. 

1. On initial page load ContactData model from “TaskLogCall” page is loaded and it includes the fields you expect to pass as parameters. 
2. When the include page is loaded the ContactData model is overwritten.  Though the parameter values are still in place and the include works. 
3. When you try to load include #2 the fields you expect to pass as parameters are no longer in the models (because they have been overwritten).  Hence the wierdness. 

Hope that helps. 

Pat your comment was on the right track and Rob, you nailed it. (Thank you for responding especially Rob as I know you’re on vacation right now.) 

I changed the model name on the ContactDetail page, updated the model references in the querystring, and we are off to the races. It works every time. Whoo hoo!

Thank you Zach, Irvin, Menachem and everyone else who tried to help me as well. What a relief to have this sorted! 

The universe makes sense again. 

Happy holidays all. 

Seeing the community come together to help you out is a huge Christmas Present to all of us at Skuid.  Glad your universe is coherent again!  Enjoy the holidays…

I am new to Skuid and have a very simple question about passing a record ID used on a Parent Page to a Page Include.  I cannot find documentation to achieve this and would appreciate if someone could point me in the right direction.

Thanks in advance.

Two options. After placing your Page Include onto your page.

  1. URL parameter via merge syntax. id={{$Param.Id}}
  2. Id value from Model via merge syntax. id={{$Model.Account.data.0.Id}}

Pat, thanks for your quick response.  Do I need a Condition on Page Include to filter the record ID?