I'm new with x++ and D365, so I often get stuck in very simple tasks. In this case i have created a new field in the extension table EcoResProductParameter called MaxPercentage and put it into the EcoResProductParameter extension form, and I need to check if this value is bigger than the SalesPercentMarkup I select in the InventTable. If so, the percent is updated, else I will receive an error. I tried to do something like this in the DataContract class:
public boolean validate()
{
boolean isValid;
if(salesPercentMarkup <= parameterTable.MaxPercentage)
{
isValid = true;
}
else
{
isValid = checkFailed('The percentage has exceeded the max');
}
return isValid;
}
but it keeps returning the error because I don't know how to correctly access the value that the user manually insert into the MaxPercentage field, so the problem is in my if statement I suppose. Can anyone help me with this? Thank you
One way to do this would be to create Chain of Command extension class for the
validateField
method of theInventTable
table.This allows you to add custom field validations. In the scenario described in the question, this could look like this: