Current User in Dialogs and Workflows

If you need to get the user running a dialog or an on-demand workflow you might be surprised that this is not available as a dynamic value. However, if your dialog or on-demand workflow creates or modifies a record, then you can get the current user.
For example, you have a dialog that creates a phone call and you need to set the sender of the phone call to the current user.

  1. In the dialog editor, add a Create Phone Call record step.
  2. Click Set Properties.
  3. Update the record as required, but leave Sender blank.
  4. Add an Update Record step and reference the Phone Call created in the previous step.
  5. Click Set Properties.
  6. In the Update Phone Call window:
    1. Click in Sender.
    2. In the Form Assistant in Look For, under Local Values, select Create(Phone Call).
    3. In the box below Look for, select Created By.

Since dialogs run in the context of the user that starts the dialog, the phone call is created by the current user. If the dialog does not create a record but modifies one, then you can get the current user from the Modified By field of the record.
This also works for on-demand workflows but not automatic workflows. Automatic workflows run in the context of the person that created the workflow.

Review: