cancel
Showing results for 
Search instead for 
Did you mean: 

Process variable issue in domain classes where one to one relation exists

srikanthkollipa
Champ in-the-making
Champ in-the-making
Hi,

I have a form where user enters the information while raising a request. This information will be stored in multiple tables.

Parent Domain – RequestDetails
Child – RequestAttributes
Child – RequestStipulations


The relation is RequestDetails to RequestAttributes is one-to-one.
For RequestDetails–Request stipulataions is one-to-many.

My bpmn file looks like:

<blockcode>
<process id="sampleRequest" name="Sample Request">
        <startEvent id="start" />
        <sequenceFlow id="flow0" targetRef="submitWorkflowRequest"
                      sourceRef="start" />
        <userTask id="submitWorkflowRequest" activiti:formKey="/SampleRequest/create"
                  name="Submit Workflow Request">
            <documentation>Workflow request submitted by ${username}</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>user(${username})</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>

        </userTask>

        <sequenceFlow id="flow1" targetRef="handleWorkflowRequest"
                      sourceRef="submitWorkflowRequest" />
        <userTask id="handleWorkflowRequest" activiti:formKey="/SampleRequest/approval"
                  name="Handle Workflow Request">
            <documentation>Workflow request submitted by ${username}</documentation>
            <potentialOwner>
                <resourceAssignmentExpression>
                    <formalExpression>user(tenantManager)</formalExpression>
                </resourceAssignmentExpression>
            </potentialOwner>
        </userTask>

        <sequenceFlow id="flow2" targetRef="end0"
                      sourceRef="handleWorkflowRequest">
        </sequenceFlow>
        <endEvent id="end0" />
</blockcode>

Now when user enters data on the create form and clicks on complete button to submit the request. I am calling the below snippet:

<blockcode>
if (RequestDetailsInstance.save(flush: true, failOnError: true)) {
            flash.message = "Request ${RequestDetailsInstance.id} created"

            params.id = RequestDetailsInstance.id
            if (params.complete) {
                completeTask(params)
                render "Request created with id:  ${RequestDetailsInstance.id} "

            }else {
                saveTask(params)
                render "Request saved with id:  ${RequestDetailsInstance.id} "
            }
</blockcode>

It is succesfully saving the data into all the 3 tables by following the relationships among them.
when the control comes to completeTask(params), it is throwing an exception saying, could not find a variable type to serialize [here it is showing the child domain class object variables].

Can anyone help me in resolving this.
12 REPLIES 12

I checked that and it is not coming… Can you please let me know how to register the custom type into engine configuration?

jbarrez
Star Contributor
Star Contributor
You can inject a list of VariableType instances into the 'customPreVariableTypes' and 'customPostVariableTypes' setters. they will come respectively before or after the default types.

@jbarrez,

I tried to find out more on this, but couldn't. Can you please point me to an example of injecting a variableType to the custompreVariableTypes.

Thanks,
Srikanth