Initialising a Date field as part of loading a Status change

Posted by spope-rollbase on 09-Jul-2015 23:20

I have a workflow action for setting a workflow status to completed.

As part of this I set up a custom status change screen for handling this which contains a few related fields.

One of these fields is a "Date Completed" field.

I'd like to initialise the on screen initial value of this field to the current date, but for the life of me I can't see a simple way of doing this.

Any helpful suggestions would be greatly appreciated.

(I don't want to use a trigger, as the user may update the date to something other than the current date.)

Tried using the onload method of the status change page.

Also tried a script element on the same page.

Neither of these worked,  but I suspect I have note done this correctly, and have since removed both.

Posted by Mohammed Siraj on 10-Jul-2015 00:56

This can be achieved via client-side scripts.

As part of the onload event or page script components, execute the following script code:

Example:

$('input[name="InitiationDate"]').val(rbf_formatDate(new Date(),'MM/dd/yyyy'))

Identifiy the Date field control via its integration name. In the example above, Date field integration name is 'InitiationDate'.

Hope this helps.

Posted by spope-rollbase on 14-Jul-2015 18:18

Thank you for the tip!

I used the following in the onload event, and it works a treat!

$('input[name="DateCompleted"]').val("{!#TODAY}")

All Replies

Posted by Mohammed Siraj on 10-Jul-2015 00:56

This can be achieved via client-side scripts.

As part of the onload event or page script components, execute the following script code:

Example:

$('input[name="InitiationDate"]').val(rbf_formatDate(new Date(),'MM/dd/yyyy'))

Identifiy the Date field control via its integration name. In the example above, Date field integration name is 'InitiationDate'.

Hope this helps.

Posted by pvorobie on 10-Jul-2015 12:00

You can use setting "Use current date plus NNN days as default value for updates and status changes", see Field Create/Edit page for Date and Date/Time fields.

Posted by spope-rollbase on 14-Jul-2015 18:18

Thank you for the tip!

I used the following in the onload event, and it works a treat!

$('input[name="DateCompleted"]').val("{!#TODAY}")

This thread is closed