AnsweredAssumed Answered

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

Question asked by jboss_user on Sep 7, 2017
Latest reply on Sep 7, 2017 by jboss_user

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

Outcomes