In this case, you want to put a cart before the horse. That is, you will render a child object (a Task
) before it's parent object (Process
) is created. Leveraging QBO's related table data pattern and a tiny bit of javascript will bind the Process
, Task
, Document
and Workflow
together nicely.
By leveraging a QBO's related table data feature,
Consider configuring the following:
- a
Task Template
called Insurance Claim Data Entry
- include whatever user-defined fields you want
- add a field named
Process_Process
: this will trigger the task to create an Process
- set the
onchange
javascript handler to call ensureProcess()
(see below)
- add a hidden field named
Process_ProcessTemplateID
: this will dictate the Process Template
the Process
is based on, and in turn, trigger the automatic creation of a workflow
- add the following javascript function from the
Task GUI Designer
:
function ensureProcess() {
var task = qbo3.getObject('FormEdit');
task.options.url = 'Decision/ImportForm.ashx/';
document.id('FormEdit').getElement('input[name=Object]').value = 'Process';
document.id('FormEdit').getElement('input[name=Process_ProcessTemplateID]').value = '1';
}
- a
Workflow Template
called Insurance Claim Filing
- Step 1: a
Task
named Insurance Claim Data Entry
- Step 2: a
Document
named Insurance Claim Analysis
- Step 3: a
Task
named Insurance Claim Review
- a
Process Template
called Insurance Claim Filing
- set it up to automatically launch an
Insurance Claim Filing
workflow when it's created
Tasks can be rendered before their parent exists by calling:
/api/ImportFormTemplate/RenderForm?ID={a task template id}
You can add to the Main Menu, replacing {a task template id} with the ID of your Task Template
named Insurance Claim Data Entry
.
When a user clicks on the Main Menu link to call ImportFormTemplate/RenderForm
, the Task
will be rendered. Key concepts to note:
- the
Process_Process
field is required, and a lynchpin to creating the Task
's Parent
object (in this case a Process
).
- the
Process_ProcessTemplateID
ensures that the newly created Process
uses the Process Template
you created
- the
Process Template
you configured will automatically launch a workflow whenever a Process
based upon it is created
- the
Workflow
will automatically bind to the just-created Insurance Claim Data Entry
task that kicked the whole thing off, because it's configured with a Repeatability
of One per parent