ExceptionActiviti: unknown property used in expression - workflow

sI use activiti for my workflow on alfresco 4.2.c. I want to assign to a group from my form selection. But when I press submit task it throws an exception: org.activiti.engine.ActivitiException: Unknown property used in expression
My activiti is:
<userTask id="kiemtranoidungthethuc" name="Kiểm tra nội dung, thể thức VB- Chuyển cho phòng TCHC" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wfdi:kiemtranoidungthethucTask_tc">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wfdi_userVanthu', person);
execution.setVariable('wfdi_chapthuan_tc', task.getVariable('wfdi_chapthuan_tc'));
<!-- execution.setVariable('bpm_assignee', person);-->
execution.setVariable('bpm_dueDate', task.getVariable('dueDate'));
execution.setVariable('bpm_priority', task.priority);
execution.setVariable('bpm_groupAssignee',task.bpm_groupAssignee);
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="kiemtrathethucchuky" name="Phòng TCHC - Kiểm tra thể thức, chữ ký - Chuyển cho BGH"
activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}" activiti:formKey="wfdi:kiemtrathethucchukyTask_tc">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_priority;
<!-- if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);-->
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wfdi_kiemtra_tc', task.getVariable('wfdi_kiemtra_tc'));
execution.setVariable('bpm_dueDate', task.getVariable('dueDate'));
execution.setVariable('bpm_priority', task.priority);
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
My form is:
<config evaluator="task-type" condition="wfdi:kiemtranoidungthethucTask_tc">
<forms>
<form>
<field-visibility>
<show id="message" />
<show id="taskOwner" />
<show id="bpm:priority" />
<show id="bpm:dueDate" />
<show id="bpm:taskId" />
<show id="packageItems" />
<show id="bpm:groupAssignee" />
<show id="bpm:comment" />
<show id="wfdi:chapthuan_tc" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.task.info" />
<set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="response" appearance="title" label-id="workflow.set.response" />
<field id="message">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="taskOwner" set="info" />
<field id="bpm:taskId" set="info">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="bpm:priority" set="info" read-only="true">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:dueDate" set="info" label-id="workflow.field.due">
<control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
<field id="packageItems" set="items" />
<field id="bpm:groupAssignee" label-id="workflow.field.review_group" set="assignee" />
<field id="bpm:comment" label-id="workflow.field.comment" set="response">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
<field id="wfdi:chapthuan_tc" label-id="workflow.field.outcome" set="response">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>
</forms>
My model is:
<type name="wfdi:kiemtranoidungthethucTask_tc">
<parent>bpm:workflowTask</parent>
<properties>
<property name="wfdi:chapthuan_tc">
<type>d:text</type>
<default>Tu_Choi</default>
<constraints>
<constraint name="wfdi:chapthuanOption_tc" type="LIST">
<parameter name="allowedValues">
<list>
<value>Chuyen_Phong_TCHC</value>
<value>Tu_Choi</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
</properties>
<overrides>
<property name="bpm:packageItemActionGroup">
<default>edit_package_item_actions</default>
</property>
<property name="bpm:outcomePropertyName">
<default>{http://www.alfresco.org/model/workflow/1.0}chapthuan</default>
</property>
</overrides>
<mandatory-aspects>
<aspect>bpm:groupAssignee</aspect>
</mandatory-aspects>
I know the problem is: activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}"
but I don't know how to fix it.
Can anybody help me?
Thank in advance.

Related

alfresco workflow details page - how to hide parameters?

