CRM 2011 Dialogs do not provide any easy way to access the currently logged in user’s information.
By creating a new instance of an entity (I create a special entity), the owner field will contain the currently logged in user.
The steps I follow:
- Log into CRM and create a new entity, call it new_CurrentDialogUser. You do not have to add any new fields.
- Open your existing dialog for editing.
- From the Dialog editor, the first thing to do is create an instance of new_CurrentDialogUser.
- Create a new stage, positioned at the very beginning of the dialog.
- Click ‘Add Step’ and select ‘Create Record’.
- Choose the type to be new_CurrentDialogUser.
- Click on properties. Notice the owner field is presented. Do not populate this field. Instead, when the ‘Create Record’ step executes, it will default the owner to the currently logged in user.
- Once the ‘Create Record’ steps executes in your dialog, you have the ability to reference this step from throughout the rest of your dialog, just as if you were referencing the current record that is related to your dialog.
- In my case, I use an ‘Assign Value’ step to store the owner of the newly created new_ CurrentDialogUser to a local variable, called CurrentUser.
- Finally, once my am done using the current user, I perform an ‘UpdateStatus’ step, as a means to
deactivate the dynamically created new_CurrentDialogUser instance.
- At this point, you can adopt Gonzalo Ruiz’s custom activity workflow, which exposes a ‘delete’ record step. The deleting can performed as separate workflow.