Alfresco Workflow form save and close - forms

I have custom workflow where some fields are mandatory.Whenever I am saving that form,I need to fill all the mandatory field,
Is there any way where I can save form without filling mandatory field?

You should fill the mandatory field if you have some back end logic to continue the flow after verifying that mandatory field is not null.
Otherwise you can edit mandatory tag in your respective workflow-model.xml with some like below.
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
But this will work only if you have unaffeccted user or service task.
Other solution could be hard coding default values in .bpmn file

Related

SAP Flexible Workflow pre-condition value not loaded in edit mode

I've created a new pre-condition field in Workflow Flexible called Transfer Type with default domain values (T/B).
When I save the WF with T or B in this field it's OK, the value is saved.
But when I try to edit this workflow the value is cleared and we need to fill again the Transfer Type.
Question to the experts, how can I recover the value saved before in this field?
Thank you in advance!
In the OData field map:
/sap/opu/odata/sap/ZWF_FI_SEARCH_HELP_CDS/?$format=xml
<app:collection sap:creatable="false" sap:updatable="false" sap:deletable="false"
sap:searchable="true" sap:content-version="1" href="zC_FI_Transfer_Type">
<atom:title type="text">zC_FI_Transfer_Type</atom:title>
<sap:member-title>Check Budget</sap:member-title>
<atom:link href="zC_FI_Transfer_Type/OpenSearchDescription.xml" rel="search"
type="application/opensearchdescription+xml" title="searchzC_FI_Transfer_Type" />
</app:collection>
In SPRO path:

Can we hide system default fields from workItem form?

Can we be able to hide the system defaults fields on the workitem form?
For TFS 2017, On-premises XML process model: You can modify select elements within the SystemControls section, such as changing the EmptyText attribute value for the System.Title field. In general, we recommend you don't customize this section much more than that. For example, you can't remove fields from or add other fields within this section.
For TFS 2018, On-premises XML and Azure DevOps Services, Hosted XML process models: You can specify the ShowEmptyReadOnlyFields attribute, or select to hide or replace select fields defined within the SystemControls section.
For example, to hide the Reason field, you modify the Control element with the Visible attribute.
<Control Label="Reason" Type="FieldControl" FieldName="System.Reason" Visible="false" />
To replace the Reason field with another field, use the Replaces attribute. Also, remove the entry for the Reason field from within the section.
<Control Label="Milestone" Type="FieldControl" FieldName="Fabrikam.Milestone" Replaces="System.Reason" />
See more info in the docs.
If the process you are using is a custom process inherited from the template process, normally you can't hidden the default fields.
If your process is defined using a XML process model, as #ShaykiAbramczyk suggested, you can try to edit the XML file for the process definition to hidden the fields.

Rendering telephone links in HTL based on input from a Rich Text widget

I have a component using the Rich Text Edit widget (xtype="richtext") in my project that's used across the entire site as the default text component.
The users would like to be able to insert phone links using the tel URI scheme into the text entered using this component.
The dialog allows them to do so but when the contents of the Rich Text Edit are rendered in Sightly/HTL later on, the html context is used:
{$text # context='html'}
Once this is done, the value of my attribute is ignored.
The HTML stored in the repository is:
Call us!
And what's actually rendered on the page on the author instance is:
<a>Call us!</a>
on the publish instance, the tag gets removed altogether because of the link checker.
Changing the context to unsafe causes the href to render but it's not a solution I'm willing to accept. The component is used in a lot of places and I want to be sure the XSS protection is sufficient.
Is there a way I can affect the way the html context in HTL treats telephone links?
I tried adding an extra regular expression to the overlay of apps/cq/xssprotection/config.xml:
<regexp name="onsiteURL" value="([\p{L}\p{N}\\\.\##\$%\+&;\-_~,\?=/!]+|\#(\w)+)"/>
<regexp name="offsiteURL" value="(\s)*((ht|f)tp(s?)://|mailto:)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\##\$%\+&;:\-_~,\?=/!]*(\s)*"/>
<regexp name="telephoneLink" value="tel:\+?[0-9]+"/>
and further on:
<attribute name="href">
<regexp-list>
<regexp name="onsiteURL"/>
<regexp name="offsiteURL"/>
<regexp name="telephoneLink"/>
</regexp-list>
<!-- Skipped for brevity -->
</attribute>
but that doesn't seem to affect the way the Sightly/HTL escapes strings in the html context.
I've also tried overlaying the Sling xss rules located in /libs/sling/xss/config.xml but had no luck either.
How can it be done?
There are two xss protection config files:
/libs/cq/xssprotection/config.xml
/libs/sling/xss/config.xml
Sightly is using the second one, which means that you need to overlay it at path /apps/sling/xss/config.xml
What is worth mentioning is that new configuration seems to be applied only after restart of your aem instance.

Alfresco: how to change start task name of custom workflow?

I want workflow details page to show a descriptive name for the start task instead of the form id in History table. The name attribute of userTasks works fine, but I can't get it working on my startEvent. As seen below:
<startEvent id="start" name="Início" activiti:initiator="initiatorUserName"
activiti:formKey="workflowdocumentrequest:start">
<userTask id="userTask1" name="Revisão da Requisição de Documento Físico"
activiti:assignee="${workflowdocumentrequest_destination.properties.userName}"
activiti:formKey="workflowdocumentrequest:review">
What do I have to do?
Well, if you're developing a custom advanced workflow in Alfresco using Activiti you should check out this Jeff Pots guide.
Other than that, in order to use a customised string for your start event you should be familiar with content modeling and i18n properties files.
So for your startEvent you should have a specific workflow model declaring the workflowdocumentrequest:start type, something similar to this:
<type name="workflowdocumentrequest:start">
<parent>bpm:startTask</parent>
...
</type>
For that workflow content model you should have a specific i18n file, in messages folder called workflowdocumentrequestWorkflow.properties.
There you should have something like this:
workflowdocumentrequestWorkflow_workflowmodel.type.workflowdocumentrequestWorkflow_start.title=Início
The workflowdocumentrequestWorkflow_workflowmodel part is your namespacePrefixShortname_yourWorkflowModelName (the one you have used at the beginning of your workflow content model xml file <model name="workflowdocumentrequestWorkflow:workflowmodel xmlns="http://www.alfresco.org/model/dictionary/1.0">.
The .type. is obviously your custom type for the start event task.
The workflowdocumentrequestWorkflow_start is your type's name in your xml. Activiti engine and i18n file hase to be written with _ instead of :.
Hope it helps.
Cheers

grails access form attributes in controller

In grails i have a form with g:field tags like:
<g:field name="test" from="0..20"/>
I am trying to find a way how I can access the "from" attribute in my controller.
I can get the "value" attribute by using:
print params.test
I have tried:
print params.test.from
I'm sure there must be a way to do this but I can not seem to find it.
What I am wanting to achieve by this is perform validation so that the value does not go outside the the from range.
I know that this can be added in the domain, but in my situation I need to allow the user to overwrite the range constraints.
Any ideas?
By the time that code hits the browser, it is just HTML. from doesn't exist anymore. If that is being rendered into some sort of client side validation, that's not going to get submitted back to the server in a form submit.
If you explain what you are really needing to do in your question, I can provide a better answer.
You can pass the "from" values as hidden fields.
<g:hiddenField name="min" value="0" />
<g:hiddenField name="max" value="20" />
Something like that.