To Encrypt and Decrypt the Key values in ax fileds
final class TECGetSecretKey
{
/// <summary>
/// Class entry point. The system will call this method when a designated menu
/// is selected or when execution starts and this class is set as the startup class.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
TECAxCrmParameter TECAxCrmParameter = TECAxCrmParameter::find();
Info(TECAxCrmParameter.passwordEdit(false, ''));
}
}
======================================================================
public void insert()
{
Global::handleEncryptedTablePreInsert(this);
super();
Global::handleEncryptedTablePostInsert(this);
}
public void update()
{
Global::handleEncryptedTablePreUpdate(this);
super();
Global::handleEncryptedTablePostUpdate(this);
}
public edit CRMSecretKey passwordEdit(boolean _set, CRMSecretKey value)
{
System.Exception ex;
CRMSecretKey secretKey = '';
try
{
secretKey = Global::editEncryptedField(this, value, fieldNum(TECAxCrmParameter, SecretID), _set);
}
catch (ex)
{
boolean exceptionNested = false;
while (ex != null)
{
exceptionNested = true;
ex = ex.InnerException;
}
if (_set)
{
warning("Failed to save the password. Please try again");
}
else
{
warning("Failed to read the password. Please clear and re-enter the password.");
}
}
return secretKey;
}
static TECAxCrmParameter find(boolean _forupdate = false)
{
TECAxCrmParameter parameter;
if (_forupdate)
{
parameter.selectForUpdate(_forupdate);
}
select firstonly parameter
index CRMIdx
where parameter.key == 0;
if (!parameter && !parameter.isTmp())
{
Company::createParameter(parameter);
PriceDiscSalesPolicyParameters::initParameters();
}
return parameter;
}
======================================================================
Comments
Post a Comment