Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
I need some help with the following.
I'm trying to make a field uneditable for some certain users on the Purchase Order. And my process was this, I created a option field Post P.O on the User Setup Table with two options (Confirm and Deny), put it on the User Setup Page.
Then I created a boolean as a global variable on the P.O page, set it in the editable property for the field.
The following code is what I put in the Onaftergetcurrecord trigger
IF UserSetup."Post P.O"=UserSetup."Post P.O"::Confirm THEN Fielditable:=TRUE;
IF UserSetup."Post P.O"=UserSetup."Post P.O"::Deny THEN Fielditable:=FALSE;
Yet it doesn't seem to work if either option is selected on the User Setup Page.
Any help please?
You don't need to write the code on Onaftergetcurrecord trigger. Just write the code on additional field which you have created on PO page.
Write code on field - OnValidate() trigger.
please see my below example code
'Your New field'- OnValidate()
usersetup.SETRANGE("User ID", USERID);
IF usersetup.FINDFIRST THEN BEGIN
IF usersetup."Your New field"<>TRUE THEN BEGIN
usersetup.TESTFIELD("Your New field",TRUE);
ERROR('You do not have permission to change the field')
here usersetup is a variable (table 91)
I hope it will help you to resolve your query.
Thank you so much.
How about if I wanted to use a similar control for the post button?
Also, doesn't this line below mean I have to specify the user ID in code?
Yes try on On Validate Trigger and cross check how it behaves.
you don't need to hard code. It will work depend on permission which you have provided in user setup.
Thank you for your help.
I do have one more question.
How about if I wanted to do something similar with a button on the page or the purchase lines?
yes of course, you can do same as in purchase line.
Don't forget to help the community by verifying the answer or at least like the suggestion if it did help in any way. It will let others know that the topic has verified answer and was beneficial to you.
Business Applications communities