Model not loading all required data

Hi, we’ve witnessed a recurring issue with one of our Skuid pages not loading our Salesforce data completely. The issue seems to stem from accessing related fields on a Salesforce object e.g. accessing account information through a transaction custom object.

Case Scenario:
A user wants to create a supplier transaction for a segment (Flight, Bus, Train etc.). Once they create a segment they can go in the system and create a supplier transaction. The supplier(segment) transaction’s initial model’s rows are created on page load using an inline snippet. The values for these rows are mapped from the segments which need to be paid for.

Problem: Once the segment transaction model’s new rows are created, we are trying to access the Creditor__r.Paid_on_Statement__c field in a different snippet. However, some users are not being able to access that value.

Below is the inline snippet creating the rows for our segment transaction model. Here we are setting the Creditor(Account) of the segment transaction as the Creditor(Account) linked with the segment itself.

// Retrieve Segment model
var paymentSegmentsModel = skuid.model.getModel(‘PaymentSegments’);
var segments =;

// Retrieve Segment Transaction model
var paymentSegmentTransactionsModel = skuid.model.getModel(‘PaymentSegmentTransactions’);

// Map necessary Segment values to its Segment Transaction and create initial rows
$.each(segments, function(i, segment) {
var matchedCreditor = $.inArray(segment.Creditor__c, creditorIds);
// The reason not set as model condition is to get full list of creditors
// Not Credit Card Fee
var isNotCCFee = segment.RecordType.Name !== ‘Credit Card Fee’;
var isNotFlight = segment.RecordType.Name !== ‘Flight’;
var hasOutstandingAmount = segment.Amount_Outstanding_to_Supplier__c !== 0;
if (matchedCreditor > -1 && isNotCCFee === true && isNotFlight === true && hasOutstandingAmount === true) {
var additionalCondition = {
additionalConditions: [
{field: ‘Segment__c’, value: segment.Id},
{field: ‘Segment__r’, value: segment},
{field: ‘Creditor__c’, value: segment.Creditor__c},
{field: ‘Date__c’, value: paymentModelRow.Transaction_Date__c},
{field: ‘Transaction_Type__c’, value: paymentModelRow.Transaction_Type__c},
{field: ‘Transaction_Description__c’ , value: paymentModelRow.Payee_Text__c},
{field: ‘TicketNumberUI’, value: segment.Ticket_No__c},
doAppend: true
var row = paymentSegmentTransactionsModel.createRow(additionalCondition);

The above code is mapping correctly however when we try to access the Paid_on_Statement__c field using Creditor__r.Paid_on_Statement__c (see below), it’s not being retrieved/accessed.

Snippet where the Creditor__r.Paid_on_Statement__c is being used:

//Model generates actual segment transactions using the initial mappings created above
var segmentTransactionsModel = skuid.model.getModel(‘PaymentSegmentTransactions’);
var segmentTransactions =;
var segmentTransactionObjectList = ;
var additionalSegmentTransactionObjectList = ;
var hasPaidOnStatementCreditor = ‘NO’;
for(var i=0; i<segmentTransactions.length; i++) {
var segmentTx = segmentTransactions[i];
var segmentTxObject = {
Id: segmentTx.Id,
Credit_Amount__c: segmentTx.Credit_Amount__c,
Creditor__c: segmentTx.Creditor__c,
Date__c: payment.Transaction_Date__c,
Reference__c: payment.Reference_Number__c,
Parent_Transaction__c: segmentTx.Parent_Transaction__c,
RecordTypeId: segmentTx.RecordTypeId,
Segment__c: segmentTx.Segment__c,
Transaction_Description__c: segmentTx.Transaction_Description__c,
Transaction_Type__c: segmentTx.Transaction_Type__c,
Agency_CC_Label__c: payment.Agency_CC_Label__c,
Agency_CC_Is_Batched__c: payment.Agency_CC_Is_Batched__c,
Enett_Payment_Options__c: payment.Enett_Payment_Options__c
if (segmentTx.Creditor__r.Paid_on_Statement__c,) {
hasPaidOnStatementCreditor = ‘YES’;
} else {

The problem is the if condition which is evaluating to false because there is no Paid_on_Statement being set on the model.

Notes -

  1. Paid on Statement is added as a field on both PaymentSegments and PaymentSegmentTransactions model.

  2. The permissions are set correctly for the users being affected.

  3. A similar issue had occured on our old version 11 Skuid where another field ‘Company Token’ (Creditor__r.Company_Token__c) wasn’t being retrieved from the same model.

  4. We are now running on Skuid ver 16.1.7

Hey @zainabzaman , welcome to the community!

It sounds like sometimes the snippets are working as expected (you can access the Creditor__r.Paid_on_Statement__c field), and sometimes they’re not (you can’t access that field), right?

Here are some things it might be helpful to think about:

  1. Is the data in the model coming from Salesforce? Is there a reason you’re using JS to load the model instead of a normal model query?
  2. Is there a reason you can’t retrieve the Paid on Statement field in the first snippet?
  3. Have you tried testing a similar query in Visualforce (outside of Skuid) and seen if you get the same issue?

It’s difficult to tell exactly what’s going on here with the limited example, but from what I can tell it looks like you’re creating new rows in the PaymentSegmentTransactions model based on data in the PaymentSegments model, and setting the Creditor__c field in PaymentSegmentTransactions based on the Creditor field in PaymentSegments. From that, you’re looking to pick up Creditor__r. related fields.

I’m not exactly sure how SKUID goes about relating object references here between references to other objects dynamically being assigned. I’ve also noticed inconsistencies.

I think that there is some mechanism in SKUID that somehow stores object data that has already been queried on the page based on object id, and when you make references to that object’s fields (__r.FieldName__c), it can pick up on the object’s data that has been loaded on the page. However, I’ve noticed that this operates inconsistently. Here since you don’t actually query directly on the Creditor object, rather it is an object referenced by a lookup field on other objects that you do query, field references to loaded data on the page may not work properly or consistently for that reason.

If possible, I’d recommend trying to load the Creditor objects directly somewhere on the page rather than relying on __r references (a Creditor specific model, and the fields for the Creditor you are looking to access being queried there). That may cause the page to then understand that the Creditor with an Id of X has accessible fields related to it that you can find via references on other objects. This has worked for me in the past; my general use case is assigning a lookup and then not seeing the Name or other fields on that lookup so in the UI it just looks like a Salesforce Id, but once you query on that lookup object specifically, even in a different model, SKUID seems to then understand the related fields, provided they were queried directly in the other model.

Alternatively, if possible you can do a save/load on your PaymentSegmentTransactions model, which should then load the appropriate data correctly from the database rather than relying on object references from other models to populate the data on the page.

Let me know either of these work for you, or if you discover a more elegant solution.