Page Include not respecting Conditions

  • 1
  • Question
  • Updated 3 years ago
Been looking around but could not find a reason for my issue.

My page include is not showing me the records related to the specific account I'm on, but showing all records instead.

I have my main Skuid page (let's call it account) and I have another Skuid page (let's call it activities)

Activities has multiple tabs and a couple models (different models name than the account page)
1 of the model we will use for this example is  based on Tasks

I want to use page include to add the Activities page to one of the tabs on Account page

On the Activity page the model condition is AccountId=(param) Id


Created the Page include on account page, as follow

I tried ?id={{$Param.Id}}, without question mark and uncheck lazy load (saw that on another post) but still did not work

I say on another post to check the developer console, network tab.
And it seems to me , that the id is not being passed



I would appreciate any help i can get.

Thx


Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Greg Jarrett

Greg Jarrett

  • 3,496 Points 3k badge 2x thumb
Shot in the dark here - I can't see your actual url but I think url params are case sensitive, so maybe try the page include query string with a lowercase 'i' so....?id={{$Param.id}}
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Ty Greg,

I had tried that, and did not work as well :(
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Hi Dave, it looks like that on the account page the Account id = the param ID  (all caps). So try changing your query string to id={{$Param.ID}}

If that fails, you could try id={{$Model.Account.Data.0.Id}} but make sure the Id field is included in your Account model first.
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
or maybe you should change that condition on your account model so that Account Id = param Id (capital I lowercase d)
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Thank you Anna,

I tried first changing to Id (my bad) , but did not change anything, still all records displaying

Then I tried the id={{$Model.Account.Data.0.Id}} and made sure the field is included in model

But now I get errors:

1. An error occurred while attempting to perform the following SOQL query: SELECT Id FROM Account WHERE (Id = ' ') LIMIT 21 Error:invalid ID field:
2. An error occurred while attempting to perform the following SOQL query: SELECT Subject,CreatedBy.Name,Call_Number__c,CallDisposition,CallDurationInSeconds,CallType,ActivityDate,Id FROM Task WHERE (AccountId = ' ') ORDER BY SystemModstamp DESC LIMIT 21 Error:invalid ID field:

That made me think , maybe the issue is the condition on Models in the page I want to include(activities)?

The error #2 refers to a model on the Activities page name: calls

and here's it's model condition



Is it the correct setting?


Thank you 
Photo of Greg Jarrett

Greg Jarrett

  • 3,496 Points 3k badge 2x thumb
Hi Dave,

I've got this working using the following query string for the page include: "id={{$Param.id}}" (without the question mark character at the beginning of the query string which you have in the first post. That may or may not be the issue or you may have already tested that.) 



I'll paste the xml for each of the pages here - you can paste this into new pages in your org, and then if it works, continue building out the rest of your page(s) based on that. It did take a few seconds to load the data in the page include, but it was all there eventually and all  related to the Account specified in the url.

Also - you may need to reset the 'Skuid Page' field once created in your org - this field may (I'm not sure) reference the specific page record id which will be different in your org than mine:





Tasks list page for inclusion in Account detail page:

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Tasks" limit="20" query="true" createrowifnonefound="false" sobject="Task">
         <fields>
            <field id="ActivityDate"/>
            <field id="LastModifiedDate"/>
            <field id="Status"/>
            <field id="Subject"/>
            <field id="Account.Name"/>
         </fields>
         <conditions>
            <condition type="param" value="Id" field="AccountId" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Tasks" buttonposition="" mode="read">
         <fields>
            <field id="Account.Name"/>
            <field id="ActivityDate"/>
            <field id="LastModifiedDate"/>
            <field id="Status"/>
            <field id="Subject"/>
         </fields>
         <rowactions>
            <action type="edit"/>
            <action type="delete"/>
         </rowactions>
         <massactions usefirstitemasdefault="true">
            <action type="massupdate"/>
            <action type="massdelete"/>
         </massactions>
         <views>
            <view type="standard"/>
         </views>
      </skootable>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>



Account Detail page:


<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
         </fields>
         <conditions>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="delete"/>
            <action type="clone"/>
            <action type="share"/>
            <action type="savecancel" window="self"/>
         </actions>
      </pagetitle>
      <basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="read">
         <columns>
            <column width="50%">
               <sections>
                  <section title="Basics">
                     <fields>
                        <field id="Name"/>
                     </fields>
                  </section>
               </sections>
            </column>
            <column width="50%">
               <sections>
                  <section title="System Info">
                     <fields>
                        <field id="CreatedDate"/>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
      <includepanel type="skuid" pagename="TasksListTest" module="" querystring="id={{$Param.id}}"/>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>




I hope that helps!
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Dave, also can you confirm that the "Account Id" field is included in your Account Model? Because it seems like from the error messages that the Id parameter is getting passed through, but the actual value of the Account Id is not.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
HI Anna,

Yes, the ID field in account model is included


By any chance would my issue have anything to do with the fact I'm using my own Visualforce Page and use the <skuid:page> component for that "account" skuid page? ( i had read another similar post over the weekend, and not sure if I understood correctly)?

Thx
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Hmm, I'm not sure about that, I will check about it.  Also, I would suggest taking the ? out of the parameter string for the page include - Skuid should append the proper connector automatically.
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Dave,

This scenario should work. Case does matter, so pick one form of "Id" and stick with it. I'm going to go with "id" here, so here are a few things I would try/double check:
  1. The condition of your Account model on your Account page should be Id = {{$Param.id}}
  2. The Query String of your Page Include component on your Account page should be id={{$Param.id}}
  3. The Condition on your Calls model on your Activities page should be AccountId = (param) id
  4. Whenever accessing your Account page, use "id=" in the query string
  5. Make sure all model names are unique between the two pages (e.g. You don't have a model named Account on both pages)
I hope that all helps.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
The condition of your Account model on your Account page should be Id = {{$Param.id}} 
Checked:

The Query String of your Page Include component on your Account page should be id={{$Param.id}}
Checked
 
The Condition on your Calls model on your Activities page should be AccountId = (param) id
Checked

 
Whenever accessing your Account page, use "id=" in the query string
Not sure what you mean here

Make sure all model names are unique between the two pages (e.g. You don't have a model named Account on both pages)
Checked

And now i get a different error. It seems the ID is being passed but says Invalid?


2. An error occurred while attempting to perform the following SOQL query: SELECT Id FROM Account WHERE (Id = '0014000001e4s6R ') LIMIT 21 Error:invalid ID field: 0014000001e4s6R

3. An error occurred while attempting to perform the following SOQL query: SELECT Subject,CreatedBy.Name,Call_Number__c,CallDisposition,CallDurationInSeconds,CallType,ActivityDate,Id FROM Task WHERE (AccountId = '0014000001e4s6R ') ORDER BY SystemModstamp DESC LIMIT 21 Error:invalid ID field: 0014000001e4s6R

Thx
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
There is a space in that query, right after the "(Id = '0014000001e4s6R" part. Do you have a space in your URL after your id parameter? Look for something like...

.../apex/AccountPage?id=0014000001e4s6R &otherparam=something...

...or...

.../apex/AccountPage?id=0014000001e4s6R%20&otherparam=something...

...in your browser's address bar.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
My URL is the Standard URL, as mentioned earlier, i'm using my own Visualforce Page and use the <skuid:page> component



I tried to Preview the Skuid page so I can see VF URL , and do not see any space in it, and still get same error

htttps://skuid.na2.visual.force.com/apex/skuid__ui?page=Advance_Loan_snippet_on_Account&id=0014000001e4s6RAAQ (the only difference I can see, is error Had 15 digit ID, and this link has 18 digits)



Thank you for your help, I feel we are getting closer.

If simpler for you, I have Granted Skuid Access to my Org

Page name:Advance_Loan_snippet_on_Account
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Sure thing. It looks like you've got a space at the end of your Query String parameter:



Trying removing that space, and see if that's any better. 
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
That moment , when All I can say is :



Thank you very Much J! I would have prob never caught that error lol
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Sure thing! I'm glad we got it sorted.