Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Adding a memo or comment to a form

Avatar

Level 4

I have a form that is 2 pages in. This form is part of a workflow, in other words, 4 or 5 people end up filling it out beofre it is complete. My question is, is there a way I can add a memo or a comment to the form so the next user will know what the last thing changed on the form was or is there a better way for me to do this?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Bit of a rush job / work-around.

Here is the example with an additional date field (you can hide this). The date is calculated once at docReady. Then the script in the exit events is changed to concat the object caption and the current date into the log.

I would be inclined to make the log visibility set to screen only, so that it doesn't print.

Hope that helps,

Niall

View solution in original post

5 Replies

Avatar

Level 10

Hi,

Because your form is not very lengthy (and hopefully it does not have a lot of objects, you could try the following in the exit event of every object. This is FormCalc.

var oObject = $.caption.value.#text

var vDate = Date()

var oDate = Num2Date(vDate, "DD/MM/YYYY")

var vTime = Time()

var oTime = Num2Time(vTime, "HH:MM")

updateNotice = concat(oObject, " was last updated on the ", oDate, " at ", oTime, ".")

This will fire every time a user exists an object and will update the "updateNotice" textfield. Now in this state it is not 100% helpful, because it fires when the field loses focus, even if the field has not been changed or if the field is null. I wouldn't put the script in the change event, because this will fire at every keystroke.
One way over this is to look at the rawValue of each object on enter and then test the rawValue on exit and if it is different then fire the script above. Set up a global variable in the File/Form Properties variable tab "vOriginal".
Then in the enter event of all objects have the following FormCalc :
vOriginal.value = $ 
The exit event in all objects would look like this
if (vOriginal.value <> $) then
     var oObject = $.caption.value.#text
     var vDate = Date()
     var oDate = Num2Date(vDate, "DD/MM/YYYY")
     var vTime = Time()
     var oTime = Num2Time(vTime, "HH:MM")
     updateNotice = concat(oObject, " was last updated on the ", oDate, " at ", oTime, ".")
endif
Havn't test the if statement but it should be close to working.
Good luck,
Niall

Avatar

Level 4

Still having problems with this one. I can't seem to get it to work. If I could get the sticky note to stay on the form permentaly, this would work for what I need it to do. I just need something simple to list the changes made on the form so the next user who fills it out will see who & what was changed last.

Avatar

Level 10

OK,

Here is an example, which hopefully will give you some ideas.

If you want to record "who" has made the changes then you will need a trusted function (in a folder level javascript file that will need to be installed on all of the users' computers), as accessing the users' login details/name is privileged.

Hope that helps,

Niall

Avatar

Level 4

This looks good...I think I can make this work....is there any way I could add the date it was changed to the existing code?

Avatar

Correct answer by
Level 10

Hi,

Bit of a rush job / work-around.

Here is the example with an additional date field (you can hide this). The date is calculated once at docReady. Then the script in the exit events is changed to concat the object caption and the current date into the log.

I would be inclined to make the log visibility set to screen only, so that it doesn't print.

Hope that helps,

Niall