locked
difference between 'Save' and 'Save and close'? RRS feed

  • Question

  • In conjunction with further research I do myself, I'd like to know if someone already has seen differences in behaviour of the 'Save' and the 'Save and Close' buttons on a form.

    We have a form, with an iFrame which makes a call to a backend system.  When hitting the 'Save' button, then the call to the backend systems works fine. When we use the 'Save and Close' button, then the call to the backend system doesn't work. So, without going into details about the calls, I'd like to know if there's  difference between both buttons.

    Someone has more information?

    Regards,
    Nico
    Wednesday, October 21, 2009 11:47 AM

Answers

  • As you can see from next code snippet there is no much difference between these methods.

    function Save()
    {
    return SubmitCrmForm(1, true, false, false);
    }
    
    
    function SaveAndClose()
    {
    SubmitCrmForm(2, true, false, true);
    }
    
    
    
    function SubmitCrmForm(iMode, bCheckValid, bForceSubmit, bClose)
    {
    
    if (_bSaving)
    {
    return;
    }
    
    if (IsValid() && false != fireSaveEvent(iMode))
    {
    
    var iStatus = BuildXml(false, (_oSubmitForm.crmFormSubmitId.value != ""));
    
    
    if (iStatus == SUCCESS || (iStatus == NO_DATA && bForceSubmit))
    {
    _oSubmitForm.crmFormSubmitMode.value = iMode;
    if( typeof( _oSubmitForm.crmFormUserModified ) != "undefined"
    && !IsNull( _oSubmitForm.crmFormUserModified ) )
    {
    _oSubmitForm.crmFormUserModified.value = _bUserHasModifiedForm ? "true" : "false";
    }
    
    
    if (bForceSubmit || (_oSubmitForm.crmFormSubmitXml.value && _oSubmitForm.crmFormSubmitXml.value.length > 0))
    {
    Submit();
    return true;
    }
    
    }
    }
    else
    {
    return false;
    }
    
    if (iStatus == NO_DATA && bClose)
    {
    window.close();
    }
    if (iStatus == DATA_NOT_VALID)
    {
    return false;
    }
    }
    
    This code was obtained from _static\_forms\controls\form.crm.htc

    Wednesday, October 21, 2009 12:56 PM

All replies

  • well...as per my knowledge..when you clicn save....it will save the form fields and then refresh form it again to show saved value..

    when you click save and close...it saves the form fields and closes the form (does not need to refresh it here)..

    if suggest the debug your code and see if the passed perameters are the same..

    Also have a look at the following post regarding the same..
    http://msdn.microsoft.com/en-us/library/cc150868.aspx

    Wednesday, October 21, 2009 12:13 PM
  • As you can see from next code snippet there is no much difference between these methods.

    function Save()
    {
    return SubmitCrmForm(1, true, false, false);
    }
    
    
    function SaveAndClose()
    {
    SubmitCrmForm(2, true, false, true);
    }
    
    
    
    function SubmitCrmForm(iMode, bCheckValid, bForceSubmit, bClose)
    {
    
    if (_bSaving)
    {
    return;
    }
    
    if (IsValid() && false != fireSaveEvent(iMode))
    {
    
    var iStatus = BuildXml(false, (_oSubmitForm.crmFormSubmitId.value != ""));
    
    
    if (iStatus == SUCCESS || (iStatus == NO_DATA && bForceSubmit))
    {
    _oSubmitForm.crmFormSubmitMode.value = iMode;
    if( typeof( _oSubmitForm.crmFormUserModified ) != "undefined"
    && !IsNull( _oSubmitForm.crmFormUserModified ) )
    {
    _oSubmitForm.crmFormUserModified.value = _bUserHasModifiedForm ? "true" : "false";
    }
    
    
    if (bForceSubmit || (_oSubmitForm.crmFormSubmitXml.value && _oSubmitForm.crmFormSubmitXml.value.length > 0))
    {
    Submit();
    return true;
    }
    
    }
    }
    else
    {
    return false;
    }
    
    if (iStatus == NO_DATA && bClose)
    {
    window.close();
    }
    if (iStatus == DATA_NOT_VALID)
    {
    return false;
    }
    }
    
    This code was obtained from _static\_forms\controls\form.crm.htc

    Wednesday, October 21, 2009 12:56 PM