+ Start a Discussion

LDS input form overwriting previous record

I'm using LDS to create a new record -- it's a simple one field input. After input, the record is saved and the init handler for the component runs again, clearing out my {!v.Message} attribute -- I have verified that this new record is "empty". However, when I enter a new message, it is overwriting the previously saved record instead of creating a new record.

Do I need to do a full reload (instead of a refreshView) of the component to get a fresh new record? If so, the docs are not clear on that process (see code below). Specifically, does this go in the Controller for the component I'm refreshing? If so, then what's the 'c.myController' reference? 
refresh : function(component, event, helper) {
    var action = cmp.get('c.myController');
        function(response) {
            var state = response.getState();
            if (state === 'SUCCESS'){
            } else {
                 //do something

Best Answer chosen by PatMcClellan__c
Found the answer here (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_create_record.htm):

It's the 3rd param of the getNewRecord() method, commented in the docs as "skip cache?". I had to set it to true so that the subsequent new records would not be pulled from the existing record in the cache. I think that's what's going on -- it works now.
                "Message__c", // sObject type (entityAPIName)
                null,      // recordTypeId
                true,     // skip cache?
                $A.getCallback(function() {
                    var Message = component.get("v.Message");
                    var error = component.get("v.recordError");
                    if(error || (Message === null)) {
                        console.log("Error initializing record template: " + error);
                        console.log("Message template initialized: " + JSON.stringify(Message));