Skuid not pulling correct data in a Lightning Component, but is correct in preview


Please help, I created a Skuid page and finally got it to work just as I wanted. But when I added it as component on my record page it is not pulling the correct data. I am looking up Contacts on Account, that are tied to a junction object called AccountRoles.

I have 4 models: Account, AccountRole, CustomObject, SelectedAccountRole and Contact. On Load, the page retrieves the Account ID and all related AccountRoles

The scenerio is this. 

  1. I have a Related Contact UI  picklist of all of the contacts related to the Account. This field is looking at all AccountRole ids that are tied to the Account.

  2. Once the user selects a Related Contact the AccountRole ID is saved to a Salesforce Field called AccountRoleID.  

  3. A model condition of the SelectedAccountRole retrieves the matching AccountRole

  4. A model condition on the Contact retrieves the matching Contact.

    Everything is working as expected when I run it in Skuid preview. But it is not working on the Salesforce page. On the Salesforce page, after the user selects the Related Contact, the selected AccountRole is blank, and because of this it is pulling the first contact record in Salesforce that is totally unrelated to this Account.

Here is how it is appearing in Skuid - which is what I want.

On the Salesforce page SelectedEntiyRole is blank, and the Contact is a random record.

Thanks in advance for your help.

I opened a case and got a response. This is the essence of the response:

"After taking a look at the “Related_Contacts UI” field I saw that the “Relationship Entity: Key Field” was set to “Contact_c” which I believe to be the source of the issue. ​

Related Entity: Key Field: is the field on the reference object that will serve as a “bridge” between the reference data source and the primary data source. (Used as a “key” to link the data.) and since we ​want to be looking at the ID of “Entity_Role_c” I changed the value from “Contact_c” to “Id”. "