Epicor 10 Customization: Hiding Screen Tabs

Hi,

I’m just wondering if there is way to hide screen tabs for certain users / groups only and not for all users.

Thank you.

Here is a good starting point

3 Likes

Hi Dan,

Thank you for showing me the link. I kind of got it to work, but I’m having some issues. I want to hide the panel for all groups except for group code “S0006”. I’m not sure what I’m doing wrong, but the panel is not hidden for any user group except for SecurityMgr.

This is the code I used.

// **************************************************
// Custom code for POEntryForm
// Created: 3/19/2019 10:13:08 PM
// **************************************************

extern alias Erp_Adapters_PO;
extern alias Erp_Adapters_UserFile;

extern alias Erp_Contracts_BO_Vendor;
extern alias Erp_Contracts_BO_Company;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_VendorPPSearch;
extern alias Erp_Contracts_BO_VendCntSearch;
extern alias Erp_Contracts_BO_PO;
extern alias Erp_Contracts_BO_MiscShip;
extern alias Erp_Contracts_BO_Receipt;
extern alias Erp_Contracts_BO_Plant;
extern alias Erp_Contracts_BO_JobEntry;
extern alias Erp_Contracts_BO_JobMtlSearch;
extern alias Erp_Contracts_BO_UserFile;


using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using System.Linq;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void POEntryForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
	      HideSalesPersonPanel();
	}

	private void HideSalesPersonPanel()
		{
			Ice.Core.Session userSession = (Ice.Core.Session)oTrans.Session; 
		if (!GetUserByID(userSession.UserID))
        {            
			
			Erp.UI.App.POEntry.SummaryPanel summaryPanel1 = ((Erp.UI.App.POEntry.SummaryPanel)csm.GetNativeControlReference("f9b30004-68f8-40c6-b7c5-f236e08bfdd7"));
			summaryPanel1.Visible = false;
		
        }
	}

	
	private bool GetUserByID(string dcdUserID)
{
    bool isUserAccess = false;
	string SecGrps = "S0006";
    try
    {
        UserFileAdapter adapterUserFile = new UserFileAdapter(this.oTrans);
        adapterUserFile.BOConnect();
        bool result = adapterUserFile.GetByID(dcdUserID);
        if (result)
        {
            Erp.BO.UserFileDataSet.UserFileDataTable userDataTable = adapterUserFile.UserFileData.UserFile;
            if (SecGrps.Any(Convert.ToString(userDataTable.Rows[0]["GroupList"]).Contains))
				isUserAccess = true;
        }
        adapterUserFile.Dispose();
    }
    catch (System.Exception ex)
    {
        ExceptionBox.Show(ex);
    }
    return isUserAccess;
}
}

Thanks

Hi Dan,

Thank you for your help. The code actually worked, I’m really not sure what I was doing wrong yesterday. :blush:

~M

1 Like