# 502 - Save Document

> MSS documentation · https://doc.sysdevmobile.com/mss/extensibility/functions-mss-to-kalipso/sales/502-sales-save-document
>
> Eventos EXT_0502 Before/Replace/After ao gravar uma venda; o Replace pode cancelar a gravação devolvendo outCanSave.

502 - Save Document

| Event | Extension action set | Description |
| --- | --- | --- |
| [Before ](https://doc.sysdevmobile.com/mss/extensibility/functions-mss-to-kalipso/sales/502-sales-save-document.md#before) | EXT_0502_1_Before | Will be executed before MSS saves the sale; |
| [Replace](https://doc.sysdevmobile.com/mss/extensibility/functions-mss-to-kalipso/sales/502-sales-save-document.md#replace) | EXT_0502_2_Replace | Will be executed before MSS saves the sale with the possibility to say MSS to cancel the saving process; |
| [After](https://doc.sysdevmobile.com/mss/extensibility/functions-mss-to-kalipso/sales/502-sales-save-document.md#after) | EXT_0502_3_After | Will be executed after the sale is saved; |

### Before

_Input Parameters_

* inDocumentExercise – Exercise of the document;
* inDocumentType – Type of the document;
* inDocumentSeries – Series of the document;
* inDocumentNumber – Number of the document;
* inCustomerCode – Code of the selected customer;

### Replace

_Input Parameters_

* inDocumentExercise - Exercise of the -document;
* inDocumentType - Type of the document;
* inDocumentSeries - Series of the document;
* inDocumentNumber - Number of the document;
* inCustomerCode - Code of the selected customer;

_Output Parameters_

* outCanSave - Return code: 1 – Save the document / 0 – Cancel

### After

_Input Parameters_

* inDocumentExercise - Exercise of the document;
* inDocumentType - Type of the document;
* inDocumentSeries - Series of the document;
* inDocumentNumber - Number of the document;
* inCustomerCode - Code of the selected customer;
