We have Alfresco (Community Edition 4.2) environment set on Server. WE created some websites and Custom content model and deployed on server.
We are facing following issues which need to resolved.
RTF Field : In custom content model we have defined a rtf field. This rtf field is not saving its value.
Folder Creation: There is no option available to create Folders in Document library.
Web Script Query: We need to write webscript queries to fetch the data for each website separately.
following is code from share-forms-config for RTF fields
<config evaluator="node-type" condition="custom:questionscategory">
<forms>
<!-- Default form configuration for the cm:content type -->
<form>
<field-visibility>
<show id="cm:name" />
<show id="custom:categoyTitle" />
<show id="custom:categoryDesc" />
</field-visibility>
<appearance>
<field id="custom:categoryDesc">
<control template="/org/alfresco/components/form/controls/richtext.ftl">
<control-param name="editorAppearance">full</control-param>
</control>
</field>
</appearance>
</form>
<form id="doclib-simple-metadata">
<field-visibility>
<show id="cm:name" />
<show id="custom:categoyTitle" />
<show id="custom:categoryDesc" />
</field-visibility>
<appearance>
<field id="custom:categoryDesc">
<control template="/org/alfresco/components/form/controls/richtext.ftl">
<control-param name="editorAppearance">full</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="model-type" condition="custom:questionscategory">
<forms>
<!-- Default form configuration for the cm:content type -->
<form>
<field-visibility>
<show id="cm:name" />
<show id="custom:categoyTitle" />
<show id="custom:categoryDesc" />
</field-visibility>
<appearance>
<field id="custom:categoryDesc">
<control template="/org/alfresco/components/form/controls/richtext.ftl">
<control-param name="editorAppearance">full</control-param>
</control>
</field>
</appearance>
</form>
</forms>
</config>
here is the query I have written to fetch data..I need to add website name to it
// locate folder by path
// NOTE: only supports path beneath company home, not from root
var query='TYPE:custom\:questionscategory';
var fbaQuetions = search.luceneSearch(query);
if (fbaQuetions== undefined || fbaQuetions.isContainer)
{
status.code = 404;
status.message = "fbaQuetions " + url.extension + " not found.";
status.redirect = true;
}
model.folder = fbaQuetions;
For number 2. The answer probably lies in lack of permissions, make sure you have the right privileges in the site, that is at least contributor.
To answer your other questions we need more information:
What do you mean by RTF-field? What datatype are we talking about? Could you post snippets from your custom model togheter with the appropriate share-forms-config section?
There are a lot of webscripts present to fetch data per site. In fact Alfresco Share only uses webscripts to talk to the repository. What data do you need?
Update: Extend your search query with a "+PATH" which searches just in your site expression.
ie: "PATH:"/app:company_home/st:sites/cm:yoursiteshortname//*"
This looks like a bug that has been patched, I've got a similar problem.
https://issues.alfresco.com/jira/browse/MNT-10238?jql=text%20~%20%22r57658%22
I'm going to upgrade to get the patch.
Related
I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>
I need to hide workflow task custom properties from the workflow-details and task-details page and show only on task-edit page.Currently it is visible on all the three pages.
abcmodel.xml
<type name="abc:review">
<parent>bpm:activitiOutcomeTask</parent>
<mandatory-aspects>
<aspect>abc:Info</aspect>
</mandatory-aspects>
</type>
<aspects>
<aspect name="abc:Info">
<properties>
<property name="abc:Det">
<type>d:mltext</type>
</property>
</properties>
</aspect>
</aspects>
shareconfigcustom.xml
<config evaluator="task-type" condition="abc:review">
<forms>
<form>
<field-visibility>
<show id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
<field id="abc:Det" label="customproperty" read-only="true">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">color: black</control-param>
<control-param name="rows">6</control-param>
<control-param name="columns">6</control-param>
</control>
</field>
<field id="bpm:comment" label="Comments">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
You can use form-id to control them.
To hide the field(abc:det) in the workflow details page, you can use like,
<config evaluator="task-type" condition="abc:review">
<forms>
<form>
<field-visibility>
<show id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
<field id="abc:Det" label="customproperty" read-only="true">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">color: black</control-param>
<control-param name="rows">6</control-param>
<control-param name="columns">6</control-param>
</control>
</field>
<field id="bpm:comment" label="Comments">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
<!-- Form configuration for workflow-details page -->
<form id="workflow-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
<!-- Form configuration for task-details page -->
<form id="task-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
</forms>
</config>
I hope you can use, '' to configure the task-details, but I haven't tried it yet.
Update
For the task-details, there is no specific form-id is used in data-form section. Refer C:\<Alfresco_Home>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-data\pages\task-details.xml
<!-- Data Form -->
<component>
<region-id>data-form</region-id>
<url>/components/form</url>
<properties>
<itemKind>task</itemKind>
<itemId>{taskId}</itemId>
<mode>view</mode>
<formUI>true</formUI>
</properties>
</component>
To customise this task-details form, I added <formId>task-details</formId> as mentioned below.
<!-- Data Form -->
<component>
<region-id>data-form</region-id>
<url>/components/form</url>
<properties>
<itemKind>task</itemKind>
<itemId>{taskId}</itemId>
<mode>view</mode>
<formUI>true</formUI>
<formId>task-details</formId>
</properties>
</component>
You need to use share extension / customisation best practices to change the OOTB files in share.
Alfresco Share extensions
Finally in the share-config-custom.xml file add the configuration like,
<form id="task-details">
<field-visibility>
<hide id="abc:Det"/>
<show id="bpm:comment" />
</field-visibility>
<appearance>
.....
</appearance>
</form>
All set to go and it is working fine to me.
shareconfigcustom.xml
text box accepts unlimited characters with these parameters not resizing properly at the create form alfresco but working in edit-form(accepts defined number of characters)
Also is there any maximum limit for the number of characters ?
<config evaluator="node-type" condition="acme:document">
<forms>
<form>
<field-visibility>
<show id="acme:anycustomproperty"/>
</field-visibility>
<appearance>
<field id="acme:anycustomproperty" label-id="xqw">
<control template='/org/alfresco/components/form/controls/textfield.ftl' />
<control-param name='maxlength'>5000</control-param>
<control template='/org/alfresco/components/form/controls/textarea.ftl' />
<control-param name='rows'>10</control-param>
<control-param name='columns'>10</control-param>
</field>
</appearance>
</form>
</forms>
</config>
textatrea.ftl only provides, rows & columns property. Please ensure that, you've used textarea.ftl, but your post says, that you've used, textfield.ftl.
textarea.ftl
<#if field.control.params.rows??><#assign rows=field.control.params.rows><#else><#assign rows=3></#if>
<#if field.control.params.columns??><#assign columns=field.control.params.columns><#else><#assign columns=60></#if>
This configuration worked for me for edit and creation page as well
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="rows">4</control-param>
<control-param name="columns">4</control-param>
<control-param name="maxLength">5000</control-param>
</control>
I need to set a value from a text field on my start form and then pull this information on several other tasks. To do this, I'm using an aspect and trying to send the data up to the execution variable, and then pull it down.
The problem is that I cannot send the value from the start form to the execution variable. As it is now, Share will just say that the workflow cannot be started.
I am using Alfresco 4.2.f Community edition.
The start event is defined in the BPMN as follows:
<startEvent id="start" name="Start Delivery Ticket Workflow" activiti:initiator="initiatorUserName" activiti:formKey="deliveryTicketWorkflow:start">
<documentation>Project Manager initiates workflow. A customer purchase order is provided, along with the specific line items for the delivery ticket.</documentation>
<extensionElements>
<activiti:executionListener class="org.alfresco.repo.workflow.activiti.listener.ExecutionListener" event="start">
<activiti:field name="script">
<activiti:string><![CDATA[
execution.setVariable('deliveryTicketWorkflow_requestdetailstext', task.getVariable('deliveryTicketWorkflow_requestdetailstext'));;
]]></activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
</startEvent>
The relevant parts of my model are:
<type name="deliveryTicketWorkflow:start">
<parent>bpm:startTask</parent>
<properties />
<associations />
<overrides />
<mandatory-aspects>
<aspect>deliveryTicketWorkflow:requestdetails</aspect>
</mandatory-aspects>
</type>
[...]
<aspect name="deliveryTicketWorkflow:requestdetails">
<properties>
<property name="deliveryTicketWorkflow:requestdetailstext">
<title>Specific Details</title>
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
</properties>
</aspect>
In the config:
<config condition="deliveryTicketWorkflow:start" evaluator="task-type">
<forms>
<form>
<field-visibility>
<show id="packageItems"/>
<show id="deliveryTicketWorkflow:requestdetailstext"/>
<show id="transitions"/>
</field-visibility>
<appearance>
<set appearance="title" label-id="Prepare Delivery Ticket" id="info"/>
<field set="info" id="packageItems"/>
<field set="info" label-id="Request Details" id="deliveryTicketWorkflow:requestdetailstext">
<control template="/org/alfresco/components/form/controls/info.ftl"/>
</field>
<set id="response"/>
<field set="response" id="transitions"/>
</appearance>
</form>
</forms>
</config>
[...]
<config condition="activiti$deliveryTicketWorkflow" evaluator="string-compare">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowPriority"/>
<show id="packageItems"/>
<show id="deliveryTicketWorkflow:requestdetails"/>
<show id="transitions"/>
<show id="deliveryTicketWorkflow:approveRejectOutcome"/>
</field-visibility>
<appearance>
<set appearance="title" label-id="Request Delivery Ticket" id="info"/>
<field set="info" label-id="workflow.field.priority" id="bpm:workflowPriority">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl"/>
</field>
<field set="info" id="packageItems"/>
<field set="info" label-id="Request Details" id="deliveryTicketWorkflow:requestdetails">
<control template="/org/alfresco/components/form/controls/textarea.ftl"/>
</field>
<set id="response"/>
<field set="response" id="approveRejectOutcome">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl"/>
</field>
<field set="response" id="transitions"/>
</appearance>
</form>
</forms>
</config>
I have seen at least one question here that was similar, but the answers were stating to use task listeners for the start form. I'm not sure at all how that is intended to function, because it seems like a start task isn't a "true" task and can only use ExecutionListeners. The difference should be small, but it seems that any reference to "task" in the start task will either cause a failure or just have no affect at all. Becasue I can't use task.getVariableLocal() to get the value, I don't see what to give to execution.setVariable() as the value.
In my experience, all values of aspects and properties in a start task are automatically copied to the executionContext and are already available for future tasks.
Try removing the executionlistener in your BPMN, you shouldnt need that. Then try making a starttasklistener on your subsequent task that copyies the value from your execeutioncontext into this task. It should work fine.
Getting the var back from your executioncontext in your subsequent task should work like this:
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="language" stringValue="groovy" /
<activiti:field name="script">
<activiti:string><![CDATA[
System.out.println(execution.getVariable("deliveryTicketWorkflow_requestdetailstext"));
if (execution.getVariable("deliveryTicketWorkflow_requestdetailstext") != null){
task.setVariableLocal('deliveryTicketWorkflow_requestdetailstext', execution.getVariable("deliveryTicketWorkflow_requestdetailstext"));
}]]>
</activiti:string>
</activiti:field>
</activiti:taskListener>
This is a long shot but in your share form, your custom field is using the info control:
I believe you need there to be a regular field there, the info field is to display text, AFAIK, it doesn't include an input field and won't send anything to the workflow start.
I create a product of type abc:product with a product Id - 12345 (for example) in the abc:productId field.
I have a type called abc:productContent with the abc:productNumber field. Now when I'm creating the document of type abc:productContent, I'm trying to populate the abc:productNumber field with the value of the above mentioned product Id of abc:product object (and make the field read only).
How to achieve the above?
Thank you for the help
You need a form definition such as:
<alfresco-config>
<!-- ... -->
<config evaluator="model-type" condition="abc:productContent">
<forms>
<form>
<field-visibility>
<!-- ... other fields -->
<show id="abc:productNumber"/>
<!-- ... more fields -->
</field-visibility>
<appearance>
<!-- ... other fields -->
<field id="abc:productNumber" mandatory="true">
<control template="/xxx/value-from-url.ftl" />
</field>
<!-- ... even more ...>
</appearance>
</form>
</forms>
</config>
<!-- ... -->
<alfresco-config>
Append the a parameter with the productNumber value you want to the create-content link in the dashlet.
In your custom value-from-url.ftl (see /org/alfresco/components/form/controls/*.ftl for examples), get the value from the url and put it in the input field.