System.Decrypt(Text) Method

Version: Available or changed with runtime version 1.0.

Takes a string as input and returns the decrypted value of the string.

Syntax

PlainTextString :=   System.Decrypt(EncryptedString: Text)

Note

This method can be invoked without specifying the data type name.

Parameters

EncryptedString
 Type: Text
The input string that will be decrypted.

Return Value

PlainTextString
 Type: Text
The output string that is decrypted.

Remarks

If encryption is not enabled or the encryption key does not exist, the following error will be displayed: An encryption key is required to complete the request. If decryption failed because input data could not be decrypted, the following error will be displayed: Unable to decrypt data. The data was encrypted using a different key.

Example

This code example checks whether the tenant is configured to allow encryption using the EncryptionEnabled method, and then it decrypts an encrypted text string.

This example requires that you create the following text constants: EncryptedText and PlainText.

if not EncryptionEnabled then  
        Error('Encryption has not been enabled.');  
      PlainText := Decrypt(EncryptedText);  

System Data Type
Get Started with AL
Developing Extensions