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
2022 Release Wave 2Check out the latest updates and new features of Dynamics 365 released from October 2022 through March 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Hi All,I have a request to have one page that displays fields based on users' opened company.Page ID 30 - Item Card
field number: 50000 - ABC -> has to be displayed for user that is logged into the Company A, while user that is logged into the company B must not see that field.
So far, I have managed to write the code to check for current opened company of user, but I am stucked on displaying fields based on users' currently opened (logged) company.
CU1 - Application Managementlocal procedure=isCountryB
On the Page ID 30 - Item CardGlobal Variable=AppMgt | Codeunit | Application Management
CODE:OnOpenPageIF AppMgt.IsCountryB THEN ABC :=TRUE; -> this does not work as expected, field is displayed anyway to any user that opens any company
Do you have any idea on best possible solution? I once created a copy of the page on company (original company) and then added it into the menu of company (B - additional company) for which this page is intended to be used, so that user would open that page under the (B - additional) company only, and if same user would open different (original) company, then it would have only an original page. Thanks, Damjan
Hardcoding the company is something I dislike (brrr).
Given these constraint and if you do not want to spend time in considering to create a visibility management codeunit, I guess that you could create different groups in the card page and in each group you add the fields that you want to display per company.
Then you use the same boolean value to trigger visible true/false in these groups.
I guess you have thought of just using the system variable COMPANYNAME? So on the page set propery Visible to MyIsVisible, which is a new Boolean Variable, and then set it on Init of the page:
MyIsVisible := COMPANYNAME = 'ABC';
I have to create "hardcoded company" because I will need to write code to be valid only for company B, or C, or A, not not for all companies inside the database.
I do not know of any other solution, then that one.
And since I will have to do this, I wanted to use also this to display or hide fields based on currently opened company of the user.
If visibility management codeunit is something that would ease my work and ease the support I would be glad to use it, but I do not know it. I have always used so called "hardcoded company" as you are referring it.
this is one possible solution, not bad either.
I just don't like that company is hardcoded.
I sorted this out with combination of Lars suggestion and my own.
Page ID 30
IF AppMgt.IsCountryB THEN
MyIsVisible := TRUE;
This checks currently opened company of user and displays field based on condition of boolean MyIsVisble and that is added on property: Visible of field on Page ID 30.
This AppMgt.IsCountryB will now be also used to apply the code as local specific of the country. (If country USA do this, else do that).
On T72 - Company information new field is added - Country as an option data type where all countries are inserted that represents country where company is registered.
I will not write core code that applies to all countries (companies) and local specific code that will be applied only to the users' currently opened company.
Business Applications communities