Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Making a procedure cetralized

Posted on by 22

Hello All,

I have the below procedure and it needs to be called from Customer Card, Contact Card and Vendor Card. Currently it is written for all the 3 pages separately. Requirement is to make it centralized and only function call should be there in the corresponding page. How can I modify it, please suggest !!

Many thanks....

Below is the code :--

procedure RightToAccessExportDataXML(Rec: Record Customer)
    var
        GDPRSpecificHierarchyTypeRec: Record "GDPRSpecificHierarchyType";
        GDPRSpecificHierarchyRec: Record "GDPR Specific Hierarchy";
        GDPRSetupRec: Record "GDPR Setup";
        GDPRSpecificHierarchyTypes: Page "GDPR Specific Hierarchies";
        GDPRRightToAccess: Codeunit "GDPR Functions";
    begin
        GDPRSetupRec.Get();
        if GDPRSetupRec."Open Hierarchy List" then begin
            GDPRSpecificHierarchyTypeRec.FilterGroup(2);
            GDPRSpecificHierarchyTypeRec.SetRange("Data Subject Group", GDPRSpecificHierarchyTypeRec."Data Subject Group"::Customer);
            GDPRSpecificHierarchyTypeRec.FilterGroup(0);
            GDPRSpecificHierarchyTypes.SetRecord(GDPRSpecificHierarchyTypeRec);
            GDPRSpecificHierarchyTypes.SetTableView(GDPRSpecificHierarchyTypeRec);
            GDPRSpecificHierarchyTypes.LookupMode(true);
            GDPRSpecificHierarchyTypes.Editable(false);
            if (GDPRSpecificHierarchyTypes.RunModal = ACTION::LookupOKthen begin
                GDPRSpecificHierarchyTypes.GetRecord(GDPRSpecificHierarchyTypeRec);
                GDPRSpecificHierarchyRec.SetRange("Parent Entry No.", 0);
                GDPRSpecificHierarchyRec.SetRange("Hierarchy Type Code", GDPRSpecificHierarchyTypeRec.Code);
                GDPRSpecificHierarchyRec.FindFirst();
                GDPRRightToAccess.AccessExportSpecificHierarchy(Rec."No.", GDPRSpecificHierarchyRec."Entry No.", GDPRSpecificHierarchyTypeRec.Code);
            end;
        end else
            GDPRRightToAccess.AccessDefaultCustomerData(Rec."No.");
    end;
  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: Making a procedure cetralized

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

  • Praveen A Profile Picture
    Praveen A 22 on at
    RE: Making a procedure cetralized

    Could anyone please help !

  • Praveen A Profile Picture
    Praveen A 22 on at
    RE: Making a procedure cetralized

    Actually I don't have an idea to use variant, so could you please let me know the changes I could do here !

  • Praveen A Profile Picture
    Praveen A 22 on at
    RE: Making a procedure cetralized

    Yes, I tried that---but how to handle the below setrange statements :

    GDPRSpecificHierarchyRec.SetRange("Hierarchy Type Code", GDPRSpecificHierarchyTypeRec.Code);

                   GDPRSpecificHierarchyRec.FindFirst();

                   GDPRRightToAccess.AccessExportSpecificHierarchy(Rec."No.", GDPRSpecificHierarchyRec."Entry No.", GDPRSpecificHierarchyTypeRec.Code);

               end;

           end else

               GDPRRightToAccess.AccessDefaultCustomerData(Rec."No.");

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Making a procedure cetralized

    why cant you use a variant Parameter instead of Record?

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans