Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Copy Fixed Asset AL issue.

Posted on by

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.?

  • Romryan Profile Picture
    Romryan on at
    RE: Copy Fixed Asset AL issue.

    Mohana,

    Thanks for enlightenment I have replaced OnOnPreReportOnBeforeFA2Insert with OnAfterFixedAssetCopied and it has worked. I have also added 

    FixedAsset2.Modify().
    I am closing this case.
     
  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 Season 2 on at
    RE: Copy Fixed Asset AL issue.

    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;

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 on at
    RE: Copy Fixed Asset AL issue.

    It seems that the event Mohana mentioned is not available in the version you are using.

    pastedimage1683880977748v1.png

    pastedimage1683881233894v2.png

  • Romryan Profile Picture
    Romryan on at
    RE: Copy Fixed Asset AL issue.

    Mohana,

    Am getting an error on OnOnPreReportOnBeforeFA2Insert event. Below is the error.

    The event 'OnOnPreReportOnBeforeFA2Insert' is not found in the target

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 Season 2 on at
    RE: Copy Fixed Asset AL issue.

    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;

  • Mohana Yadav Profile Picture
    Mohana Yadav 59,125 Super User 2024 Season 2 on at
    RE: Copy Fixed Asset AL issue.

    Do you have a screenshot? what do you mean by leave blank the field for serial?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans