Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to auto populate the current logged in user and modified date...

Posted on by 2,645

Hello,

I need to auto populate 2 fields.  Field B should be populated with the current user logged into CRM.  Field C should be auto populated with the current Date.

Both Field B and C should only be populated once Field A is either answered Yes or No.  If it is blank the 2 fields shouldn't be populated.

Any help is appreciated.

*This post is locked for comments

  • ARod Profile Picture
    ARod 5 on at
    RE: How to auto populate the current logged in user and modified date...

    Is there any way to do this without code in a business rule?  

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to auto populate the current logged in user and modified date...

    I was able to get the workflow working based on what you guys said. I used the modified on and modified by to be placed into my 2 fields that I created.  The issue that I was having is that I just wasn't giving the workflow time to run before going back into the record as I didn't see the information being populated.  When I gave it a second or just hit F5, the information updated correctly.

    Thank you both.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to auto populate the current logged in user and modified date...

    Oh, I don't think it's a "workflow approach" issue - there is something else. I don't know what it is, but, like I said above, workflow works fine in my environment (365 online) with both "create" and "update".

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to auto populate the current logged in user and modified date...

    So, based on this...

    I think that you have three choices:

    1- Go back to the JavaScript route, and add the onChange event to the Approved field.

    2- Try to see if you can get this working using Business Rules. Set a rule for value of Yes/No

    3- If there are any fields on the form that have to be populated, before the approved field does, you can trigger a save event. This will cause the workflow that you have now work on new records, since they become existing.

    Do any of these choices work for you?

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to auto populate the current logged in user and modified date...

    Could be.. I think there was an attempt with oncreate just a few posts above, though ("I did though try and check the "Record is created" under the Start when:, but that didn't work either)

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to auto populate the current logged in user and modified date...

    That's exactly what I meant.

    I think that was is happening is that he is making the change to the attribute before the record is saved, and expecting the onChange event to execute.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to auto populate the current logged in user and modified date...

    Hi Aric.. Should be something else there.. You can register a real-time workflow oncreate and it will run just fine (onchange won't run, though, that's correct.. same thing with the create/update plugins)

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to auto populate the current logged in user and modified date...

    I might be wrong regarding this, but AFAIK real time workflow will not execute on change on a record that has not yet been saved (new record). Alex?

    In that case, you can force a save (JavaScript) before the user clicks on the Approved field, or the other option is use JavaScript on the change event as we discussed earlier...

    There might be another option of using Business Rules on the change the approved field.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: How to auto populate the current logged in user and modified date...

    Well.. it does work for me on create - just tried.

    As for not doing that when there is no data in the field, just add a condition and stop the workflow when the field is empty. Or create two workflows if needed - one for oncreate, another one of onupdate.. It depends on what other logic you want to have there (for example, what if somebody removes any value from that field? Do you still want to update the date/user field when that happens? Add conditions to the workflow as needed)

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to auto populate the current logged in user and modified date...

    I don't want these fields populated when the record is created if the Approved field isn't changed.  I did though try and check the "Record is created" under the Start when:, but that didn't work either.

    So really the 2 fields need to update only when the Approved field has been changed.  If someone comes into the record and changes a different record, then those 2 fields shouldn't get updated.  Hope that makes sense.

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