I'm running into an issue with validating tables, and hope someone here has an idea about how to solve this.
Example:
In table Sales Header (36), there's a field Shipping Agent Service Code (5794), which has a complicated relation to the Shipping Agent Services (5790) table:
I started by running a TESTFIELD, but this only checks if the field is populated. It does not check the contents of the field against the table relation!
My first idea to solve this was try to VALIDATE in this situation, but VALIDATE does the following:
- check the table relation;
- run code in OnValidate trigger.
However, the OnValidate trigger for this field contains this line:
I don't give up thát quick, so I built a little function that checks the Field table and picks up TableRelation and FieldRelation.
This works for most fields, but if you do that for Shipping Agent Service Code, you will see that both are set to 0 Actually, this is the case for all complicated relations.
Question: How can I validate the contents of the field in table 36 against the table relation, without running the OnValidate trigger?
If this is not possible by standard, is there a way to retrieve the complicated table relation and either parse this or load it into a filter?
Example:
In table Sales Header (36), there's a field Shipping Agent Service Code (5794), which has a complicated relation to the Shipping Agent Services (5790) table:
"Shipping Agent Services".Code WHERE (Shipping Agent Code=FIELD(Shipping Agent Code))In my requirements, I have to check the contents of this field before running code that requires my Sales Header to be Status::Released.
I started by running a TESTFIELD, but this only checks if the field is populated. It does not check the contents of the field against the table relation!
My first idea to solve this was try to VALIDATE in this situation, but VALIDATE does the following:
- check the table relation;
- run code in OnValidate trigger.
However, the OnValidate trigger for this field contains this line:
Shipping Agent Service Code - OnValidate() TESTFIELD(Status,Status::Open);Hmm... so the code I'm running requires Status to be Released, and the OnValidate trigger requires it to be Open. Problem!
I don't give up thát quick, so I built a little function that checks the Field table and picks up TableRelation and FieldRelation.
This works for most fields, but if you do that for Shipping Agent Service Code, you will see that both are set to 0 Actually, this is the case for all complicated relations.
Question: How can I validate the contents of the field in table 36 against the table relation, without running the OnValidate trigger?
If this is not possible by standard, is there a way to retrieve the complicated table relation and either parse this or load it into a filter?