Menu Close

D365FO Password Implementation

Never-ever create a simple string Password field in D365 because someone can steal it by SQL DB.

I know somewhere there is some information about secure password saving. However, I didn’t find a good short article so I’d like to post it.

If you want to make a secure solution and you need to save some credentials into Database follow next steps:
1. You need a table (better a new one and use it only for credentials);
2. Create a Password field, type – container, EDT – EncryptedField;
3. Override insert and update methods:

public void insert()

{
Global::handleEncryptedTablePreInsert(this);
super();
Global::handleEncryptedTablePostInsert(this);
}
public void update()
{
Global::handleEncryptedTablePreUpdate(this);
super();
Global::handleEncryptedTablePostUpdate(this);
}

4. Add new one method for edit your password

public edit Password passwordEdit(boolean _set, Password value)

{
return Global::editEncryptedField(this, value, fieldNum([your table], [your field]), _set);
}

5. In the design form create new str Password control (linked to the passwordEdit edit method Step.4) make a property Password Style = Yes

SQL DB Encrypted Password

6. To Read Password or compare it

[passwordtableObject].passwordEdit(false,'') == 'passwordstring'

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.