web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to filter the Account Schedule page 103

(0) ShareShare
ReportReport
Posted on by 952

The requirement is to restrict access to account schedule whereby users will be granted access to specific account schedule.

Hence, a new table (Acc Shedule By User) was designed with the following fields

acc-schedule-by-user.PNG

Now, we want to filter the Page 103 - Account Schedule Names so that only the list where the user have accessed is displayed.

We have put the following code on both onOpenPage and OnAfterGetrecord but unfortunately no filtering is being done:

 

IF AccSchedulebyUser."Acc. Schedule Name" <>'' THEN

AccSchedulebyUser.SETRANGE(AccSchedulebyUser."User ID",USERID);
SETRANGE(Name, AccSchedulebyUser."Acc. Schedule Name")

acc-schedule-by-user-code.PNG

Would you please inform how the filtering can be done?  Thanks for you input

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at

    Hi Mosaheb,

    I rewrote the code and this will help. Please note that this isn't the full implementation, but a skeleton.

    OnAfterGetRecord -- ()
    CLEAR(filter); AccUserSched.SETRANGE(AccUserSched."User ID", USERID); IF AccUserSched.FINDSET THEN BEGIN REPEAT IF filter = '' THEN filter := AccUserSched."Acc. Sched. Name" ELSE filter += '|' + AccUserSched."Acc. Sched. Name"; UNTIL AccUserSched.NEXT = 0 END; SETFILTER(Name, filter);

    filter is a Text variable in here.

  • Verified answer
    Community Member Profile Picture
    on at

    You need to write the code in Page 103 > OnOpenPage. Also, use FilterGroups to have correct security. 

    OnOpenPage()

    CLEAR(AccSchfilter);

    AccSchedulebyUser.SETRANGE(AccUserSched."User ID", USERID);

    IF AccSchedulebyUser.FINDSET THEN

    BEGIN

     REPEAT

       IF AccSchfilter = '' THEN

         AccSchfilter := AccSchedulebyUser."Acc. Sched. Name"

       ELSE

         AccSchfilter += '|' + AccSchedulebyUser."Acc. Sched. Name";

     UNTIL AccSchedulebyUser.NEXT = 0

    END;

    FILTERGROUP(2);

    SETFILTER(Name, AccSchfilter);

    FILTERGROUP(0);

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans