JavaScript – getSaveMode

Quick post, hopefully useful reference material ….

getSaveMode(), returns a value indicating how the save event was initiated.

execObj.getEventArgs().getSaveMode()

Note: Don’t forget that you will need to tick the option to return the context as the first parameter on your on-save event.

Entity Event Mode Value
All Save 1
All Save and Close 2
All Save and New 59
All AutoSave 70
Activities Save as Completed 58
All Deactivate 5
All Reactivate 6
User or Team owned entities Assign 47
Email (E-mail) Send 7
Lead Qualify 16
Lead Disqualify 15

The following code could be used to prevent save from auto save events!

function preventAutoSave(econtext) {
    var eventArgs = econtext.getEventArgs();
    if (eventArgs.getSaveMode() == 70) {
        eventArgs.preventDefault();
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s