I'm having issues and questions regarding the workflow details form. From what I've understood so far, modifications can mainly be done by modifying share-config-custom.xml, by adding a form-tag looking something like this (tried a number of variations):
<form id="workflow-details">
<field-visibility>
<show id="cmpny:processId" />
<hide id="cmpny:title" />
<hide id="cmpny:description" />
<hide id="packageItems" />
<hide id="cmpny:reason"/>
<hide id="cmpny:review"/>
<hide id="cmpny:deadline" />
<hide id="cmpny:customReviewOutcome"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label="Overview" />
<set id="main" appearance="title" label="Description" />
<field id="cmpny:processId" set="main" label="Process-ID"/>
</appearance>
</form>
I have mainly tried copying the working form from one of the tasks and modifying it, giving it its own config-tag or added it to one existing one under the task's forms-tag, but nothing seems to work - at all. Whatever I do, no changes appear.
My main expectation is to having at least something appear, but no visible changes can be detected. I found this post:
Alfresco: Hide "General Info" section in workflow-details form
where the person in question at least managed to achieve some differences this way. I also want to modify the general-info, but that is another matter for another day. For the moment, I want to be able to modify the form displayed.
Apart from this, I wonder - most instructions on how to achieve this is very sparse. Most just seem to say "add a form with id=workflow-details to a task config-tag", and the form should appear once that specific task has been completed.
My questions are the following:
Apart from using a form with id="workflow-details" and adding it to a task's config-tag, is there anything more to it, in order to make it work?
Is there a way to make the form in question appear no matter the latest task?
** EDIT **
This is the latest code, unfiltered and cut straight from share-config-custom.xml.
<config evaluator="task-type" condition="cmpny:workflowModel_acceptreject">
<forms>
<form id="workflow-details">
<field-visibility>
<show id="cmpny:processId0" />
<show id="cmpny:title0" />
<show id="cmpny:description0" />
<show id="packageItems" />
<show id="cmpny:reason0"/>
<show id="cmpny:granskningsretur0"/>
<show id="cmpny:deadline0" />
<show id="cmpny:customReviewOutcome0"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label="Översikt" />
<set id="main" appearance="title" label="Beskrivning" />
<set id="items" appearance="title" label="Information" />
<set id="other" appearance="title" label="Beslut" />
<field id="cmpny:processId0" set="main" label="Process-ID"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:title0" set="main" label="Uppgiftsrubrik"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:description0" set="main" label="Meddelande"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="packageItems" set="main" label="Bifogade Filer"/>
<field id="cmpny:reason0" set="main" label="Kommentar">
<control
template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="rows">4</control-param>
<control-param name="columns">8</control-param>
<control-param name="maxLength">5000</control-param>
</control>
</field>
<field id="cmpny:deadline0" set="items" label="Förfallodatum"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:granskningsretur0" set="items" label="Granskning begärd"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:customReviewOutcome0" label="Utfall" set="other">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>
<form>
<field-visibility>
<show id="cmpny:processId0" />
<show id="cmpny:title0" />
<show id="cmpny:description0" />
<show id="packageItems" />
<show id="cmpny:reason0"/>
<show id="cmpny:granskningsretur0"/>
<show id="cmpny:deadline0" />
<show id="cmpny:customReviewOutcome0"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label="Översikt" />
<set id="main" appearance="title" label="Beskrivning" />
<set id="items" appearance="title" label="Information" />
<set id="other" appearance="title" label="Beslut" />
<field id="cmpny:processId0" set="main" label="Process-ID"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:title0" set="main" label="Uppgiftsrubrik"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:description0" set="main" label="Meddelande"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="packageItems" set="main" label="Bifogade Filer"/>
<field id="cmpny:reason0" set="main" label="Kommentar">
<control
template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="rows">4</control-param>
<control-param name="columns">8</control-param>
<control-param name="maxLength">5000</control-param>
</control>
</field>
<field id="cmpny:deadline0" set="items" label="Förfallodatum"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:granskningsretur0" set="items" label="Granskning begärd"><control template="/org/alfresco/components/form/controls/info.ftl"/></field>
<field id="cmpny:customReviewOutcome0" label="Utfall" set="other">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Screenshot (Only one, but the workflow-details-tag literally makes ZERO difference - screenshots are identical down to the pixel).
Perhaps at least worth mentioning is that I've also meddled some with the webscript, but I've checked that it isn't the cause.
Screenshot link here, can't add it directly apparently
I've tried multiple combinations, putting it in different tasks, shaving the parameters down to a bare minimum - nothing works. To just make it clear - ANY difference is what I'm aiming for at the moment - just getting anything to stick.
** EDIT 2 **
Clarified screenshot here.
Second, enhanced screenshot
This is the way you can add items in workflow details page
<field-visibility>
<show id="someWorkflow:VersionNumber" />
</field-visibility>
<appearance>
<set id="docSubDetails" label="Document Details"
template="/org/alfresco/components/form/2-column-set.ftl"/>
</appearance>
or Hide
<field-visibility>
<hide id="someWorkflow:VersionNumber" />
</field-visibility>
Full code
<config evaluator="task-type" condition="someWorkflow:peerReviewerTask">
<forms>
<form>
<field-visibility>
<show id="someWorkflow:VersionNumber" />
<show id="someWorkflow:documentLocation" />
<show id="someWorkflow:documentName" />
<show id="someWorkflow:author" />
<show id="bpm:assignees" />
<show id="bpm:comment" />
<show id="someWorkflow:peerReviewTaskOutcome" />
</field-visibility>
<appearance>
<set id="docSubDetails" label="Document Details" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docAuthor" appearance="title" label="" template="/org/alfresco/components/form/2-column-set.ftl"/>
<field id="someWorkflow:VersionNumber" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:documentLocation" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:documentName" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:author" set="docAuthor" label="Author" read-only="true"/>
<field id="bpm:assignees" set="docAuthor" label="QC Reviewer(s)" read-only="true"/>
</field>
</appearance>
</form>
<form id="workflow-details">
<field-visibility>
<show id="someWorkflow:VersionNumber" />
<show id="someWorkflow:documentLocation" />
<show id="someWorkflow:documentName" />
<show id="someWorkflow:author" />
<show id="bpm:assignees" />
<show id="bpm:comment" />
<show id="someWorkflow:peerReviewTaskOutcome" />
</field-visibility>
<appearance>
<set id="docSubDetails" label="Document Details" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docAuthor" appearance="title" label="" template="/org/alfresco/components/form/2-column-set.ftl"/>
<field id="someWorkflow:VersionNumber" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:documentLocation" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:documentName" set="docSubDetails" read-only="true"/>
<field id="someWorkflow:author" set="docAuthor" label="Author" read-only="true"/>
<field id="bpm:assignees" set="docAuthor" label="QC Reviewer(s)" read-only="true"/>
</appearance>
</form>
</forms>
</config>
Workflow summary displays workflow / task details from start-task details only. So I have shared workflow model and share configuration also.
Workflow Model
<?xml version='1.0' encoding='UTF-8'?>
<model xmlns='http://www.alfresco.org/model/dictionary/1.0' name='workflowns:model'>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.alfresco.org/model/site/1.0" prefix="st"/>
<import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" />
</imports>
<namespaces>
<namespace uri="workflowns.model" prefix="workflowns"/>
</namespaces>
<types>
<type name="workflowns:Form0">
<title>Initiator Task</title>
<parent>bpm:startTask</parent>
<mandatory-aspects>
<aspect>bpm:assignee</aspect>
<aspect>workflowns:reviewerAspect</aspect>
<aspect>workflowns:approverAspect</aspect>
<aspect>workflowns:finalapproverAspect</aspect>
<aspect>workflowns:notesLabel</aspect>
<aspect>workflowns:Aspect1</aspect>
<aspect>workflowns:Aspect3</aspect>
</mandatory-aspects>
</type>
....
</model>
Share Custom Configuration
<!-- Workflow details page-->
<config evaluator="task-type" condition="workflowns:startTask">
<forms>
<form>
<field-visibility>
<show id="workflowns:documentname" />
<show id="workflowns:documentversion" />
<show id="workflowns:pathorlinktothedocument" />
<show id="workflowns:customerno" />
<show id="workflowns:projectno" />
<show id="workflowns:author" />
<show id="workflowns:reviewer" />
<show id="workflowns:approver" />
<show id="workflowns:finalapprover" />
<show id="workflowns:initiatorcomment" />
<show id="bpm:taskId" />
<show id="bpm:status" />
</field-visibility>
<appearance>
<set id="docDetails" appearance="title" label="Document Details"/>
<set id="docSubDetails" label="" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docAuthor" appearance="title" label="Author" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docReviewer" appearance="title" label="Reviewers" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docApprover" appearance="title" label="Approvers" template="/org/alfresco/components/form/2-column-set.ftl"/>
<set id="docFinalapprover" appearance="title" label="Final Approvers" template="/org/alfresco/components/form/2-column-set.ftl"/>
<field id="workflowns:documentname" set="docDetails" label="Document Name">
</field>
<field id="workflowns:documentversion" set="docDetails" label="Document Version">
</field>
<field id="workflowns:pathorlinktothedocument" set="docDetails" label="Path or Link to the document">
</field>
<field id="workflowns:customerno" set="docSubDetails" label="Customer Number">
</field>
<field id="workflowns:projectno" set="docSubDetails" label="Project Number">
</field>
<field id="workflowns:author" set="docAuthor" label="Author">
</field>
<field id="workflowns:reviewer" set="docReviewer" label="Reviewer">
</field>
<field id="workflowns:approver" set="docApprover" label="Approver">
</field>
<field id="workflowns:finalapprover" set="docFinalapprover" label="Final Approver">
</field>
</appearance>
</form>
</forms>
</config>
Hope this helps you.

