I would like to have a field that will display the current date at any given time, effectively the same as having the TODAY() function in Excel. Is there a way to do that without script?
You could achieve this with a Calculated field.
First create a new field with a Field Type of Calculated
Then click Edit next to Field Type, leave the condition blank and for the action have it as "Set Todays Date to Now()"
Now place the field on your form and when you open the form it will show todays date
Thanks for that.
It appears as if calculated fields don't work in business rules. Is there a way to get today's date without a calculated field?
I would like to use today's date in a business rule that will set as business required another field based on whether a record was created 14 days or prior to today.
Hi Maggie, You can use a Realtime Workflow
Set the Executin Date and Time of workflow and insert it into required field.
- add update record step into workflow
- go into Properties
- add Execution date and Time into Required date Field.
when the workflow runs it inserts the current Date and Time into this field.
I Hope this helps, Kindly tick 'Yes' to verify :)
Best Wishes, Raz
Another option to use script but it will only run when you will open entity form.
What will trigger the workflow to run though? Will I have to run it manually everyday?
I need the field to show the current date when someone opens the record, so this needs to change everyday.
Sean's solution answered your original question!
"It appears as if calculated fields don't work in business rules. Is there a way to get today's date without a calculated field?
I would like to use today's date in a business rule that will set as business required another field based on whether a record was created 14 days or prior to today."
1. Create a simple DateTime field, lets call it new_todaysdate
Save, and publish.
3. In your solutions editor, click 'Form Properties' in the entitiy's form you're working with.
4. In Event List, add the new JS resource.
5. In Event Handlers add the function name SetTodaysDateOnLoad
(Don't add brackets after the function name here)
Save and publish and you have the field with today's date accessible in a business rule.
Make sure this field is invisible in your form, or even make it immutable straight after onload and mutable again after updating with the help of a workflow.
Thank you PaulShore - THIS is what i was looking for!
Where Sean's answer will do what you need it to, it will not however display a date on the form while creating. The calculated field will not calculate until after saving. That goes for workflows as well. The run "Before" option is disabled in real-time workflow.
i'd love to find a way to have a date field on a form that automatically populates with todays date (and can still be changed by the user) without having to save in order to trigger a work flow. The original question does CRM have the equivalent of excel
that it can automatically populate onto a form without saving, just be there as the form opens?
Just hit upon this myself and this solution worked well for me. Thanks Sean Kelly.
Thank you Paul Really Helpful!
I'd just set the date to be the ModifiedOn using a Set Value Action. Since the Business Rule will be invoked manually this worked in my scenario.
Business Applications communities