Model displaying random row when there should be none

  • 1
  • Problem
  • Updated 2 years ago
  • In Progress
Hey Team,

I'm currently completely baffled about the following issue I'm currently having with some models. At a high level, what I'm aiming to do is Account Matching on a Lead detail page, if the Lead happens to be using our product. Here are the 3 SFDC objects/Skuid Models I'm working with and their relevant fields:
  • Lead (Id field)
  • Product_User__c (ProductUser is the Model name) (Lookups to Lead (Lead__c), Subscription__c, and Subscription__r.Account__c)
  • Account (ProductUserAccounts is the Model name)
I am displaying one Lead Id per page (Condition: Id = param(Id)), up to 20 Product User rows, and only one ProductUserAccount. A Product_User__c record does not have to lookup to the Lead, but it does have to look up to a Subscription. However, for a ProductUser row to show in Skuid, it does have to be associated to the Lead we are viewing (Condition: Lead__c = (Lead)(Id)).

The Subscription (Subscription__c) that the ProductUser looks up to does not have to necessarily look up to an Account. However, it does have to look up to an Account for the ProductUserAccounts to display (this is where the confusion for me comes in).

So my Condition for the ProductUserAccounts is:
Id in (ProductUser)(Subscription__r.Account__c.Id). I am also limiting this model to just one row, prioritizing it based on how much the Account is paying.

Whenever there are ProductUser rows that look up to an Account, everything works properly. Example: 

If there are no ProductUser rows, by default it means there should be no ProductUserAccounts (since it's basing the Id off of the Subscription__r.Account__c.Id lookup relationship on the Product_User__c object). However, whenever this is the case, I'm getting a random Account to display (which has no Subscriptions, Product Users, etc. and is in no way related to the current Lead). Skuid displays the same exact account every single time.

Example: 

Any ideas? Is there something I'm doing wrong when trying to reference a field from another model in my ProductUserAccounts model condition? Why is it pulling this random ID?

Thanks!!
Photo of Dylan Rodgers

Dylan Rodgers

  • 748 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,240 Points 5k badge 2x thumb
Dylan~

If I understand right, you only need to return something from the ProductUserAccount if it isn't null. What happens if you add a condition on the ProductUserAccounts model where it is not a blank value? 

Thanks!
Karen
Photo of Dylan Rodgers

Dylan Rodgers

  • 748 Points 500 badge 2x thumb
When you say "if it isn't null", what is the it you are referring to?

If you mean the Subscription__r.Account__c field on the ProductUser model for ALL rows, then yes. No rows should be returned for ProductUserAccount.