Order Management

Get Involved. Join the Conversation.

Topic

    Satrajit Biswas
    How to find current user role name using groovy script in...
    Topic posted November 11, 2019 by Satrajit Biswas, tagged Order Management, SCM, Supply Chain Orchestration 
    23 Views, 2 Comments
    Title:
    How to find current user role name using groovy script in Order Management Extensions
    Summary:
    How to find current user role name using groovy script in Order Management Extensions
    Content:

    Hello All,

     

    I'm trying to fetch the current user role in Order Management extensions (on Save Button) using groovy script so that I can perform specific set of actions. I tried below code but getting error. Can anyone pleasehelp me on this?

     

    Code:

    def secCtx = adf.context.getSecurityContext()

    if (secCtx.isUserInRole('Order Manager')) {

    return true

    }

    else {

      return false

    }

     

    Error: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: groovy.lang.MissingPropertyException, msg=No such property: adf for class: ExID300000196161920__19. (DOO-2685874)

    Version:
    19C (11.13.19.07.0)

    Comment

     

    • Venkatesh Malapati

      Please refer to Implement Security section which has an example on how to check if the user has a specific role granted or not through an extension.

    • Ramadoss Vinayagam

      Hi,

      You can use the following syntax which has worked in our case

      if (context.isUserInRole('XXX_SO_ORDER_MANAGEMENT')) return;

      This will validate if the logged in user is having the role (you need to pass the role code.

      Try and let me know if it works.

      Regards.

      Ramadoss