Alfresco Workflow Share Form

I am trying to build a custom workflow in alfresco community edition. Basically I am trying to modify the existing workflow called lifecycleprocess. I have been able to deploy the process using workflow console without error. But I am not able to do any change at all on the workflow form. My workflow is called leaveprocess and I have the following code :
Path : alfresco/tomcat/shared/classes/alfresco/extension/
leave-process-bpmn20.xml
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="leave-definitions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn">
<process id="activitileaveApproval" name="Leave Process">
<extensionElements>
<!-- When process is deleted/cancelled, status should be set to draft -->
<activiti:executionListener event="end" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
if(cancelled || deleted) {
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
}
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
<startEvent id="start"
activiti:formKey="wf:submitReviewTask" />
<sequenceFlow id='flow1'
sourceRef='start'
targetRef='reviewTask'>
<extensionElements>
<activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].addAspect("wfl:status");
}
}
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
</sequenceFlow>
<userTask id="reviewTask" name="Review Task"
activiti:formKey="wf:activitiReviewTask">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status")) {
bpm_package.children[i].properties["wfl:status"] = "In Review";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${bpm_assignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow2'
sourceRef='reviewTask'
targetRef='reviewDecision' />
<exclusiveGateway id="reviewDecision" name="Review Decision" />
<sequenceFlow id='flow3' sourceRef='reviewDecision' targetRef='approved' >
<conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id='flow4'
sourceRef='reviewDecision'
targetRef='rejected' />
<userTask id="approved" name="Document Approved"
activiti:formKey="wf:approvedTask" >
<documentation>
The document was reviewed and approved.
</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status")) {
bpm_package.children[i].properties["wfl:status"] = "Approved";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${initiator.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<userTask id="rejected" name="Document Rejected"
activiti:formKey="wf:rejectedTask" >
<documentation>
The document was reviewed and rejected.
</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${initiator.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow5' sourceRef='approved'
targetRef='end' />
<sequenceFlow id='flow6' sourceRef='rejected'
targetRef='end' />
<endEvent id="end" />
</process>
</definitions>
leave-messages.properties
# For JBPM leave Workflow Example
wfl_leaveapproval.workflow.title=Leave Application
wfl_leaveapproval.workflow.description=Leave Application (Auto updates document status)
wfl_leaveapproval.node.review.transition.reject.title=Reject
wfl_leaveapproval.node.review.transition.reject.description=Reject
wfl_leaveapproval.node.review.transition.approve.title=Approve
wfl_leaveapproval.node.review.transition.approve.description=Approve
# For Activiti leave Workflow Example
activitileaveApproval=Leave Application
activitileaveApproval=Leave Application workflow Activiti (Auto updates document status)
leave-workflow-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="leave.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<!-- JBPM version of leave process -->
<props>
<prop key="engineId">jbpm</prop>
<prop key="location">alfresco/extension/leave_processdefinition.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">false</prop>
</props>
<!-- Activiti version of leave process -->
<props>
<prop key="engineId">activiti</prop>
<prop key="location">alfresco/extension/leave-process.bpmn20.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">false</prop>
</props>
</list>
</property>
<property name="models">
<list>
<value>alfresco/extension/leaveModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco/extension/leave-messages</value>
</list>
</property>
</bean>
</beans>
leave_processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:leaveapproval">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitReviewTask" swimlane="initiator" />
<event type="node-leave">
<!-- Call script once the workflow package exists i.e. on node-leave -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<!-- Apply the Workflow leave Aspect (wfl:status) if not set already. Note: The default wfl:status property is draft -->
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].addAspect("wfl:status");
}
}
</script>
</action>
</event>
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</swimlane>
<task-node name="review">
<event type="node-enter">
<!-- Update the status to In Review when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "In Review";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition name="approve" to="approved" />
<transition name="reject" to="rejected" />
</task-node>
<task-node name="rejected">
<event type="node-enter">
<!-- Update the status to Draft when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:rejectedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<task-node name="approved">
<event type="node-enter">
<!-- Update the status to Approved when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Approved";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:approvedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<end-state name="end" />
<event type="process-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
if (cancelled)
{
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
if (logger.isLoggingEnabled()) logger.log("Workflow cancelled, status reset to Draft");
}
else
{
if (logger.isLoggingEnabled()) logger.log("Workflow completed");
}
</script>
</action>
</event>
</process-definition>
leaveModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<model name="wfl:workflowleavemodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Workflow leave Model</description>
<author></author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<namespaces>
<namespace uri="wfl.model" prefix="wfl" />
</namespaces>
<constraints>
<constraint name="wfl:status" type="LIST">
<parameter name="allowedValues">
<list>
<value>Draft</value>
<value>In Review</value>
<value>Approved</value>
</list>
</parameter>
</constraint>
</constraints>
<aspects>
<!-- Status property is used to manage workflow approval -->
<aspect name="wfl:status">
<title>Status</title>
<properties>
<property name="wfl:status">
<title>Status</title>
<type>d:text</type>
<default>Draft</default>
<constraints>
<constraint ref="wfl:status" />
</constraints>
</property>
</properties>
</aspect>
</aspects>
</model>
Path : alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/
share-workflow-form-config.xml
<!-- Leave Workflow Definition -->
<config evaluator="string-compare" condition="jbpm$wfl:leaveApproval">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="bpm:workflowDueDate" />
<show id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="packageItems" />
<show id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info" />
<field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
<field id="packageItems" set="items" />
<field id="bpm:sendEMailNotifications" set="other">
<control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="activiti$activitileaveApproval">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="bpm:workflowDueDate" />
<show id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="packageItems" />
<show id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info">
<control template="/org/alfresco/components/form/controls/date.ftl">
<control-param name="showTime">false</control-param>
<control-param name="submitTime">false</control-param>
</control>
</field>
<field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
<field id="packageItems" set="items" />
<field id="bpm:sendEMailNotifications" set="other">
<control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
I am unable to understand, no matter what changes I do in this code for share-workflow-form-config.xml, It does not reflect when go to Share->Workflows I've started->select Leave Process. It always show the default form there. Somebody please guide me what I am doing wrong here.
You need to replace this
<form>
with following line
<form id="workflow-details">
means add attribute "id" in your form tag
After making changes in share-config you have to restart alfresco :)
Deploy of workflow (via workflow console) makes just re-deploy of the workflow definitions (also like deploy of models,.. )
But
<config evaluator="string-compare" condition="jbpm$wfl:leaveApproval">
Should works :D, no other idea why not working..

