Hide field unless user id is one of x, y, z

SOLVED

There is a field that people should be able to complete when adding a new company, but not able to change / view when on the change menu unless they are one of four people.

We thought an On Change script would work for this and have tried the below, however it does not hide the field (and my user ID isn't in that list).

if (user_userid == "38,27,28,32")
{
crm.fields("comp_agent").show();
}
else
{
crm.fields("comp_agent").hide();
}

Can anyone help?

Thanks
Sarah

Parents
  • 0

    No reason why Pauls version using "User" shouldn't work.... or you could use  CurrentUser

    var userid = CurrentUser.user_userid;
    if (Values("Act")=="201")
    {
    if (!(userid==27 || userid==28 || userid==32 || userid==38))
    {
    Hidden=true;
    }
    }

    if you are still struggling, I would ask your business partner for help.

Reply
  • 0

    No reason why Pauls version using "User" shouldn't work.... or you could use  CurrentUser

    var userid = CurrentUser.user_userid;
    if (Values("Act")=="201")
    {
    if (!(userid==27 || userid==28 || userid==32 || userid==38))
    {
    Hidden=true;
    }
    }

    if you are still struggling, I would ask your business partner for help.

Children