Transition Button Show/Hide based on Username Problem

0
Hi,

I need to show my 2 transition button Approve or Reject based on if the currently logged in user is my Manager and it should be hidden for everyone

Please can you tell me how to do that via Javascript or any other method

Accepted Answer

Thursday, September 06 2018, 08:56 AM - #Permalink
0
You may also be able to create a Rule and apply it to the transitions. This approach works well if you are comparing the current user to the value of a field in the record.
The reply is currently minimized Show
Responses (3)
  • Accepted Answer

    Thursday, September 06 2018, 03:59 AM - #Permalink
    0
    var userName = "$CURRENTUSER()";

    Use this script on Javascript to get the username

    It is from the KB.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 06 2018, 07:07 PM - #Permalink
    0
    Note:
    I may be entirely off-base. Neither of the previous 2 replies seemed related to the "my manager" aspect.

    This suggestion depends on what you mean by "my" manager and how "me" relates to the current item being viewed. I'm assuming that "me" means "Submitter" and "my manager" means "Submitter's manager".


    You'll need to use the CONTACTS table and have a USER type field for MANAGER in there. The item's primary table will need a CONTACT field. This will automatically be set to the CONTACT record related to the SUBMITTER.
    In the item's primary table add a sub-relational field called "Submitter's Manager" using the CONTACT relational field where sub-field is the "MANAGER" field within CONTACTS table.

    You then have at least a couple options:
    1. Use the "Submitter's Manager" field in a Rule for the Transition as per Garry Womack.
    2. Add custom transition buttons for Approve and Reject to the state form. Use a form action to hide the custom transition buttons if "Submitter's Manager" is Current User (add that field to the form too).
    Like
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, September 06 2018, 07:16 PM - #Permalink
    0
    Yes I Tried hiding transition button based on manager as my current user on state form action but they are not hiding so I tried rule based transition in workflow creating one more user as (current user) and comparing it with manager field so transition will only occur if my manager is equal to (current user) and it worked thanks
    The reply is currently minimized Show
Your Reply

Recent Tweets

RT @TrainingsEdu: Potřebujete získat znalosti o produktu Micro Focus UCMDB, porozumět základním pojmům a aplikacím? Na kurzu Universal CMDB…

by Micro Focus Support