I want to display the current date in the form. So whenever you create new process instance, it should fetch the current date and display in the form.
Issue: I am able to get and display current date but that code is running everytime I open the form and display that date. (If I create new process instance today, today's date is displaying in the form but if I open form tomorrow then it will display tomorrow date)
How can I make sure that it should only display the date when the form is created for particular process instance?
Code to get current date:
var myDate = scope.findFormFieldWithId(scope.allFormFields, 'myDate');
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
myDate.value = today;
Then I am using "Display text" form field to display 'myDate'
Thanks in advance.