Edit task workflow FORM change

I have created my own custom workflow (for now this is just adhoc workflow customization) and i have managed to customize start workflow form, however a can not customize second form, this is edit task form (when user start process and assign to "someone", "someone" get task in inbox and he see edit task form). This second form is the same as my first plus some extra fields. This is because i need that "someone" can view and edit data entered on start workflow form. So i basically copied first form configuration to second form but this doesn't work, only sets and textareas are rendered. Anybody now how can i customize this?
workflow definition
<process id="appppV1" name="Proces otvaranja projekta">
<startEvent id="start" name="Start" activiti:formKey="mcwm:submitStart"></startEvent>
<userTask id="preparationOfProjectCharter" name="Priprema projektne povelje" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="mcwm:preparationOfProjectCharter">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
</userTask>
model for workflow:
<types>
<type name="mcwm:submitStart">
<parent>bpm:startTask</parent>
<properties>
<property name="mcwm:projectName">
<title>Naziv projekta</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="mcwm:shortProjectName">
<title>Skraćeni naziv projekta</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:projectOrderer">
<title>Naručitelj projekta</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:shortProjectOrderer">
<title>Skraćeni naziv naručitelja projekta</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:isoProcess">
<title>ISO 9000 proces</title>
<type>d:text</type>
<mandatory>true</mandatory>
<default> </default>
<constraints>
<constraint name="mcwm:isoProcessChoices" type="LIST">
<parameter name="allowedValues">
<list>
<value> </value>
<value>održavanje - aplikativno</value>
<value>održavanje - sistemsko</value>
<value>konsalting</value>
<value>razvoj - sa odobrenjem arhitekture</value>
<value>razvoj - bez odobrenjem arhitekture</value>
<value>mali razvoj</value>
<value>implementacija</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
<property name="mcwm:reporting">
<title>Učestalost izveštavanja</title>
<type>d:text</type>
<mandatory>true</mandatory>
<default>mesečno</default>
<constraints>
<constraint name="mcwm:reportingChoices" type="LIST">
<parameter name="allowedValues">
<list>
<value>mesečno</value>
<value>kvartalno</value>
<value>po okončanju</value>
</list>
</parameter>
</constraint>
</constraints>
</property>
<property name="mcwm:projectGoals">
<title>Ciljevi projekta</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:beginDate">
<title>Datum početka projekta</title>
<type>d:date</type>
<mandatory>true</mandatory>
</property>
<property name="mcwm:endDate">
<title>Datum okončanja projekta</title>
<type>d:date</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:team">
<title>Projektni tim (*promena tipa kontorle)</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:teamResource">
<title>Predviđeni utrošak ljudskih resursa (*promena tipa kontorle)</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:teamComent">
<title>Komentar na predviđeni utrošak ljudskih resursa</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="mcwm:changeComent">
<title>Komentar izmene</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>
</properties>
<!-- To select a user -->
<mandatory-aspects>
<aspect>bpm:assignee</aspect>
</mandatory-aspects>
</type>
<type name="mcwm:preparationOfProjectCharter">
<parent>bpm:workflowTask</parent>
<properties>
<property name="mcwm:editTask">
<title>Edit task</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
share-config-custom.xml
<config evaluator="string-compare" condition="activiti$appppV1">
<forms>
<form>
<field-visibility>
<hide id="bpm:workflowDescription" />
<hide id="bpm:workflowDueDate" />
<hide id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="mcwm:projectName" />
<show id="mcwm:shortProjectName" />
<show id="mcwm:projectOrderer" />
<show id="mcwm:shortProjectOrderer" />
<show id="mcwm:isoProcess" />
<show id="mcwm:reporting"/>
<show id="mcwm:projectGoals"/>
<show id="mcwm:beginDate"/>
<show id="mcwm:endDate"/>
<show id="mcwm:team"/>
<show id="mcwm:teamResource"/>
<show id="mcwm:teamComent"/>
<show id="mcwm:changeComent"/>
<hide id="packageItems" />
<hide id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="apppv1.set.projekat" />
<set id="general" appearance="fieldset" label-id="appppV1.set.general" />
<set id="date" template="/org/alfresco/components/form/2-column-set.ftl" appearance="fieldset" label-id="appppV1.set.date" />
<set id="team" appearance="fieldset" label-id="appppV1.set.team" />
<set id="change" appearance="fieldset" label-id="appppV1.set.change" />
<field id="mcwm:projectName" set="general" />
<field id="mcwm:shortProjectName" set="general" />
<field id="mcwm:projectOrderer" set="general" />
<field id="mcwm:shortProjectOrderer" set="general" />
<field id="mcwm:isoProcess" set="general" />
<field id="mcwm:reporting" set="general" />
<field id="mcwm:projectGoals" set="general">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:beginDate" set="date"/>
<field id="mcwm:endDate" set="date"/>
<field id="bpm:assignee" set="team" label="Voditelj projekta"/>
<field id="mcwm:team" set="team">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:teamResource" set="team"/>
<field id="mcwm:teamComent" set="team">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:changeComent" set="change">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
</appearance>
</form>
</forms>
share-config-custom.xml - second form
<config evaluator="task-type" condition="mcwm:preparationOfProjectCharter">
<forms>
<form>
<field-visibility>
<show id="mcwm:projectName"/>
<show id="mcwm:editTask"/>
<hide id="bpm:workflowDescription" />
<hide id="bpm:workflowDueDate" />
<hide id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="mcwm:projectName" />
<show id="mcwm:shortProjectName" />
<show id="mcwm:projectOrderer" />
<show id="mcwm:shortProjectOrderer" />
<show id="mcwm:isoProcess" />
<show id="mcwm:reporting"/>
<show id="mcwm:projectGoals"/>
<show id="mcwm:beginDate"/>
<show id="mcwm:endDate"/>
<show id="mcwm:team"/>
<show id="mcwm:teamResource"/>
<show id="mcwm:teamComent"/>
<show id="mcwm:changeComent"/>
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="apppv1.set.projekat" />
<set id="general" appearance="fieldset" label-id="appppV1.set.general" />
<set id="date" template="/org/alfresco/components/form/2-column-set.ftl" appearance="fieldset" label-id="appppV1.set.date" />
<set id="team" appearance="fieldset" label-id="appppV1.set.team" />
<set id="change" appearance="fieldset" label-id="appppV1.set.change" />
<field id="mcwm:projectName" set="general" />
<field id="mcwm:shortProjectName" set="general" />
<field id="mcwm:projectOrderer" set="general" />
<field id="mcwm:shortProjectOrderer" set="general" />
<field id="mcwm:isoProcess" set="general" />
<field id="mcwm:reporting" set="general" />
<field id="mcwm:projectGoals" set="general">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:beginDate" set="date"/>
<field id="mcwm:endDate" set="date"/>
<field id="bpm:assignee" set="team" label="Voditelj projekta"/>
<field id="mcwm:team" set="team">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:teamResource" set="team"/>
<field id="mcwm:teamComent" set="team">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:changeComent" set="change">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 65%</control-param>
<control-param name="rows">5</control-param>
</control>
</field>
<field id="mcwm:editTask" set="general" read-only="true"/>
</appearance>
</form>
</forms>
I try to use in show tag with force="true" attribute and this show my filed but data aren't transfered from my start from?!
Thanks in advance for help.
Regards,
Aleksandar
I think that you are not seeing any fields because mcwm:preparationOfProjectCharter task has no properties that you are trying to display.
If you want the same properties on second task that you have on first task you will have to define them in your task model.
If the properties are exactly the same and repeating a lot, you can specify them as an aspect and add them as mandatory aspect in task model.
Thanks for your help. :) I done something quite similar. I just set on my second task that parent is first task
<type name="mcwm:preparationOfProjectCharter">
<parent>mcwm:submitStart</parent>
and now i have all property from first task on my second task.
Regards,
Aleksandar

