Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How do I put a timestamp in a form field in a business process?

Avatar

Former Community Member

At a specific step in the process, when a user approves a form, I would like to put their name and a timestamp in a text field that is locked.  I think there are some different ways to do this, but each has their own issues.

Javascript in form:

I could do this via javascript before the form is submitted, but how do I know which step in the process we are in?

Business Process:

I don't think I can directly access the form from the process.  I can read from the form, but cannot set values, correct?

Custom Render Process:

I have a custom render process but I would need to extract all the data from the form, merge with the xml for the new field, then merge back in with the document.  Not sure how to do this.

Any ideas on what the best way to handle this would be?

Thanks

3 Replies

Avatar

Level 2

Hi,

You can use the executeScript component to set the timestamp in the form or varible. Mention below is an example to get the timestamp in dd/MM/yyyy format.

java.text.DateFormat dateFormat = new java.text.SimpleDateFormat(
                "dd/MM/yyyy");
java.util.Date date = new java.util.Date();
String datetime = dateFormat.format(date);
System.out.println("Current Date Time : " + datetime);
patExecContext.setProcessDataStringValue("xpath of the form field or variable", datetime);

Regards,

Waqas

Avatar

Former Community Member

Hi Waqas,

Thanks for the reply.  I did a little research on the ExecuteScript in the help files and it mentioned that I could also use the set value.  I tried using the set value to grab the user's name and entered that into the field.  It worked.  I had thought previously that it would not work for some reason.  But it works now!  I will now take a look at your sample script to grab the timestamp, concat that with the user name and enter into the field.  THANKS!!

Avatar

Former Community Member

Hi LiveCycle BPM Developer,

I am working on the form that requires a task that is similar to your form which catch the username and timestamp and need help on this too. Have you got all work as you expected? If so, would you please post the sample form to share as well. Thanks much in advance.

Han Dao