Hi Experts,
I am facing issue with configuration package. I have insert GuiAllowed true for case that if someone is changing my Link-with Erp boolean field from Project Page then it shoes the confirm message which is working fine. But if I import bulk data configuration package then it should not ask for confirmation message. So, the problem is that if I import bulk data from configuration package then it shows the confirm message which it should not show. How can I fix it.
P.S: The Link with Erp field is not able to be modified because this field is coming from Dependencies so I can not change it or modify it. Please see the below attachments for verification.
Code:
Written in Codeunit:
[EventSubscriber(ObjectType::Table, Database::"Job", 'OnAfterValidateEvent', "Link With BuilderMt", true, true)]
local procedure JobLinkWithErpCheck(var Rec: Record "Job"; var xRec: Record Job)
var
JsonString: Text;
IsSuccessCode: Boolean;
JobTaskRec: Record "Job Task";
Cnfrm: Boolean;
begin
if Rec."Link With BuilderMT" <> xRec."Link With BuilderMT" then begin
if GuiAllowed() then begin
Cnfrm := Confirm('Are you sure you want to change link with the ERP?', false);
End
else begin
Cnfrm := true;
end;
if Cnfrm then begin
if rec."Link With BuilderMT" = true then begin
JsonString := JobCodeunit.CreateJobJson(Rec);
IsSuccessCode := JobCodeunit.CreateJobInErp(JsonString);
if IsSuccessCode = true then begin
JobTaskRec.SetRange("Job No.", Rec."No.");
if JobTaskRec.FindSet() then begin
REPORT.Run(REPORT::"ArmCreateJobTaskInERPRep", false, false, JobTaskRec);
end;
end;
end;
end
else begin
Error('');
end;
end;
end;
Configuration Package Behaviour:
I want it to show message on Project page only where I am Modifying the record.
Please tell me the solution.
Thanks.