How to submit the Adaptive Form With store PDF action by an anonymous user

poojac35931336

04-01-2017

I am using store PDF action in AEM adaptive form. As a logged in user I am able to submit successfully. But When I am trying to submit it as an anonymous user  getting below error

com.adobe.aemds.guide.service.GuideStoreContentSubmission User does not have add_node permissions or its an anonymous user on /content/usergenerated/content/forms/af/something/something1/1483510140319_1
04.01.2017 11:39:00.326 *ERROR* [0:0:0:0:0:0:0:1 [1483510138542] POST /content/forms/af/somthing/somthing1/jcr:content/guideContainer.af.submit.jsp HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing
.

javax.jcr.RepositoryException: org.apache.sling.api.resource.PersistenceException: Resource at '/content/usergenerated/content/forms/af/something/something1/1483510140319_1' is not modifiable.

 If anyone has idea about submitting AEM forms with store PDF action, please reply.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

workflowuser

Employee

05-01-2017

I do not think the out of the box action handles anonymous users . Suggest you write you own custom submit action . The sample code can be found on the demo listings URL that I sent you in the earlier responses 

Answers (7)

Answers (7)

poojac35931336

10-01-2017

Even with custom submit action I am getting below error

javax.jcr.RepositoryException: org.apache.sling.api.resource.PersistenceException: Resource at '/content/usergenerated/content/forms/af/something/something1/1483510140319_1' is not modifiable.

I am just trying to store the submitted data under a node defined by author and calling " FormsHelper.runAction("/libs/fd/af/components/guidesubmittype/store", "post", resource, slingRequest, slingResponse) " in post.POST.jsp of my custom submit action.

Even the sample code given in above URL throwing same error while submitting the form in my local publish instance.

Have you given any additional permissions to anonymous user to store data

poojac35931336

05-01-2017

yeah, working fine. But I still can't figure out why the same action is throwing an exception for me, when an anonymous user is trying to submit he form.

poojac35931336

05-01-2017

thanks workflowuser for your reply. Actually I need to submit the form by an anonymous user not from a logged in user. It's throwing error while ecuting  "guideStoreContentSubmission.submissionForStoreContentUsingServiceUser(authType, userSession,guideStartParameter,path);" in fd/af/components/guidesubmittype/store/post.POST.jsp for an anonymous user.

I am getting the same error for "store content" action(which is used in demo project you have shared) also if submitting the form by an anonymous user.

workflowuser

Employee

04-01-2017

I have a sample which does what you are trying to do. Take a look at http://216.104.208.185. Login using your Facebook id and you should see the samples. One of the samples shows you the ability to store a PDF on AG submission

I have used custom code to do this. Generally to store anything  on the publish instance you will have to make use of what is called " service user". Suggest you do some reading in this to get some background information 

poojac35931336

04-01-2017

I am submitting the form from publish instance. Actually the purpose of using store pdf action was to generate a PDF copy of submitted form. If I use Form portal action then I am not getting any problem in submitting the form from publish by an anonymous user. But can't generate PDF automatically by using this. Is there any other way achieve this?