Attempt to de-reference a null object

I'm encountering this error when running a snippet that creates several dynamic models.
Here's the console error:

And here's the data for the error:
Here's the console error:
And here's the data for the error:
[HELP!?!
{
"id":"ProgressNoteInteraction",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"Interaction__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Timeless_Date__c"
},
{
"id":"Interaction_Purpose__c"
},
{
"id":"Patient_Case__c"
},
{
"id":"Patient_Case__r.Name"
},
{
"id":"U_S_Performed__c"
},
{
"id":"Gestational_Age_US_Weeks__c"
},
{
"id":"Gestational_Age_US_Days__c"
},
{
"id":"Baby_1_FHR__c"
},
{
"id":"Return_Appointment_Required__c"
},
{
"id":"Return_Appointment_Details__c"
},
{
"id":"Interaction_Intention__c"
},
{
"id":"Closing_Notes__c"
},
{
"id":"Primary_Staff__c"
},
{
"id":"Primary_Staff__r.Name"
},
{
"id":"Additional_Staff__c"
},
{
"id":"Additional_Staff__r.Name"
},
{
"id":"Nurse_s_Notes__c"
},
{
"id":"Nurse_s_Additional_Notes__c"
}
],
"conditions":[
{
"type":"fieldvalue",
"field":"Id",
"operator":"=",
"value":"a0UF000000gdRLsMAM",
"encloseValueInQuotes":true
}
]
},
{
"id":"ProgressNotePatientCase",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"Patient_Case__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Patient__c"
},
{
"id":"Patient__r.Name"
},
{
"id":"LMP__c"
},
{
"id":"Patient_was_Referred_to_Hospital_ED__c"
},
{
"id":"Hospital_Referred_To__c"
},
{
"id":"Date_and_Time_of_Referral__c"
},
{
"id":"Symptoms__c"
},
{
"id":"Pregnancy_Confirmed__c"
},
{
"id":"Estimated_Due_Date_by_U_S__c"
},
{
"id":"Custom_Referrals__c"
}
],
"conditions":[
{
"type":"modelmerge",
"field":"Id",
"operator":"=",
"model":"ProgressNoteInteraction",
"mergeField":"Patient_Case__c",
"noValueBehavior":"noquery",
"encloseValueInQuotes":true
}
]
},
{
"id":"ProgressNotePatient",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"Patient__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Name"
},
{
"id":"Age__c"
},
{
"id":"Ethnicity__c"
},
{
"id":"Sex__c"
},
{
"id":"GPA__c"
}
],
"conditions":[
{
"type":"modelmerge",
"field":"Id",
"operator":"=",
"model":"ProgressNotePatientCase",
"mergeField":"Patient__c",
"noValueBehavior":"noquery",
"encloseValueInQuotes":true
}
]
},
{
"id":"ProgressNoteSTD",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"STD_Test__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Patient_Case__c"
},
{
"id":"Patient_Case__r.Name"
},
{
"id":"STD__c"
},
{
"id":"Results__c"
},
{
"id":"STD_Treatment__c"
},
{
"id":"STD_Treatment__r.Name"
},
{
"id":"Treatment_Date__c"
},
{
"id":"Results_Reported_to_Patient__c"
}
],
"conditions":[
{
"type":"modelmerge",
"field":"Patient_Case__c",
"operator":"=",
"model":"ProgressNotePatientCase",
"mergeField":"Id",
"noValueBehavior":"noquery",
"encloseValueInQuotes":true
}
]
},
{
"id":"ProgressNotePRL",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"Patient_Case_Referral__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Patient_Case_Id__c"
},
{
"id":"Patient_Case_Id__r.Name"
},
{
"id":"Referral_Id__c"
},
{
"id":"Referral_Id__r.Name"
}
],
"conditions":[
{
"type":"modelmerge",
"field":"Patient_Case_Id__c",
"operator":"=",
"model":"ProgressNotePatientCase",
"mergeField":"Id",
"noValueBehavior":"noquery",
"encloseValueInQuotes":true
}
]
},
{
"id":"ProgressNoteNA",
"preventUnloadIfUnsavedChanges":true,
"isProcessing":1,
"calloutIterator":1,
"lastSuccessfulCallout":0,
"objectName":"Interaction__c",
"isAggregate":false,
"isInitialized":true,
"fields":[
{
"id":"Id"
},
{
"id":"Patient_Case__c"
},
{
"id":"Patient_Case__r.Name"
},
{
"id":"Timeless_Date__c"
}
],
"conditions":[
{
"type":"modelmerge",
"field":"Patient_Case__c",
"operator":"=",
"model":"ProgressNotePatientCase",
"mergeField":"Id",
"noValueBehavior":"noquery",
"encloseValueInQuotes":true
},
{
"type":"fieldvalue",
"field":"Interacion_Category__c",
"operator":"=",
"value":"Appointment",
"encloseValueInQuotes":true
},
{
"type":"fieldvalue",
"field":"Status__c",
"operator":"=",
"value":"Scheduled",
"encloseValueInQuotes":true
},
{
"type":"fieldvalue",
"field":"Date__c",
"operator":"gte",
"value":"TOMORROW",
"encloseValueInQuotes":false
}
]
}
]
2
Categories
- 7.9K Questions
- 926 Ideas
- 220 Discussion Categories
- 178 General
- 9 Community Feedback
- 3 Community Info
- 18 Knowledge Base
Comments
My full resource is below. When I run either of the two snippets I get the error indicated in the original post.
I posted the contents of the 'data' attribute in the error in the original post. It's that long json string which appears to be the model definitions.
I will try to isolate as you indicated. Thanks!
This is great, really reduces the surface area of what to focus on for troubleshooting.
I did notice that there is a model merge condition in there and since this is the only model that is being "loaded", the other model won't be there to merge in.
Next steps - Can you reduce the conditions down to 0, then try the load, then add 1 in, load, add another, load, etc. When doing this, save the model merge condition to the last one you add back in.
Typo in the 'field' property of the second condition.
Interaction_Category__c, not Interacion_Category__c.
Seems like there could be a clearer error message for something like this? Like, "Hey, we couldn't find a field by the name specified in your condition."
As for the error messages, in general, there is definitely room for improvement throughout Skuid on providing errors message and/or improving error messages. That said, it's a delicate balance for some things such as this one. In order to provide a "We didn't find this field" type of message, Skuid would have to check each field in every model and every condition, etc. for whether or not it exists. These types of conditional checks, while lightweight by themselves (it would likely require an SObjectDescribe call as well), really add up across an entire page full of models/fields/conditions. In short, providing a more meaningful error message in this case would result in page becoming slower because of the conditional check overhead.
I think one way to provide some help on things like this is to add a way to run a page in "debug mode" or something along those lines. When in "debug" mode, all the extra checks would be performed. Additionally, when a page loads there is some level of checking that is performed against the XML (we've all seen the "This page has # problems"
I just ran into this error message again, and it took quite a bit of time to identify the actual error.