Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to insert form back into a process

Avatar

Level 8
Level 8
Hi all,



I have a question which deals with reinserting a form into a process invocation.



I have a process where I need to send a form to a user by email. My problem is then to get the form back into my workflow by using the process fields (Submit button). I know I could use a "Receive Mail" service - however I believe that I have once seen a solution where the form could be directly injected back into the process (at the right step), I just can't remember where I have seen it.



So my question is, how can I "reinsert" or submit a form in the middle of a process.



Thanks in advance



Kim Christensen
11 Replies

Avatar

Level 10
You need to set up an email endpoint to the CompleteTask operation from Process Management.



The complete task will complete the task associated to your task id and therefore will move the item to the next step in your workflow.



Jasmin

Avatar

Level 8
Level 8
Hi Jasmin,



Thanks for the advice - this seems to be a good solution. I am just wondering how I can distinguish between different instances of the process. I mean - there will come a lot of emails (from the individual instances) to this email endpoint and I need the process only to continue when a mail with the right/correct form is sent back. Is there a mechanism for handling this or do I need to create some kind of unique id for the form/email myself?



If the latter is the case, do you have any hints to how this can be done in a clever manner?



Sincerely

Kim Christensen

Avatar

Level 10
You obviously need the task id somehow to complete the right task. You could have it stored in a hidden field.



If you use the process field, I believe there is one for TaskID. Then you can use ExportFormData to extract the data and see if the TaskIDfield is populated. If it is, then complete, otherwise don't.



Jasmin

Avatar

Level 8
Level 8
Yes it was something like this I thought of. However it seems a little bit unclever that I need to check the mailbox, fetch the mail, get the attachment and check whether the TaskID is set. I mean - in the most cases I will only find that it is the wrong TaskI and then I should leave the email on the server to be checked again later.



Is is at all possible to remove emails from a server with an email endpoint setup?



Sincerely

Kim Christensen

Avatar

Level 10
The process where you define your email endpoint will grad the emails from that Inbox.



Whether your complete the task or not is up to you. As far as LiveCycle is concerned, it picked up the mail from the mailbox and initiated the process.



So the emails will be removed from the mailbox as soon as the process initiates. It doesn't really matter what you do in your process.



Jasmin

Avatar

Level 8
Level 8
OK - I think I get it know - but I guess that I need to add the form/or the xml from the form as output to the Complete Task service (to make sure I caqn handle the submitted data from the person that have sent the email.



By the way how can I check out the processes ProcessEmailMapSubmit (the first one in Complete Task), StartProcess, and Complete Task?



Sincerely

Kim Christensen

Avatar

Level 8
Level 8
And then again - now I am not sop sure I understand it anyways.



Let me sketch what I have understood:



I have my process which at a certain point sends out an email with the form to be filled. Now I am not sure which service should follow this sendEmail? The form to be filled will not be viewed in Workspace before I send the email, so I am also a little bit uncertain which TaskID I should put in my hidden field in the form? In other words I see that the Complete Task service takes the value of the process fields (taskID, processName and so on), however I am not sure how my own process should be built to make use of the Complete Task service.



Sincerely

Kim Christensen

Avatar

Level 10
How about if you create a new process that gets started when you receive a new email?



You could create an email endpoint to that process and the first step would be a user step.



You can't call the Complete Task service if there is no task (user step) to complete.



Could that be a workaround?



Jasmin

Avatar

Level 8
Level 8
Yes - that is an excellent idea. Thanks alot :o)



Just out of curiosity - if I were to use the Complete Task - what are my options to get the form sent to the user?



I mean - I can understand how it works if you click the "Take form offline" button (and then later submits it to the Complete Task Email endpoint), but how could I automatically have sent the form by email (with TaskID) and still got it back in the workflow?



Once again, thanks for your help.



Sincerely

Kim Christensen

Avatar

Level 8
Level 8
Hi again,



I am not sure the workaround will work anyway... :-(



My scenario looks as the following:



Process 1:



- Form1 with some data has been sent from the user to its email endpoint

- I fill up form2 with data (name, adress, phone etc.) from form1

- I send out form2 to the user



Process 2:

- Mail from the user with form2 is sent to process2 email endpoint (digitally signed)

- I need to fill up form3 with a combination of the data from form1 and form2



As I can see it I have no reference to all data of form1, and I am not sure how I can handle the data in this scenario.



If I go back to your initial suggestion how can I automatically send out an email with the id on the task to complete when a mail is sent to the complete task endpoint?

Avatar

Level 8
Level 8
Hi again,



I think I figured it out now - got some help from Girish at the LiveCycle Lifeline blog.



How do I set up the email endpoint for the Complete Task-service, I mean what should I setup for the attachmentMap and mailFrom input variables and output variable Result?



Sincerely

Kim Christensen