EF4: mapping to an "Extra Fields" table

I have two tables:
TICKET
GUID (PK)
there are other columns not related to this question
TICKET_PROPERTIES
GUID (partial PK, FK to TICKET.GUID)
FIELDNAME (partial PK)
FIELDVALUE
If I have these ticket records:
{ GUID = "my_ticket" }
{ GUID = "my_ticket_2" }
Then I could possibly have some TICKET_PROPERTIES records like:
{ GUID = "my_ticket", FIELDNAME = "FieldA", FIELDVALUE = "value a" }
{ GUID = "my_ticket", FIELDNAME = "FieldB", FIELDVALUE = "foo" }
{ GUID = "my_ticket", FIELDNAME = "FieldC", FIELDVALUE = "bar" }
{ GUID = "my_ticket_2", FIELDNAME = "FieldC", FIELDVALUE = "blah" }
{ GUID = "my_ticket_2", FIELDNAME = "FieldD", FIELDVALUE = "data" }
As you can see, this TICKET_PROPERTIES table serves as an "extra fields" table for fields that a TICKET record can optionally have. A TICKET may not always have an associated TICKET_PROPERTIES record with FIELDNAME="FieldA", but sometimes they do.
If I wanted to add a FieldA property to my TICKET class in this EDMX file, how could I do it?
It would be nice if such a property could build a where condition into the query generated by something like this:
MINE_EF_TestContext ctx = new MINE_EF_TestContext();
var someTickets = ctx.TICKET.Where(t => t.FieldA == "value a");
I would like to be able to add more than one property like this. For example I would probably want to be able to add a FieldB property as well.
My EDMX:
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<edmx:Runtime>
<edmx:StorageModels>
<Schema Namespace="MINE_EF_Test.Store" Alias="Self" Provider="EFOracleProvider" ProviderManifestToken="11g" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<EntityContainer Name="MINE_EF_TestStoreContainer">
<EntitySet Name="TICKET" EntityType="MINE_EF_Test.Store.TICKET" store:Type="Tables" />
<EntitySet Name="TICKET_PROPERTIES" EntityType="MINE_EF_Test.Store.TICKET_PROPERTIES" store:Type="Tables" />
<AssociationSet Name="TICKET_PROPERTIES_TICKET_FK" Association="MINE_EF_Test.Store.TICKET_PROPERTIES_TICKET_FK">
<End Role="TICKET" EntitySet="TICKET" />
<End Role="TICKET_PROPERTIES" EntitySet="TICKET_PROPERTIES" />
</AssociationSet>
</EntityContainer>
<EntityType Name="TICKET">
<Key>
<PropertyRef Name="GUID" />
</Key>
<Property Name="GUID" Type="varchar2" Nullable="false" MaxLength="36" />
</EntityType>
<EntityType Name="TICKET_PROPERTIES">
<Key>
<PropertyRef Name="FIELDNAME" />
<PropertyRef Name="GUID" />
</Key>
<Property Name="FIELDNAME" Type="varchar2" Nullable="false" MaxLength="40" />
<Property Name="FIELDVALUE" Type="varchar2" Nullable="false" MaxLength="1000" />
<Property Name="GUID" Type="varchar2" Nullable="false" MaxLength="36" />
</EntityType>
<Association Name="TICKET_PROPERTIES_TICKET_FK">
<End Role="TICKET" Type="MINE_EF_Test.Store.TICKET" Multiplicity="1" />
<End Role="TICKET_PROPERTIES" Type="MINE_EF_Test.Store.TICKET_PROPERTIES" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="TICKET">
<PropertyRef Name="GUID" />
</Principal>
<Dependent Role="TICKET_PROPERTIES">
<PropertyRef Name="GUID" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="TICKET_PROPERTIES_TICKET_FK_POC">
<End Role="TICKET" Type="MINE_EF_Test.Store.TICKET" Multiplicity="0..1" />
<End Role="TICKET_PROPERTIES" Type="MINE_EF_Test.Store.TICKET_PROPERTIES" Multiplicity="1" />
<ReferentialConstraint>
<Principal Role="TICKET_PROPERTIES">
<PropertyRef Name="GUID" />
</Principal>
<Dependent Role="TICKET">
<PropertyRef Name="GUID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<edmx:ConceptualModels>
<Schema Namespace="MINE_EF_Test" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="MINE_EF_TestContext" annotation:LazyLoadingEnabled="true">
<EntitySet Name="TICKET" EntityType="MINE_EF_Test.TICKET" />
<EntitySet Name="TICKET_PROPERTIES" EntityType="MINE_EF_Test.TICKET_PROPERTIES" />
<AssociationSet Name="TICKET_PROPERTIES_TICKET_FK" Association="MINE_EF_Test.TICKET_PROPERTIES_TICKET_FK">
<End Role="TICKET" EntitySet="TICKET" />
<End Role="TICKET_PROPERTIES" EntitySet="TICKET_PROPERTIES" />
</AssociationSet>
</EntityContainer>
<EntityType Name="TICKET">
<Key>
<PropertyRef Name="GUID" />
</Key>
<Property Name="GUID" Type="String" Nullable="false" MaxLength="36" Unicode="false" FixedLength="false" />
<NavigationProperty Name="TICKET_PROPERTIES" Relationship="MINE_EF_Test.TICKET_PROPERTIES_TICKET_FK" FromRole="TICKET" ToRole="TICKET_PROPERTIES" />
</EntityType>
<EntityType Name="TICKET_PROPERTIES">
<Key>
<PropertyRef Name="FIELDNAME" />
<PropertyRef Name="GUID" />
</Key>
<Property Name="FIELDNAME" Type="String" Nullable="false" MaxLength="40" Unicode="false" FixedLength="false" />
<Property Name="FIELDVALUE" Type="String" Nullable="false" MaxLength="1000" Unicode="false" FixedLength="false" />
<Property Name="GUID" Type="String" Nullable="false" MaxLength="36" Unicode="false" FixedLength="false" />
<NavigationProperty Name="TICKET" Relationship="MINE_EF_Test.TICKET_PROPERTIES_TICKET_FK" FromRole="TICKET_PROPERTIES" ToRole="TICKET" />
</EntityType>
<Association Name="TICKET_PROPERTIES_TICKET_FK">
<End Role="TICKET" Type="MINE_EF_Test.TICKET" Multiplicity="1" />
<End Role="TICKET_PROPERTIES" Type="MINE_EF_Test.TICKET_PROPERTIES" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="TICKET">
<PropertyRef Name="GUID" />
</Principal>
<Dependent Role="TICKET_PROPERTIES">
<PropertyRef Name="GUID" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:ConceptualModels>
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="MINE_EF_TestStoreContainer" CdmEntityContainer="MINE_EF_TestContext">
<EntitySetMapping Name="TICKET">
<EntityTypeMapping TypeName="MINE_EF_Test.TICKET">
<MappingFragment StoreEntitySet="TICKET">
<ScalarProperty Name="GUID" ColumnName="GUID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="TICKET_PROPERTIES">
<EntityTypeMapping TypeName="MINE_EF_Test.TICKET_PROPERTIES">
<MappingFragment StoreEntitySet="TICKET_PROPERTIES">
<ScalarProperty Name="FIELDNAME" ColumnName="FIELDNAME" />
<ScalarProperty Name="FIELDVALUE" ColumnName="FIELDVALUE" />
<ScalarProperty Name="GUID" ColumnName="GUID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<Connection><DesignerInfoPropertySet><DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /></DesignerInfoPropertySet></Connection>
<edmx:Options />
<edmx:Diagrams >
<Diagram Name="MINE_EF_Test" ZoomLevel="96">
<EntityTypeShape EntityType="MINE_EF_Test.TICKET" Width="1.5" PointX="0.75" PointY="1.125" Height="1.4033821614583335" IsExpanded="true" />
<EntityTypeShape EntityType="MINE_EF_Test.TICKET_PROPERTIES" Width="1.5" PointX="2.75" PointY="1.25" Height="1.787985026041667" IsExpanded="true" />
<AssociationConnector Association="MINE_EF_Test.TICKET_PROPERTIES_TICKET_FK" ManuallyRouted="false">
<ConnectorPoint PointX="2.25" PointY="1.8891910807291668" />
<ConnectorPoint PointX="2.75" PointY="1.8891910807291668" />
</AssociationConnector>
</Diagram>
</edmx:Diagrams>
</edmx:Designer></edmx:Edmx>
Current EF version doesn't offer mapping records from related table to parent entity properties. Moreover this scenario requires dynamic properties because you can have different number of related record with different names.
You must use this approach:
MINE_EF_TestContext ctx = new MINE_EF_TestContext();
var someTickets = from t in ctx.Tickets
join p in ctx.Properties on t.Guid equals p.Guid
where p.FieldName == "FieldA" && p.FieldValue == "value a"
select t;

