Question
How to get the current date into a field value?
Answer
- Create a field of a Date type in the Document Definition:
- Switch to the Rules tab and add a new script rule.
- In the rule settings add the newly created field and make sure the Read Only option is disabled for the field.
- Use the following sample script as a reference:
using System;
using System.Globalization;
DateTime currentDate = DateTime.Now;
Context.Field("Field").Value = currentDate.ToString(); - Save and publish the Document Definition.
Comments
0 comments
Please sign in to leave a comment.