3 Replies Latest reply on Mar 21, 2017 1:55 PM by ttippett

    "Is NOT Raise User" Precondition

    ttippett Rookie

      Hi all,

       

      I'm looking to add a precondition to an action instance on my process.  The objective is to prevent the Raise User from using this action, but allowing analysts to use it.  I cannot solve this via taking away raise user privileges for that action, as the raise user will need to use the action at a later stage in the process.

       

      Is it possible to create this precondition via a "Standard" condition type?  Or will I have to utilize a calculation?  If a calculation is needed, what is the simplest way of writing it?

       

      I am on version 2016.3.

       

      Thanks,
      Tyler

        • 1. Re: "Is NOT Raise User" Precondition
          Julian Wigman Master

          A standard condition should do it.

           

          Then just add as a precondition in the process.

           

          Ju

          1 of 1 people found this helpful
          • 2. Re: "Is NOT Raise User" Precondition
            Julian Wigman Master

            ..but.

             

            If the action you are proposing IS available to end users as well then you'll need to switch to a calculated condition as you'll need to check on the state of two variables.

             

            That calculation IMHO will look something like this (I've created as Request Condition but similar if another Business Object) with the comparison being equal to true.

             

            import System
            static def GetAttributeValue(Request):

                    // Get Current User and their Type
                    CurrentUser = Request.GetCurrentUserName()
                    UserName = Request.GetObjectByAttribute("System.User","Name",CurrentUser)
                   
                    // If they are an Analyst that is OK
                    if UserName.UserType.Name == 'Analyst':
                           return true
                          
                    // Or test if the Raise User IS NOT the Current User      
                    elif Request.RaiseUser != null and Request.RaiseUser != CurrentUser:
                           return true
                   
                    // Else they are not an Analyst and are the Raise User!
                    return false

            1 of 1 people found this helpful
            • 3. Re: "Is NOT Raise User" Precondition
              ttippett Rookie

              Thank you!  I tested both methods and both worked.  I think I will end up going with the calculation that ensures the current user is an analyst.  For anyone else reading this, my final calculation came out to be:

               

              import System

              static def GetAttributeValue(Request):

                  Value = 'false'

                  CurrentUser = Request.GetCurrentUserName()

                  UserName = Request.GetObjectByAttribute("System.User","Name",CurrentUser)

                  if UserName.UserType.Name == 'Analyst':

                      return true

                  return Value

               

               

              ...with

               

              Condition: Equals

              Value Type: Specific Value

              Value: True

               

              Thanks again!