Share via


Evaluating the Current User

The following example describes a CheckUser function, which determines the user who initiated a state change. The function uses two common string functions, instr and Left, to capture the user's name.

To use this example, create the CheckUser function in the Script Editor.

Example Script

'// -----------------------------------------------------------------------------------
'// Name      : CheckUser
'// Purpose   : checks the sender of the WorkflowSession object
'// Prereq    : none
'// Inputs    : strUSer user to be checked
'// Return    : Returns TRUE if the user indicated is the sender 
'// -----------------------------------------------------------------------------------
Function CheckUser (strUser)
  User =  left(workflowsession.sender,instr(workflowsession.sender,"@")-1)
  If User <> strUser then 
      checkuser = FALSE
  else
      checkuser = TRUE
  end if
end function

See Also

Scripting in the Workflow Designer for Exchange Server | Script Examples for Exchange Server | Creating Script Procedures