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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Disabling some options

(0) ShareShare
ReportReport
Posted on by 700

Hi All,

I have to disable Attachments, Entitlements, Employment Details and Job Details options from the attached screenshots, before a new employee is created.

Please suggest ways to achieve it, as soon as possible.

Any help would be greatly appreciated.

PleaseEnableDisable.png provide detailed description.

Thanks!

Categories:
  • Suggested answer
    Peter Zentner Profile Picture
    390 on at

    If you mean that you want to remove those actions from the menu, it depends if you want to do that only for you as the user or for everyone in the tenant.

    You can use personalization to do that for only your user: User Personalization

    You can also design the page to remove the actions for everyone in the tenant: In Client designer

  • Dynamics 365 Business Central Profile Picture
    700 on at

    I don't want to remove those actions, just need to disable them till a new employee is created. After creation of a new Employee, those options should be enabled.

    And this functionality needs to be implemented for all users, except the admin.

  • Peter Zentner Profile Picture
    390 on at

    The actions are disabled by default when there is no record created (except attachments).

    employee.jpg

    If this is not enough and you need to have those disabled until certain fields are filled out (aka, the employee record is created and "valid"), you will have to create an app that extends the page "Employee Card". You then modify those actions and add "Enabled = ValidRecord" where "ValidRecord" is a global Boolean variable. In the OnAfterGetCurrRecord trigger, you can add code that validates, if all fields are filled out or the user is an "Admin" and then sets that variable properly. You should also call this code in the OnValidate trigger from fields that you need to have filled out, before the employee is valid.

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Can you please provide the code in OnAfterGetCurrRecord trigger

  • Verified answer
    Peter Zentner Profile Picture
    390 on at

    That depends on what fields you deem to be required. You would always have to use an if-statement for each field that needs to be filled out. For instance, you can do:

    if (Field1 = '') then

      ValidRecord := false;

    and repeat that for each field.

    Or you can do:

    ValidRecord := not ((Field1 = '') or (Field2 = '') or …);

    And then, you just have to also check, if the current user is an admin (depends on how you define an admin) and if the user is an admin, just set it to ValidRecord := true and do not do all the field tests.

    If you know how to develop in AL, those statements are fairly simple to complete or customize to your liking.

  • Dynamics 365 Business Central Profile Picture
    700 on at

    If you don't mind, can I please ask you to design the complete page extension to meet the desired requirement. Actually, I am very new to AL Language. Just provide the code to disable actions until a new user is created.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans