Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

Posted on by 330

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

  • lawix10 Profile Picture
    lawix10 330 on at
    RE: Update a User Look up field to the User record running the workflow

    Thanks you really helped a lot.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Update a User Look up field to the User record running the workflow

    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
    lawix10 330 on at
    RE: Update a User Look up field to the User record running the workflow

    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.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Update a User Look up field to the User record running the workflow

    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

  • Chadi Tannous Profile Picture
    Chadi Tannous 1,037 on at
    RE: Update a User Look up field to the User record running the workflow

    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

  • lawix10 Profile Picture
    lawix10 330 on at
    RE: Update a User Look up field to the User record running the workflow

    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

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Update a User Look up field to the User record running the workflow

    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).

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans