Expand my Community achievements bar.

SOLVED

Generate UUID in custom submission step.

Avatar

Level 1

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?)

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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)

saveDataToJCR
pl.orlen.internet.core.services.forms.FormDataToJCRSaver

 

Thanks

Siva

Thanks,
Siva

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

@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)

saveDataToJCR
pl.orlen.internet.core.services.forms.FormDataToJCRSaver

 

Thanks

Siva

Thanks,
Siva