
How this logic work based on type no. is changed.
Thank You.
This is how the sales line handles it:
field(6; "No."; Code[20])
{
CaptionClass = GetCaptionClass(FieldNo("No."));
Caption = 'No.';
TableRelation = IF (Type = CONST(" ")) "Standard Text"
ELSE
IF (Type = CONST("G/L Account"),
"System-Created Entry" = CONST(false)) "G/L Account" WHERE("Direct Posting" = CONST(true),
"Account Type" = CONST(Posting),
Blocked = CONST(false))
ELSE
IF (Type = CONST("G/L Account"),
"System-Created Entry" = CONST(true)) "G/L Account"
ELSE
IF (Type = CONST(Resource)) Resource
ELSE
IF (Type = CONST("Fixed Asset")) "Fixed Asset"
ELSE
IF (Type = CONST("Charge (Item)")) "Item Charge"
ELSE
IF (Type = CONST(Item),
"Document Type" = FILTER(<> "Credit Memo" & <> "Return Order")) Item WHERE(Blocked = CONST(false),
"Sales Blocked" = CONST(false))
ELSE
IF (Type = CONST(Item),
"Document Type" = FILTER("Credit Memo" | "Return Order")) Item WHERE(Blocked = CONST(false));