Hey, I'm trying to create in groovy preprocessor service new task and set formStatus to "Completed". I have form, xml to prefill.
After creating and set form status to completed in operations -> transaction operations, form status is displayed as Assigned instead of Completed.
Perhaps I am doing something wrong. Form can be filled only by auth. users so I am able to find user account by email Here is my code, any idea would be appreciate, maybe theres is another function to create task or to update form status?.
final def form = DaoFactory.getFormDao().getFormByFormCode(FormName)
def newFormXml = new XmlDoc(submissionDataBean.submittedData);
def portal = DaoFactory.getPortalDao().getPortalByName(PortalName)
def userAccount = DaoFactory.userAccountDao.getUserAccountForLogin(userEmail)
//Creation of params for task arg
def paramTask = new FormTaskParam()
paramTask.form = form
paramTask.user = userAccount
paramTask.portal = portal
paramTask.formDataXml = newFormXml
paramTask.taskSubject = "Initial Submission"
def task = submissionTaskService.createFormTask(paramTask)
Ok, I solved it on my own, after creating task, setting status completed I added
def submissionStatusService = new SubmissionStatusService()
And it's works
Your approach is correct but requires little bit of enhancement to make sure the submission status is recorded correctly with some other metadata. Also, try not to use "Completed"/"Submitted" as a string to assign a status to avoid issues with a future upgrade if we decide to change those status values something else. It's better to use the constant available under Submission object.
can you describe your requirements a little more. Do you want to create a transaction for data delivery purposes?
If this is what you want to do there is a Fluent API class specifically for doing this please see below.
String deliveryXml = ...
FileAttach fileAttach = ...
JobAction jobAction = ...
Txn txn =
I don't recommend you use the internal TM API for doing these types of operations, as you have to have knowledge about the TM internals to manage the transaction state transitions correctly.
regards Malcolm Edgar