Entity Framework - inserting new entity via objectcontext does not use existing entity properties

I have an insert method on my repository like so:
public T Insert(T entity)
{
_ctx.AddObject(EntityName, entity);
_ctx.SaveChanges();
return entity;
}
If I execute the below code, the values assigned to my entity do not propagate to the SQL that is executed.
Category c = new Category();
c.Name = CLEARANCE;
c = categoryManager.Insert(c);
The SQL should be something like
INSERT INTO Category(Name) VALUES('Clearance')
Instead, the following SQL is being executed
insert [dbo].[Category]([Name])
values (null)
select [Id]
from [dbo].[Category]
where ##ROWCOUNT > 0 and [Id] = scope_identity()
I debugged the code right down to the AddObject method and verified that the Name property was set on the entity, but it doesn't reflect that in the SQL.
Can you see anything wrong with what I'm doing?
Updated with mapping xml
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="ProductCatalogModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
<EntityContainer Name="ProductCatalogModelStoreContainer">
<EntitySet Name="Category" EntityType="ProductCatalogModel.Store.Category" store:Type="Tables" Schema="dbo" />
<EntitySet Name="Product" EntityType="ProductCatalogModel.Store.Product" store:Type="Tables" Schema="dbo" />
<AssociationSet Name="FK_Product_Category" Association="ProductCatalogModel.Store.FK_Product_Category">
<End Role="Category" EntitySet="Category" />
<End Role="Product" EntitySet="Product" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Category">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="varchar" Nullable="false" MaxLength="50" />
</EntityType>
<EntityType Name="Product">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="varchar" Nullable="false" MaxLength="50" />
<Property Name="CategoryId" Type="int" Nullable="false" />
</EntityType>
<Association Name="FK_Product_Category">
<End Role="Category" Type="ProductCatalogModel.Store.Category" Multiplicity="1" />
<End Role="Product" Type="ProductCatalogModel.Store.Product" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Category">
<PropertyRef Name="Id" />
</Principal>
<Dependent Role="Product">
<PropertyRef Name="CategoryId" />
</Dependent>
</ReferentialConstraint>
</Association>
</Schema>
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="ProductCatalogModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityContainer Name="ProductCatalogEntities">
<EntitySet Name="Category" EntityType="ProductCatalogModel.Category" />
<EntitySet Name="Product" EntityType="ProductCatalogModel.Product" />
<AssociationSet Name="FK_Product_Category" Association="ProductCatalogModel.FK_Product_Category">
<End Role="Category" EntitySet="Category" />
<End Role="Product" EntitySet="Product" />
</AssociationSet>
</EntityContainer>
<EntityType Name="Category">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
<NavigationProperty Name="Product" Relationship="ProductCatalogModel.FK_Product_Category" FromRole="Category" ToRole="Product" />
</EntityType>
<EntityType Name="Product" Abstract="false">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Int32" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" />
<NavigationProperty Name="Category" Relationship="ProductCatalogModel.FK_Product_Category" FromRole="Product" ToRole="Category" />
</EntityType>
<Association Name="FK_Product_Category">
<End Role="Category" Type="ProductCatalogModel.Category" Multiplicity="1" />
<End Role="Product" Type="ProductCatalogModel.Product" Multiplicity="*" />
</Association>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
<EntityContainerMapping StorageEntityContainer="ProductCatalogModelStoreContainer" CdmEntityContainer="ProductCatalogEntities">
<EntitySetMapping Name="Category">
<EntityTypeMapping TypeName="IsTypeOf(ProductCatalogModel.Category)">
<MappingFragment StoreEntitySet="Category">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="Product">
<EntityTypeMapping TypeName="IsTypeOf(ProductCatalogModel.Product)">
<MappingFragment StoreEntitySet="Product">
<ScalarProperty Name="Id" ColumnName="Id" />
<ScalarProperty Name="Name" ColumnName="Name" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<AssociationSetMapping Name="FK_Product_Category" TypeName="ProductCatalogModel.FK_Product_Category" StoreEntitySet="Product">
<EndProperty Name="Category">
<ScalarProperty Name="Id" ColumnName="CategoryId" />
</EndProperty>
<EndProperty Name="Product">
<ScalarProperty Name="Id" ColumnName="Id" />
</EndProperty>
</AssociationSetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</edmx:Connection>
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
</DesignerInfoPropertySet>
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram Name="Model">
<EntityTypeShape EntityType="ProductCatalogModel.Category" Width="1.5" PointX="0.75" PointY="0.875" Height="1.427958984375" IsExpanded="true" />
<EntityTypeShape EntityType="ProductCatalogModel.Product" Width="1.5" PointX="3" PointY="0.875" Height="1.427958984375" IsExpanded="true" />
<AssociationConnector Association="ProductCatalogModel.FK_Product_Category" ManuallyRouted="false">
<ConnectorPoint PointX="2.25" PointY="1.5889794921875" />
<ConnectorPoint PointX="3" PointY="1.5889794921875" /></AssociationConnector>
</Diagram></edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>
I hate to say this, but all I did was mess with it for about an hour and now it works. I did not change a freaking thing. Thanks Microsoft for such a production ready technology.
Probably not related to this issue but a couple of things to think about with EntityFramework
The compilation is database specific. Problems can arise if you don't compile it against the database version you plan on using (eg. SQL Server 2005 vs 2000) - this can cause issues if your local DB is 2005 vs a test or production enviroment is 2000.
Making a small change to the edmx file, even something as small as moving an entity in the designer view will cause the database mapping files to recompile and can possibly fix issues related to mapping / etc.