Form Validation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2015 07:00 PM
I'm relatively new to Activiti and I've come across a problem that I haven't been able to figure out yet.
If I have a workflow similar to this…
[IMG]http://i61.tinypic.com/2mm7fpv.jpg[/IMG]
My start task form expects a single field: userId. ValidateUser is business logic to determine if the userId already exists in our system.
I'm starting the task via REST with the following cal which just gives me the handle to a process instance:
ProcessInstance processInstance = formService.submitStartFormData(processDefinition.getId(), startVariables);
What I'm not understanding provide feedback to the user via the rest response without having to continuously query or poll the database to check for a status update of what happens inside of ValidateUser? Is there not a built in way to do Start and Task form server side validation via the Activiti API?
My current workaround is to add a listener to Validate User and have the REST logic respond to an event triggered by the listener.
If I have a workflow similar to this…
[IMG]http://i61.tinypic.com/2mm7fpv.jpg[/IMG]
My start task form expects a single field: userId. ValidateUser is business logic to determine if the userId already exists in our system.
I'm starting the task via REST with the following cal which just gives me the handle to a process instance:
ProcessInstance processInstance = formService.submitStartFormData(processDefinition.getId(), startVariables);
What I'm not understanding provide feedback to the user via the rest response without having to continuously query or poll the database to check for a status update of what happens inside of ValidateUser? Is there not a built in way to do Start and Task form server side validation via the Activiti API?
My current workaround is to add a listener to Validate User and have the REST logic respond to an event triggered by the listener.
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2015 08:28 AM
Activiti executes the process instance until it finds a wait state. So that happens here: until the validate user is done and the next user task is reached, the engine keeps continuing. And at that point the rest call returns.
Not sure what you are looking for here? What would you expect?
Not sure what you are looking for here? What would you expect?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2015 09:20 AM
Thank for your timely response.
I'm looking for a a way to provide instant feedback to the form submitter via REST. Unless I'm missing something I see that I only have 3 options:
1. Move the business logic to validate the user outside of the process. I'd have to perform my form validation BEFORE my call: formService.submitStartFormData(). I'm not a big fan of that idea because I'd like the process to model my actual business process as closely as possible.
2. I could submit the form and write a loop that queries for a specific flag or state and then sleep n number of seconds before polling the database again. After the loop ends I can then return the proper status code indicating if the user validation passed or failed. Again, I'm not a big fan of this solution.
3. I could add a listener to Validate User and have the REST logic respond to complete event triggered by the listener.
Either way, in this case, the goal would be to give instant feedback to the user that the user name was either valid or invalid without having to make subsequent REST calls to check the status of the form validation step. Please advise as to other options if I missed them.
I'm looking for a a way to provide instant feedback to the form submitter via REST. Unless I'm missing something I see that I only have 3 options:
1. Move the business logic to validate the user outside of the process. I'd have to perform my form validation BEFORE my call: formService.submitStartFormData(). I'm not a big fan of that idea because I'd like the process to model my actual business process as closely as possible.
2. I could submit the form and write a loop that queries for a specific flag or state and then sleep n number of seconds before polling the database again. After the loop ends I can then return the proper status code indicating if the user validation passed or failed. Again, I'm not a big fan of this solution.
3. I could add a listener to Validate User and have the REST logic respond to complete event triggered by the listener.
Either way, in this case, the goal would be to give instant feedback to the user that the user name was either valid or invalid without having to make subsequent REST calls to check the status of the form validation step. Please advise as to other options if I missed them.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2015 08:41 AM
If I understand your requirements correctly, I think the service task should be changed to a async service task. This means that the user will immediately get feedback and then you can query the jobs to see if validation is ready.
Best regards,
Best regards,