Make changes to a form action pane tabs when you log in as a different user

Hello All,

I want to hide certain ActionPaneTabs of a particular form only when I login as a different user or users of that particular user group.

Please let me know how and where should I write the X++ code to implement this.

Please let me know if you have any questions for me

Thanks in advance.

Regards,

Shankar Iyer :slight_smile:

It sounds more like something you should do through security, instead of writing code. Is there any reason why it can’t be done through security?

What security feature i.e. entry points will help me to hide ActionPaneTabs of the VendTable form.

I already tried to added \Security\Roles\Privileges\VendTableView but I still need to hide some more actionpanetabs of this form

Kindly advice how I can achieve this

If the user doesn’t have access to any button on the tab, the tab shouldn’t be displayed at all.

How to implement that for just for a particular user?
Do I need to write some X++ code or make changes to any properties of the form or add some entry points to the privilege??

Kindly advice

Hi Shankar Iyer,
You can do your requirement by using security, and you can perform it by using the following x++ code…(ax2009)

select firstOnly UserGroupList
Where UserGroupList.userId == curuserid()
&& UserGroupList.groupId == ‘STGroup-01’;
if(UserGroupList.RecId!=0)
{
postJournal.visible(true);
postJournal.enabled(true);
}
else
{
postJournal.visible(false);
postJournal.enabled(false);
}

You surely can assign a certain role to a single user only, if the user should have unique permissions.

Hello Arvind,
I tried this code but we don’t have proper UserGroup setup so this idea won’t work for me.

Is there a way we can find a linkage between sysprofiles and user Tables

When you go system administration > User Profiles

we have two tabs overview and Users… I want to know this linkage works ??

Does anyone has any idea about this

Please advice

Thanks,
Shankar Iyer :slight_smile:

Hi Shankar,
If you check on form, you can see that in the code, there is a table named “SysUserProfiles” is used.
You can check the code and accordingly use that table.
Regarding your actual requirement, I believe, you should handle the case with security permissions, rather than through code.

Hello All,
I found the solution for this requirement
I wrote the code in the init method of the form without making any changes to the security features of AX2012

select role
where role.Name == “Your role”;

select * from userRole
where userRole.SecurityRole == role.RecId &&
userRole.User == curUserId();
if(userRole.RecId)
{
General.visible(false);
General.enabled(false);
}
else
{
General.visible(true);
General.enabled(true);
}

Thanks everyone for your responses

Regards,
Shankar Iyer :slight_smile: