Why customized field can be defined in startEvent but not userTask?

cancel
Showing results for 
Search instead for 
Did you mean: 
jboss_user
Active Member

Why customized field can be defined in startEvent but not userTask?

Jump to solution

Why customized field can be defined in startEvent but not userTask? I have defined customized field called scheduledPublishDate in my workflow content model with namespace ut. Here is the partial workflow definition:

<startEvent id="start" name="Start" activiti:formKey="ut:scheduleTask">
<extensionElements>
<activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
logger.log("##########workflow start:start!!!");
if (typeof ut_scheduledPublishDate != 'undefined') {
logger.log("##########workflow start::ut_scheduledPublishDate defined");
}
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
</startEvent>

It does print out "##########workflow start::ut_scheduledPublishDate defined"  But if I change startEvent to use formKey as wf:submitReviewTask with the following fragment

<userTask id="SchedulePublishTast" name="Schedule Publish Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="ut:scheduleTask">
<extensionElements>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof ut_scheduledPublishDate != 'undefined') {
  logger.log("##########ut_scheduledPublishDate DOES defined!!!");
} else {
  logger.log("##########ut_scheduledPublishDate NOT defined!!!");
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>

It prints out "##########ut_scheduledPublishDate NOT defined!!!"

The same formKey ut:scheduleTask. If used in startEvent, I can get defined customized field but I can't get it if used in userTask. But I can see the field from user interface. Anybody knows what I might be missing. Thanks in advance

1 Solution

Accepted Solutions
jboss_user
Active Member

Re: Why customized field can be defined in startEvent but not userTask?

Jump to solution

Never mind. I resolved by myself. What is interesting is that I don't need to set variable in startEvent but need it in userTask for other tasks to refer

View solution in original post

1 Reply
jboss_user
Active Member

Re: Why customized field can be defined in startEvent but not userTask?

Jump to solution

Never mind. I resolved by myself. What is interesting is that I don't need to set variable in startEvent but need it in userTask for other tasks to refer