Table fields on form visible/editable based on security role

Hi,

How to make table fields (InventTable fields) visible or editable based on security role in form (EcoResProductDetailesExtended form) ?

Hi,

You can select the “Visible” property of the field in the Grid to make that invisble.

By the below line of code you can hide the field using X++.

CustInvoicetrans_ds.object(fieldNum(CustInvoiceTrans,Overall_qty)).visible(false);

If you want to make it using Security role you have do some customizations.

Regards,

JOhn

Hi,

Or you can try the below lines of code to make it invisible based on the security role.

    SecurityRole        role;
    SecurityUserRole    userRole;
    UserInfo            userInfo;
    
     while select * from role
        exists join userRole        
        where role.RecId == userRole.SecurityRole
        && userRole.User == curUserId()

    if(role)
    {
     // element.design().controlname("Overall_qty").visible(false);
        //CustInvoiceTrans_Overall_qty.visible(false);
        
         CustInvoicetrans_ds.object(fieldNum(CustInvoiceTrans,Overall_qty)).visible(false);
    }

Please mark it as verified if found useful.

Regards,

John

Handling it by using code should be your last option.

Look at the other possibilities. Example - Needed permission property.

docs.microsoft.com/…/security-permissions-properties-for-a-form