Attempt to de-reference a null object

Matt SonesMatt Sones 💎💎💎
edited March 3, 2019 in Questions
I'm encountering this error when running a snippet that creates several dynamic models.

Here's the console error:
image

And here's the data for the error:
 
   {  
      "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
         }
      ]
   }
]
HELP!?!

Comments

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    This is still a problem.

    My full resource is below. When I run either of the two snippets I get the error indicated in the original post.
    // Progress Notes Javascript
    (function (skuid){
    //////////////////////////////////////////////
    // Global Variables //
    //////////////////////////////////////////////
    var $ = skuid.$,
    $t = skuid.time,
    mSTD, mPRL,
    rI, rC, rP, rNA;
    var dynamicModels = [];
    var mD = skuid.$M('CenterDefaults'),
    rD = (mD) ? mD.getFirstRow() : null;
    if (rD){
    var roleAccounts = (rD.Account_System__c === 'Role'),
    advocateAssisted = (rD.Patient_Engagement_Model__c === 'Advocate Assisted');
    }
    //////////////////////////////////////////////
    // Model Builders //
    //////////////////////////////////////////////
    var 
    buildMajorNotesModels = function(interactionId){
    //Interaction Model
    var modelI = new skuid.model.Model();
    modelI.objectName = 'Interaction__c';
    modelI.id = 'ProgressNoteInteraction';
    modelI.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'}
    ];
    modelI.conditions = [
    {
    type: 'fieldvalue',
    field: 'Id',
    operator: '=',
    value: interactionId,
    encloseValueInQuotes: true
    }
    ];
    //Patient Case Model
    var modelC = new skuid.model.Model();
    modelC.objectName = 'Patient_Case__c';
    modelC.id = 'ProgressNotePatientCase';
    modelC.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'}
    ];
    modelC.conditions = [
    {
    type: 'modelmerge',
    field: 'Id',
    operator: '=',
    model: 'ProgressNoteInteraction',
    mergeField: 'Patient_Case__c',
    noValueBehavior: 'noquery',
    encloseValueInQuotes: true
    }
    ];
    //Patient Model
    var modelP = new skuid.model.Model();
    modelP.objectName = 'Patient__c';
    modelP.id = 'ProgressNotePatient';
    modelP.fields = [
    {id: 'Id'},
    {id: 'Name'},
    {id: 'Age__c'},
    {id: 'Ethnicity__c'},
    {id: 'Sex__c'},
    {id: 'GPA__c'}
    ];
    modelP.conditions = [
    {
    type: 'modelmerge',
    field: 'Id',
    operator: '=',
    model: 'ProgressNotePatientCase',
    mergeField: 'Patient__c',
    noValueBehavior: 'noquery',
    encloseValueInQuotes: true
    }
    ];
    dynamicModels.push(modelI, modelC, modelP);
    },
    buildSTDModel = function(){
    var modelSTD = new skuid.model.Model();
    modelSTD.objectName = 'STD_Test__c';
    modelSTD.id = 'ProgressNoteSTD';
    modelSTD.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'}
    ];
    modelSTD.conditions = [
    {
    type: 'modelmerge',
    field: 'Patient_Case__c',
    operator: '=',
    model: 'ProgressNotePatientCase',
    mergeField: 'Id',
    noValueBehavior: 'noquery',
    encloseValueInQuotes: true
    }
    ];
    dynamicModels.push(modelSTD);
    },
    buildPRLModel = function(){
    var modelPRL = new skuid.model.Model();
    modelPRL.objectName = 'Patient_Case_Referral__c';
    modelPRL.id = 'ProgressNotePRL';
    modelPRL.fields = [
    {id: 'Id'},
    {id: 'Patient_Case_Id__c'},
    {id: 'Patient_Case_Id__r.Name'},
    {id: 'Referral_Id__c'},
    {id: 'Referral_Id__r.Name'}
    ];
    modelPRL.conditions = [
    {
    type: 'modelmerge',
    field: 'Patient_Case_Id__c',
    operator: '=',
    model: 'ProgressNotePatientCase',
    mergeField: 'Id',
    noValueBehavior: 'noquery',
    encloseValueInQuotes: true
    }
    ];
    dynamicModels.push(modelPRL);
    },
    buildNextAppointmentModel = function(){
    var modelNA = new skuid.model.Model();
    modelNA.objectName = 'Interaction__c';
    modelNA.id = 'ProgressNoteNA';
    modelNA.fields = [
    {id: 'Id'},
    {id: 'Patient_Case__c'},
    {id: 'Patient_Case__r.Name'},
    {id: 'Timeless_Date__c'}
    ];
    modelNA.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
    }
    ];
    dynamicModels.push(modelNA);
    },
    loadDynamicModels = function() {
    var notemodelDFD = new $.Deferred();
    $.each(dynamicModels, function(){
    this.initialize().register();
    });
    $.when(skuid.model.load(dynamicModels))
    .done(function(){
    notemodelDFD.resolve();
    })
    .fail(function(){
    notemodelDFD.reject();
    });
    return notemodelDFD.promise();
    };
    //////////////////////////////////////////////
    // Note Functions //
    //////////////////////////////////////////////
    var 
    dateAndPurpose = function(value){
    value += rI.Timeless_Date__c + ' ' + rI.Interaction_Purpose__c + '. ';
    },
    patientInfo = function(value) {
    value += rP.Age__c + 'y.o. ' + rP.Ethnicity__c + ' ' + (rP.Sex__c || 'female') +'. ';
    value += rP.GPA__c + '. ';
    value += 'LMP ' + rC.LMP__c +'. ';
    return value;
    },
    emergencyReferral = function(value){
    if (rC.Patient_was_Referred_to_Hospital_ED__c) {
    value += 'Patient was referred to hospital ED ';
    if (rC.Hospital_Referred_To__c) value += '(' + rC.Hospital_Referred_To__c + ') ';
    var referraldatetime = $t.parseSFDateTime(rC.Date_and_Time_of_Referral__c);
    value += 'on ' + $t.formatDate("m/d/yy", referraldatetime) + ' at ' + $t.formatTime("h:mm a", referraldatetime) + ' ';
    value += 'with symptoms ' + rC.Symptoms__c + '. ';
    }
    return value;
    },
    ultrasoundInfo = function(value){
    if (rI.U_S_Performed__c === "Yes") {
       value += 'U/S Performed. ';
       if (rI.Gestational_Age_US_Weeks__c) {
       value += 'GA ' + rI.Gestational_Age_US_Weeks__c + 'w' + rI.Gestational_Age_US_Days__c + 'd. ';
       }
    if (rC.Pregnancy_Confirmed__c) value += 'Pregnancy confirmed. ';
    if (rI.Baby_1_FHR__c) value += 'FHR ' + rI.Baby_1_FHR__c + '. ';
    if (rC.Estimated_Due_Date_by_U_S__c) value += 'EDD ' + rC.Estimated_Due_Date_by_U_S__c + '. ';
    }
    return value;
    },
    stdTestTreat = function(value){
    if (mSTD && mSTD.data.length) {
    value += 'Tested for ';
    $.each(mSTD.data, function(i, row){
    value += row.STD__c;
    if(row.Results__c){
    value += ' (' + row.Results__c + ')';
    }
    if(row.STD_Treatment__c){
           value += ' treated with ' + row.STD_Treatment__r.Name + ' on ' + row.Treatment_Date__c;
        }
        value += ', ';
    });
    value = value.substring(0, value.length - 2) + '. ';
    }
    return value;
    },
    stdReportTreat = function(value){
    if (mSTD && mSTD.data.length) {
       var reported = false;
      value += 'Results for ';
      $.each(mSTD.data, function(i, row){
          value += row.STD__c;
          if(row.Results__c) value += ' (' + row.Results__c + ')';
          if(row.STD_Treatment__c) value += ' treated with ' + row.STD_Treatment__r.Name + ' on ' + row.Treatment_Date__c;
          if(reported === false && row.Results_Reported_to_Patient__c) reported = true;
          value += ', ';
    });
    value = value.substring(0, value.length - 2);
    if (reported) value += ' reported to patient';
    value += '. ';
    }
    return value;
    },
    prlReferrals = function(value){
    if (mPRL && mPRL.data.length) {
    value += 'Patient was given referral information for ';
    $.each(mPRL.data, function(i,row) {
    value += row.Referral_Id__r.Name + ', ';
    });
    value = value.substring(0, value.length - 2) + '. ';
    }
    if (rC.Custom_Referrals__c) value += 'Also referred to ' + rC.Custom_Referrals__c + '. ';
    return value;
    },
    nextAppointment = function(value){
    if (rI.Return_Appointment_Required__c && rNA) {
       value += 'Return appointment for ' + rI.Return_Appointment_Details__c + ' scheduled on ' + rNA.Timeless_Date__c + '. ';
    }
    return value;
    },
    pregnancyIntention = function(value){
    value += 'Pregnancy Intention: ' + rI.Interaction_Intention__c + '. ';
    return value;
    },
    closingNotes = function(value){
    if (rI.Closing_Notes__c) value += rI.Closing_Notes__c + '. ';
    return value;
    },
    userName = function(value){
    value += skuid.utils.userInfo.name + ', RN.';
    return value;
    },
    nurseStaffName = function(value){
    value += rI.Primary_Staff__r.Name + '. ';
    return value;
    },
    advocateName = function(value){
    value += rI.Additional_Staff__r.Name + '. ';
    };
    //////////////////////////////////////////////
    // Note Generator Snippets //
    //////////////////////////////////////////////
    var snippets = {
    'generateInitialPregnancyNote':function(){
    var id = skuid.page.params.id;
    buildMajorNotesModels(id);
    buildSTDModel();
    buildPRLModel();
    buildNextAppointmentModel();
    $.when(loadDynamicModels()).then(function(){
    var noteModel = skuid.$M('ProgressNoteInteraction'),
    noteRow = noteModel.getFirstRow(),
    note = noteModel.getFieldValue(noteRow, 'Nurse_s_Notes__c'),
    advocateNote = noteModel.getFieldValue(noteRow, 'Nurse_s_Additional_Notes__c');
    note = dateAndPurpose(note);
    note = patientInfo(note);
    note = emergencyReferral(note);
    note = ultrasoundInfo(note);
    note = stdTestTreat(note);
    note = (advocateAssisted) ? note : prlReferrals(note);
    note = closingNotes(note);
    note = pregnancyIntention(note);
    note = (roleAccounts) ? nurseStaffName(note) : userName(note);
    noteModel.updateRow(noteRow,{'Nurse_s_Notes__c': note});
    if (advocateAssisted) {
    advocateNote = dateAndPurpose(advocateNote);
    advocateNote = patientInfo(advocateNote);
    advocateNote = prlReferrals(advocateNote);
    advocateNote = closingNotes(advocateNote);
    advocateNote = pregnancyIntention(advocateNote);
    advocateNote = (roleAccounts) ? advocateName(advocateNote) : userName(advocateNote);
    noteModel.updateRow(noteRow, {'Nurse_s_Additional_Notes__c': advocateNote});
    }
    });
    },
    'generateReturnPregnancyNote':function(){
    var id = skuid.$M('Interaction').getFirstRow().Id;
    buildMajorNotesModels(id);
    buildSTDModel();
    buildNextAppointmentModel();
    $.when(loadDynamicModels()).then(function(){
    var noteModel = skuid.$M('ProgressNoteInteraction'),
    noteRow = noteModel.getFirstRow(),
    note = noteModel.getFieldValue(noteRow, 'Nurse_s_Notes__c'),
    advocateNote = noteModel.getFieldValue(noteRow, 'Nurse_s_Additional_Notes__c');
    note = dateAndPurpose(note);
    note = patientInfo(note);
    note = emergencyReferral(note);
    note = ultrasoundInfo(note);
    note = stdReportTreat(note);
    note = closingNotes(note);
    note = pregnancyIntention(note);
    note = (roleAccounts) ? nurseStaffName(note) : userName(note);
    noteModel.updateRow(noteRow,{'Nurse_s_Notes__c': note});
    if (advocateAssisted) {
    advocateNote = dateAndPurpose(advocateNote);
    advocateNote = patientInfo(advocateNote);
    advocateNote = closingNotes(advocateNote);
    advocateNote = pregnancyIntention(advocateNote);
    advocateNote = (roleAccounts) ? advocateName(advocateNote) : userName(advocateNote);
    noteModel.updateRow(noteRow, {'Nurse_s_Additional_Notes__c': advocateNote});
    }
    });
    }
    };
    //////////////////////////////////////////////
    // Register Snippets //
    //////////////////////////////////////////////
    $.each(snippets,function(name,func){ skuid.snippet.registerSnippet(name,func); });
    })(skuid);
  • Barry SchnellBarry Schnell 💎💎
    edited February 25, 2017
    Hey Matt - Lots of stuff going on here.  The error you are getting is occurring server side in the Skuid code.  Have you tried commenting out models all the way down to just 1, running the snippet, then adding in the 2nd model, running the snippet, etc.?  This might provide a means to isolate which model could be causing the issue.  Also, could you run the test and expand the 'data' attribute of the exception and post another screenshot?
  • Matt SonesMatt Sones 💎💎💎
    edited February 25, 2017
    Thanks, Barry.

    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!
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Ah, got it, didn't realize that was "that" data, thanks!
  • Matt SonesMatt Sones 💎💎💎
    edited February 25, 2017
    Following Barry's instructions, I've isolated the problematic model to the following. The model will initialize and register, but when I call .load(), I get the VF remoting error.
    buildNextAppointmentModel = function(){ var modelNA = new skuid.model.Model();
    modelNA.objectName = 'Interaction__c';
    modelNA.id = 'ProgressNoteNA';
    modelNA.fields = [
    {id: 'Id'},
    {id: 'Patient_Case__c'},
    {id: 'Patient_Case__r.Name'},
    {id: 'Timeless_Date__c'}
    ];
    modelNA.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
    }
    ];
    When that is the only model I'm loading, here's the 'data' portion of the error:
     
       {  
          "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
             }
          ]
       }
    ]
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    Hey Matt -

    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.
  • Matt SonesMatt Sones 💎💎💎
    edited March 3, 2019
    Found it!

    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."
  • Matt SonesMatt Sones 💎💎💎
    edited December 7, 2016
    Barry-- As always, thanks so much for your help!
  • Barry SchnellBarry Schnell 💎💎
    edited March 13, 2018
    Awesome, glad you found it!

    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" :)).  Currently, that approach is somewhat limited (e.g. it checks models, etc.).  Expanding the scope to check all configuration of a page (either on PageLoad in the builder or via a "ValidatePage" button would be helpful).
  • Barry SchnellBarry Schnell 💎💎
    edited November 18, 2016
    You're welcome Matt, glad you were able to get it sorted!
  • Matt SonesMatt Sones 💎💎💎
    edited March 13, 2018
    Skuid... any progress on some kind of 'debug mode' ?

    I just ran into this error message again, and it took quite a bit of time to identify the actual error.
  • Arne-Per HeurbergArne-Per Heurberg ✭✭✭✭
    edited March 13, 2018
    Thanks to both of you! The methodology has helped with recent challenges.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!