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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Auto Populate Today's Date to a Field Based on a Response in Another Field.

(0) ShareShare
ReportReport
Posted on by 530

Hello.

I am just getting started getting my feet wet with trying some custom programing for CRM 2011 (Hosted).

My first task, simple enough, is to have today's date / time default into a field based on a user clicking 'yes' in another form.

The two fields are new_jobinshop and new_jobinshop_date.

new_jobinshop is a Yes/No Option Set.

new_jobinshop_date is a date/time field.

I'd appreciate any help in getting started with this as it has been some years since I last had to write code.

Thanks

Ed

 

*This post is locked for comments

I have the same question (0)
  • Edward Fishman Profile Picture
    530 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Thanks.

  • Gus Gonzalez Profile Picture
    27,113 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Edward,

    Here is a post with plenty of information regarding javascript code to generate today's date:

    www.w3schools.com/.../js_obj_date.asp

    Good Luck!

  • Edward Fishman Profile Picture
    530 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Jerry:

    It is more for convenience than anything else.   One less step for the user.   Plus, if it auto-filled via a workflow after the record was saved, the user would probably end up filling in the field.  I can't make the field read only as there is the possibility that the user would need to change the date/time.

    Jscript is fine, and was my original intention (sorry for not being clearer).  I just need a starting point with the Jscript.

    Thanks

    Ed

  • Suggested answer
    CRMInnovation.com Profile Picture
    on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Ed,

    The only way to make that happen realtime is by putting jscript code on the field yes/no field to update the date field.

    The previous responses by Gus and me don't apply since that requirement wasn't part of your first post.

    However, I am wondering why the user needs to see the date update while they are in the record. Wouldn't in be sufficient that they know it will be set within about 90 seconds by workflow and then some other process will take over? If not then jscript is the only way to go. A few lines of jscript will do the trick.

    Jerry

  • Edward Fishman Profile Picture
    530 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Jerry:

    But workflow would only kick off when the record is saved/modified.  I need to have the date pre-populate while the user is in the record and selected Yes.

    It is more for convenience than anything else as in the majority of cases the current date/time is going to be the time the job is moved to the shop.

    Thanks

    Ed

  • Suggested answer
    CRMInnovation.com Profile Picture
    on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Ed,

    Set the workflow to run on a field change, then just add a conditional logic to the workflow in the first step to check to see if the option value is set to yes. If so then continue with the next step, otherwise stop.

    The user will still be able to change the date field later on.

    Jerry

  • Edward Fishman Profile Picture
    530 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Just to add -

    I need this to be dynamic as the date needs to be pre-filled based on Yes being selected, but the user still needs to be able to change it if needed.

    Thanks

    Ed

  • Edward Fishman Profile Picture
    530 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    Will this work dynamically or does the user have to save the record in order for the Date/Time to update?

    Thanks

    Ed

  • Suggested answer
    Gus Gonzalez Profile Picture
    27,113 on at
    Re: Auto Populate Today's Date to a Field Based on a Response in Another Field.

    You can achieve this with a workflow.

    The workflow will monitor the Yes/No field and fires up updating the date field with Process -> Execution time.

    Does that make 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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#3
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans