UserFeed Model has no data when photo url included

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
When creating a model on the UserFeed, and including either of the the Photo Url fields, the model returns no rows. If you remove the Photo Url field then everything seems to work fine. Example page:

<skuidpage unsavedchangeswarning="yes" showsidebar="false" showheader="false">
   <models>
      <model id="UserFeed" limit="20" query="true" createrowifnonefound="false" sobject="UserFeed" doclone="" type="">
         <fields>
            <field id="CreatedBy.Name"/>
            <field id="Body"/>
            <field id="CreatedBy.SmallPhotoUrl"/>
         </fields>
         <conditions>
            <condition type="userinfo" value="" field="ParentId" operator="=" enclosevalueinquotes="true" userinfotype="userid"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="UserFeed" buttonposition="" mode="read">
         <fields>
            <field id="CreatedBy.Name" valuehalign="" type=""/>
            <field id="Body" valuehalign="" type=""/>
         </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/>
      <javascript/>
      <css/>
   </resources>
</skuidpage>
 
Photo of Ant Belsham

Ant Belsham

  • 1,022 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Have you investigated the soql or debug properties of the model in the browser console?  Is there an error statement there? 
(Edited)
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
I tried it and got this error in the Model's debug:

Error: No such column 'SmallPhotoUrl' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names."

What this means, in a nutshell, is that you can't query CreatedBy.SmallPhotoUrl --- apparently Salesforce expects that the CreatedBy field on User is polymorphic, that is, that it can point to not just User, but the Group object as well, which means that you can only query on a few fields common to all objects, such as Name.

So if you want the SmallPhotoUrl for the user who created a post, you will beed to have a separate Model called "CreatedByUser" or something like that, which requests the SmallPhotoUrl field, and with a Condition where Id = Field from another Model:UserFeed --> CreatedById
Photo of Ant Belsham

Ant Belsham

  • 1,022 Points 1k badge 2x thumb
Thanks Zach. I had looked in the console (where there is no apparent error), but had not looked inside the model debug (e.g. skuid.model.getModel("UserFeed").debug). We will work on a way to get around it as suggested.

I find the fact that rather than throwing an obvious error when we added these fields to the page, then the skuid page appeared to "stop working", mildly concerning. It might be worth adding to the roadmap for skuid to do something more obvious if errors like this occur? (e.g. as a minimum, display something in the console might be helpful?).
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
I agree, I'm surprised that there was no red Page Problem displayed when this happened. I'll have to investigate.