Spark: .updateRow() updates row, but model doesn't see changes, and changes are not saved.


Matt, can you confirm that the Signature_Data__c field is Editable/Createable (in the Profile/ Field Level Security)? The only reason I can think of that changes wouldn’t be getting added to the Model is that the field is not editable / createable or is marked as read-only. Since Skuid 10 we’ve more strictly enforced field metadata as part of updateRow calls.

Zack,

The user has edit access to the object and field in salesforce. However, the model is being created dymanically in javascript, and I’m not sure the field metadata is being created correctly.

This is all there is in the field metadata:

Is there something I need to be doing differently when dynamically creating models?

FYI, here’s the model creation:

component.createSignatureModel = function(sigtype, lookuptype, lookupvalue) {
        var dfd = new $.Deferred();
var sigTypeField = (sigtype && sigtype.length === 18 && sigtype.match(/[A-Za-z0-9]{18}/)) ? 'SignatureTypeLookup__c' : 'Signature_Type__c';
        var model = new mm();
        model.objectName = 'Signature__c';
        model.id = modelId;
        model.recordsLimit = 1;
        model.orderByClause = 'SignatureExists__c DESC NULLS LAST, Signature_Date__c DESC';
        model.preventUnloadIfUnsavedChanges = false;
        model.fields = [
            {id: 'Id'},
            {id: 'Name'},
            {id: 'SignatureTypeLookup__c'},
            {id: 'SignatureTypeLookup__r.Name'},
            {id: 'Signature_Name__c'},
            {id: 'Signature_Date__c'},
            {id: 'Signature_Text__c'},
            {id: 'SignatureData__c'},
            {id: 'SignatureExists__c'},
            {id: 'SignatureImageData__c'},
            {id: 'SignatureSaveType__c'},
            {id: 'Checkbox_1__c'},
            {id: 'Checkbox_2__c'},
            {id: 'Checkbox_3__c'},
            {id: 'Checkbox_4__c'},
            {id: 'Checkbox_5__c'},
            {id: 'Checkbox_6__c'},
            {id: 'Checkbox_7__c'},
            {id: 'Checkbox_8__c'},
            {id: 'Checkbox_9__c'},
            {id: 'Initials__c'},
            {id: 'Initials_1__c'},
            {id: 'Initials_2__c'},
            {id: 'Initials_3__c'},
            {id: 'Initials_4__c'},
            {id: 'Initials_5__c'},
            {id: 'Initials_6__c'},
            {id: 'Initials_7__c'},
            {id: 'Initials_8__c'},
            {id: 'Long_Text_1__c'},
            {id: 'Long_Text_2__c'},
            {id: 'Text_1__c'},
            {id: 'Text_2__c'},
            {id: 'Text_3__c'},
            {id: 'Text_4__c'},
            {id: 'Text_5__c'},
            {id: 'Textarea_1__c'},
            {id: 'Textarea_2__c'},
            {id: 'Textarea_3__c'},
            {id: 'Witness__c'},
        {id: "signeename", uiOnly:true, displaytype:"TEXT", label:"Signee Name"},
        {id: "readonly", uiOnly:true, displaytype:"BOOLEAN", label:"Read Only", ogdisplaytype:"TEXT", defaultvaluetype:"fieldvalue", defaultValue:"false"},
            {
            id: "style",
            uiOnly: true, 
            displaytype:"PICKLIST", 
            label:"Style", 
            ogdisplaytype:"TEXT", 
            picklistsource:"manual", 
            defaultvaluetype:"fieldvalue", 
            defaultValue:"draw", 
            picklistEntries:[
                    {value:"draw", label:"Draw"},
                    {value:"type", label:"Type"}
                ]
            },
            {id: 'componentid', uiOnly: true, displaytype:"TEXT", label:"Component Id"}
        ];
        model.conditions = [
            {
                type: 'fieldvalue',
                field: sigTypeField,
                operator: '=',
                value: sigtype,
                encloseValueInQuotes: true
            },
            {
                type: 'fieldvalue',
                field: lookuptype,
                operator: '=',
                value: lookupvalue,
                encloseValueInQuotes: true
            },
            {
                type: 'fieldvalue',
                field: 'Witness__c',
                operator: (witness ? '=' : '!='),
                value: true,
                encloseValueInQuotes: false
            }
        ];
        model.actions = [{
        actions: ''+
        ''+
        ''+
        '',
        events: ["row.updated"],
        fields: ["SignatureData__c", "Signature_Text__c"]
        }];
        $.when(model.initialize().register().load())
            .then(function(){
                if (!model.getRows().length) model.createRow();
                component.model = model;
                dfd.resolve(model);
            });
        
        return dfd.promise();
    };```

bump

This issue was the result of the same problem addressed here: https://community.skuid.com/t/spark-sub-components-within-custom-component-not-rerendering-when-underlying-model-changes