getSaveMode (Client API reference)
Returns a value indicating how the save event was initiated by the user.
Syntax
executionContext.getEventArgs().getSaveMode()
Return Value
Type: Number
Description: The following table describes the supported values returned to detect different ways table records may be saved by the user.
Value | Save mode | Table |
---|---|---|
1 | Save | All |
2 | Save and Close | All |
5 | Deactivate | All |
6 | Reactivate | All |
7 | Send | |
15 | Disqualify | Lead |
16 | Qualify | Lead |
47 | Assign | User or Team owned tables |
58 | Save as Completed | Activities |
59 | Save and New | All |
70 | Auto Save | All |
Remarks
This method is essential if you want to enable auto-save for most forms in an organization but disable it for specific forms.
Example
The following code registered for the OnSave event with the execution context passed to it will prevent any saves that initiate from an auto-save but allow all others. With auto-save enabled, navigating away is equivalent to Save and Close. This code will prevent any saves that are initiated by the 30 second timer or when people navigate away from a form with unsaved data.
function preventAutoSave(executionContext) {
var eventArgs = executionContext.getEventArgs();
if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
eventArgs.preventDefault();
}
}
To save a record the user must select the Save icon at the bottom of the form or a custom Save command needs to be added to the command bar.
Related articles
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기