Hi All,
I need to customize the Copy Fixed asset action such that when one click Copy Fixed Asset, the newly created asset will leave blank the field for serial since it's a unique field.
I have checked the default code and I have realized that it's a report. After reviewing this report, I haven't seen any place it's attempting to insert serial.
What's the best way to achieve my goal.?
Mohana,
Thanks for enlightenment I have replaced OnOnPreReportOnBeforeFA2Insert with OnAfterFixedAssetCopied and it has worked. I have also added
you can try withy the below event.
[EventSubscriber(ObjectType::Report, Report::"Copy Fixed Asset", 'OnAfterFixedAssetCopied', '', false, false)]
local procedure OnAfterFixedAssetCopied(var FixedAsset2: Record "Fixed Asset"; var FixedAsset: Record "Fixed Asset");
begin
FixedAsset2."Serial No." := '';
FixedAsset2.Modify();
end;
It seems that the event Mohana mentioned is not available in the version you are using.
Mohana,
Am getting an error on OnOnPreReportOnBeforeFA2Insert event. Below is the error.
The event 'OnOnPreReportOnBeforeFA2Insert' is not found in the target
I got what you mean now.
You can use the below subscriber to make it blank.
[EventSubscriber(ObjectType::Report, Report::"Copy Fixed Asset", 'OnOnPreReportOnBeforeFA2Insert', '', false, false)]
local procedure OnOnPreReportOnBeforeFA2Insert(var FixedAsset2: Record "Fixed Asset"; var FixedAsset: Record "Fixed Asset");
begin
FixedAsset2."Serial No." := '';
end;
Do you have a screenshot? what do you mean by leave blank the field for serial?
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,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156