web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Update a User Look up field to the User record running the workflow

(0) ShareShare
ReportReport
Posted on by 334

I have a requirement to create an on demand workflow which will set the user record  that runs a workflow to a user look up field on the entity.

So on the entity Account there is a new field called Approved By,

A simple Workflow called "Approve Account" will just update the Approved By field to the user that ran the work flow.

But am not sure of the Dynamic Value to Pick, Accounts "Modified By" looks like a smart idea but am not sure 

The workflow is also real time and it is also  executed as the user who made changes to the record.

Will appreciate helpful suggestions. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Hi,

     I'm not sure you have access to the current user in the workflow..  You do have access to the "modfiedby", though, so you might use that if you asked the users to approve by using a checkbox on the account entity, for example.. basically, you just need to make sure "modifedby" is set before that workflow starts (which, again,  you could do easily if you asked users to use that kind of checkbox field).

  • lawix10 Profile Picture
    334 on at

    Thanks Alex , I mentioned that the Modified By look up seems to be the closest ,

    But please am not sure of what you suggested, its going to be many  users working on it, so any one could be changing records on it.

    Is this what you are suggesting ? On the entity I will have a new field with data type two options Yes or No and call it Approved Account for example

    So on the workflow, the first step will be to set the field approved account to yes so the record as been modified , then set the approved by field to the account modified by?

    Or its something else, the workflow will only run on demand, so any body can modify the entity without running the workflow

    Regards

  • Chadi Tannous Profile Picture
    1,039 on at

    you have to create a workflow activity and get the current user from there and return it as an output (EntityReference).

    you will be able to use it  on the workflow

  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    If you added a checkbox field to the account entity (might call it "Approved"), you might have a workflow which would be triggered by that field only ("on update" workflow).

    In the workflow, you would do this then:

    Condition: If "Approved" == "YES"

       Update Account: Set Approved By = Modified By

    The workflow won't even start for any other field, so it would only set "approved by" whenever the account is approved through that checkbox field

  • lawix10 Profile Picture
    334 on at

    Thanks Alex , I totally understand this concept and it will work. Except the scope of work sates the workflow must be on demand . Thanks so much.

    Regards.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Well, if you do need a workflow (I think that checkbox would be "ondemand" as well.. it requires a use to set that checkbox, but if your client does want to run it as a workflow), you might tweak the workflow and use the same idea.

    - Add a field ("approved" checkbox)

    - Don't put it on the form

    - Update that field in the workflow first

    - This will set "modifiedby" to the user running the workflow

    Then, you can probably just add a step to copy "modifiedby" to the "approved by" (or you can still have that other workflow that will respond to the change of the approved checkbox)

    And yes, another  option is to create a custom workflow activity that will get you the user reference.

  • lawix10 Profile Picture
    334 on at

    Thanks you really helped a lot.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans