Unable to perform field update in snippet

Hi,

We have field renderer on opportunity’s status field. in opportunity data table, if user updates status to declined, we need to show popup with additional fields and also, map send notification field to closedate.

popup is created and everythin works well with the exception of notification date being saved to database. here is the popup creation code:
var context = arguments[0];if(context.row.StageName==‘Declined’){
if(context.row.Send_Decline_Notification__c === null || context.row.Send_Decline_Notification__c === undefined) {
var ManagersView_NewBusinessModel = skuid.model.getModel(‘ManagersView_NewBusiness’);
var varContextRow = ManagersView_NewBusinessModel.getRowById(context.row.Id);
ManagersView_NewBusinessModel.updateRow(varContextRow,‘Send_Decline_Notification__c’,context.row.CloseDate);
}
console.log(context.row);
//SHOWS VALUE BEING MAPPED TO Send_Decline_Notification__c
console.log(ManagersView_NewBusinessModel.getRowById(context.row.Id));
var popupXMLString =
‘’
+’’
+’’

  • ‘’
    + ‘’
    + ‘’
    +’’
    +’’
    +’’
    +’’
    +’’

    +’’
    +’’
    +‘ManagersView_NewBusiness’
    +’’
    +’’
    +’’

    +’’
    +’’
    +‘SubmissionComments ’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’ ManagersView_NewBusiness ’
    +’’
    +’’
    +’’

+’’
+’’
+’’
+’’
+’’
+’’
+’’
+’’
+’’
+’’
+’’

  • ‘’
    + ‘Status Reason’
    + ‘’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’
    +’’;
    var popupXML = skuid.utils.makeXMLDoc(popupXMLString);
    var popup = skuid.utils.createPopupFromPopupXML(popupXML,context);
    }

i have tried to set field value in different ways but it doesn’t work. even though on page popup, value is assigned to field but when it is saved, field is still blank.

any help will be appreciated.

thanks.

I think that the action you are describing is in the snippet “SaveOpportunityComments”  you don’t show that snippet here.  This is where I’d look.  Its probably where you are trying to grab the current date and save it as close date.  Put console log statements in that snippet and see if you can see what is oging on. 

You can also popuplate a date field with TODAY using the action framework.  

hi Rob

we are assigning opportunity’s close date to opportunity send decline notification date field if and only if notification date is blank. 

here is the other snippet. in this snippet, value is displayed in console but not saved to database.:
var params = arguments[0], $ = skuid.$;

var opportunityModel = params.row;
console.log("opportunityModel " + opportunityModel.Send_Decline_Notification__c);
if(opportunityModel.Comments__c !== undefined && opportunityModel.Comments__c !== null && opportunityModel.Comments__c !== ‘’) {
    var SubmissionCommentsModel = skuid.$M(‘SubmissionComments’);
        SubmissionCommentsModel.createRow({
            additionalConditions:[    
                {field : ‘Target_Submission__c’, value : opportunityModel.Id},
                {field : ‘Comments__c’, value:opportunityModel.Comments__c }
        ],doAppend: true
        }); 
        SubmissionCommentsModel.save({callback: function(result){
            }});
}

not sure what happened but thankfully this is working now.
still wondering what change i made that it worked.
:smiley:

thanks Rob for your help.

That is both the best and the worst kind of solution.  Nice that its fixed. Worrysome that you don’t exactly know how it got fixed…