Share via


CREATEENCRYPTIONKEY

Creates an encryption key for the current Dynamics NAV tenant.

Syntax

CREATEENCRYPTIONKEY()  

Return Value

Type: Boolean

true if the encryption key was created; otherwise, false.

If you omit this optional return value and the encryption key cannot be created successfully, then a run-time error occurs. If you include the return value, then you must handle any errors.

Exceptions

If a key already exists, the following error will be displayed: Unable to create a new encryption key. An encryption key already exists.

Example

This code example creates an encryption key for the current tenant. It uses the ENCRYPTIONENABLED function to perform a check.

IF NOT ENCRYPTIONENABLED THEN  
        CREATEENCRYPTIONKEY();  

See Also

System
Technical Reference
C/SIDE Reference Guide