cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have a Unity Form add itself to Workflow?

Aaron_Kreitzer
Champ in-the-making
Champ in-the-making

I'm trying to add a Unity Form to a Workflow by having the User click a Conditional Button that calls an iUnityFormCustomActionEventScript. This script is currently targeting the Lifecycle, getting the Unity Form's Document Handle then erroring out when trying to pull the document to hold. 

 

Here is the call I'm making: Document odocument = app.Core.GetDocumentByID((long)oDocHandleField.Value);

 

Alternately, I thought of having the script call a System Task. I cannot find any information on this within the API documentation, so it probably isn't possible. 

 

Any help would this issue would be greatly appreciated. 

1 ACCEPTED ANSWER

Larissa_Armand
Elite Collaborator
Elite Collaborator

I did get it to work with a custom action script run from a condition button as well. 

 

string docHandleStr = string.Empty;long docHandle = 0;				// get input value for document handleValueField vfDocHandle = form.AllFields.ValueFields.Find(FLD_DOC_HANDLE);if (vfDocHandle == null) {	throw new Exception(string.Format("No field found for " + className + " script."));}else {	docHandleStr = vfDocHandle.AlphaNumericValue;	docHandle = Convert.ToInt64(docHandleStr);}				Document targetDoc = app.Core.GetDocumentByID(docHandle);				//Get workflow LC and Queue information set up.Workflow wfModule = app.Workflow;LifeCycle wfLC = wfModule.LifeCycles.Find("Life Cycle Name");Queue LCqueueInitial = wfLC.Queues.Find("Queue Name");				wfModule.AddToLifeCycle(targetDoc, LCqueueInitial);

View answer in original post

4 REPLIES 4

Larissa_Armand
Elite Collaborator
Elite Collaborator

There might be a way to do it in a script, but I wonder if it's easier to use a System Event? The condition button could set a (potentially hidden) field value that can be checked by the system event on save, then add to the life cycle. That would require the form to be saved though. 

 

 

Larissa_Armand
Elite Collaborator
Elite Collaborator

I did get it to work with a custom action script run from a condition button as well. 

 

string docHandleStr = string.Empty;long docHandle = 0;				// get input value for document handleValueField vfDocHandle = form.AllFields.ValueFields.Find(FLD_DOC_HANDLE);if (vfDocHandle == null) {	throw new Exception(string.Format("No field found for " + className + " script."));}else {	docHandleStr = vfDocHandle.AlphaNumericValue;	docHandle = Convert.ToInt64(docHandleStr);}				Document targetDoc = app.Core.GetDocumentByID(docHandle);				//Get workflow LC and Queue information set up.Workflow wfModule = app.Workflow;LifeCycle wfLC = wfModule.LifeCycles.Find("Life Cycle Name");Queue LCqueueInitial = wfLC.Queues.Find("Queue Name");				wfModule.AddToLifeCycle(targetDoc, LCqueueInitial);

Thanks so much @Larissa Armand ! I had to make a few modifications but this worked perfectly, I appreciate the support 🙂

Nice job, @Larissa Armand!