Dear team,
I created a custom field for "Extended Text line" in this scenario because of the character length. so, I set a new length.
Hi Amit,
PO line description also length issue...
the default BASE code is
field(11; Description; Text[100])
{
Caption = 'Description';
TableRelation = IF (Type = CONST("G/L Account"), "No." = CONST(''),"System-Created Entry" = CONST(false)) "G/L Account".Name 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".Name
ELSE
IF (Type = CONST(Item), "Document Type" = FILTER(<> "Credit Memo" & <> "Return Order")) Item.Description WHERE(Blocked = CONST(false), "Purchasing Blocked" = CONST(false))
ELSE
IF (Type = CONST(Item), "Document Type" = FILTER("Credit Memo" | "Return Order")) Item.Description WHERE(Blocked = CONST(false))
ELSE
IF (Type = CONST("Fixed Asset")) "Fixed Asset".Description
ELSE
IF (Type = CONST("Charge (Item)")) "Item Charge".Description
else
if (Type = CONST(Resource)) Resource.Name;
ValidateTableRelation = false;
trigger OnValidate()
var
ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";
FindRecordMgt: Codeunit "Find Record Management";
ReturnValue: Text[50];
IsHandled: Boolean;
ShouldErrorForFindDescription: Boolean;
begin
IsHandled := false;
OnBeforeValidateDescription(Rec, xRec, CurrFieldNo, IsHandled);
if IsHandled then
exit;
if Type = Type::" " then
exit;
if "No." <> '' then
exit;
case Type of
Type::Item:
ValidateItemDescription();
else begin
ReturnValue := FindRecordMgt.FindNoByDescription(Type.AsInteger(), Description, true);
if ReturnValue <> '' then begin
CurrFieldNo := FieldNo("No.");
Validate("No.", CopyStr(ReturnValue, 1, MaxStrLen("No.")));
end;
end;
end;
ShouldErrorForFindDescription := ("No." = '') and GuiAllowed() and ApplicationAreaMgmtFacade.IsFoundationEnabled() and ("Document Type" = "Document Type"::Order);
OnValidateDescriptionOnAfterCalcShouldErrorForFindDescription(Rec, xRec, ShouldErrorForFindDescription);
if ShouldErrorForFindDescription then
Error(CannotFindDescErr, Type, Description);
end;
}
so, I created a new field on PO Lines
field(1037; Description1; Text[2000])
{
Caption = 'Description1';
TableRelation = IF (Type = CONST("G/L Account"), "No." = CONST(''),
"System-Created Entry" = CONST(false)) "G/L Account".Name 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".Name
ELSE
IF (Type = CONST(Item), "Document Type" = FILTER(<> "Credit Memo" & <> "Return Order")) Item.Description WHERE(Blocked = CONST(false),
"Purchasing Blocked" = CONST(false))
ELSE
IF (Type = CONST(Item), "Document Type" = FILTER("Credit Memo" | "Return Order")) Item.Description WHERE(Blocked = CONST(false))
ELSE
IF (Type = CONST("Fixed Asset")) "Fixed Asset".Description
ELSE
IF (Type = CONST("Charge (Item)")) "Item Charge".Description
else
if (Type = CONST(Resource)) Resource.Name;
ValidateTableRelation = false;
trigger OnValidate()
var
ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";
FindRecordMgt: Codeunit "Find Record Management";
ReturnValue: Text[50];
IsHandled: Boolean;
ShouldErrorForFindDescription: Boolean;
CannotFindDescErr: Label 'Cannot find %1 with Description %2.\\Make sure to use the correct type.', Comment = '%1 = Type caption %2 = Description';
begin
IsHandled := false;
OnBeforeValidateDescription(Rec, xRec, CurrFieldNo, IsHandled);
if IsHandled then
exit;
if Type = Type::" " then
exit;
if "No." <> '' then
exit;
case Type of
Type::Item:
ValidateItemDescription();
else begin
//ReturnValue := FindRecordMgt.FindNoByDescription(Type.AsInteger(), Description, true);
if ReturnValue <> '' then begin
CurrFieldNo := FieldNo("No.");
Validate("No.", CopyStr(ReturnValue, 1, MaxStrLen("No.")));
end;
end;
end;
ShouldErrorForFindDescription := ("No." = '') and GuiAllowed() and ApplicationAreaMgmtFacade.IsFoundationEnabled() and ("Document Type" = "Document Type"::Order);
OnValidateDescriptionOnAfterCalcShouldErrorForFindDescription(Rec, xRec, ShouldErrorForFindDescription);
if ShouldErrorForFindDescription then
Error(CannotFindDescErr, Type, Description);
end;
}
FINALLY, I GOT ONE ERROR
so, Please help me to fix the issue
Regards,
Nagarjun M - D365 Technical Developer
Hi,
Write code on the event of extended Text and replace Text value to Text1.
Regards
Amit Sharma
www.erpconsultors.com
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156