Generate UUID in custom submission step. | Community
Skip to main content
August 23, 2023
Solved

Generate UUID in custom submission step.

  • August 23, 2023
  • 1 reply
  • 634 views

Hi.

I'm creating custom workflow step which stores data in jcr and sends email:

 

 

<% String emailContent = "/libs/fd/af/components/guidesubmittype/email"; FormDataToJCRSaver jcrSaverService=sling.getService(pl.orlen.internet.core.services.forms.FormDataToJCRSaver.class); jcrSaverService.saveDataToJCR(slingRequest,resource,currentPage); FormsHelper.runAction(emailContent, "post", resource,slingRequest, slingResponse); %>

 

 


I want to create UUID and add it to form data so it can be then saved to jcr and to be available in email template.Is there a way to inject it to request as a form data?

(But in a way the user won't see it? Or even in better way so it is added post request so user cannot edit it?)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SivakumarKanoori

@malickid :

If I understand, you want to create unique UUID for every form submission and same you would want to store with the form Data. 

If you are using AEM adaptive forms , you can achieve it.

 

1) You can create a one hidden field in Adaptive form for uuid and click on submission button you can assign the UUID ( To get the unique id you can write your logic ) to the hidden field and submit. make sure you have assigned the bind reference to hidden field

2) in your service class , check the method , (not sure what code is inside this method), you can read the hidden field name and pass to this method. it will take care to save to jcr. (So you can see that hidden field name and value as part of slingrequest may be)

saveDataToJCRpl.orlen.internet.core.services.forms.FormDataToJCRSaver

 

Thanks

Siva

1 reply

SivakumarKanoori
Community Advisor
SivakumarKanooriCommunity AdvisorAccepted solution
Community Advisor
August 25, 2023

@malickid :

If I understand, you want to create unique UUID for every form submission and same you would want to store with the form Data. 

If you are using AEM adaptive forms , you can achieve it.

 

1) You can create a one hidden field in Adaptive form for uuid and click on submission button you can assign the UUID ( To get the unique id you can write your logic ) to the hidden field and submit. make sure you have assigned the bind reference to hidden field

2) in your service class , check the method , (not sure what code is inside this method), you can read the hidden field name and pass to this method. it will take care to save to jcr. (So you can see that hidden field name and value as part of slingrequest may be)

saveDataToJCRpl.orlen.internet.core.services.forms.FormDataToJCRSaver

 

Thanks

Siva

Thanks,Siva