cancel
Showing results for 
Search instead for 
Did you mean: 

using localized value of constraint in share webscript

marcus_svensson
Champ in-the-making
Champ in-the-making
Hi

When using share forms for displaying node properties, localized constraint values are automatically translated by the forms engine.

We are outputting node properties outside of the forms engine in Share and we need to do the same there.
Does anyone know how to do the same in a share/repo webscript?

Just outputing the node property value will just give the value defined in the constarint, not the translated value.

Thanks!
Marcus
1 ACCEPTED ANSWER

Now I get it. According to Data dictionary guide right inscription is:

listconstraint.iww_reviewOutcomeOptions.Approve=Approve
listconstraint.iww_reviewOutcomeOptions.Reject=Reject
listconstraint.iww_reviewOutcomeOptions.Delegate=Delegate

View answer in original post

9 REPLIES 9

afaust
Legendary Innovator
Legendary Innovator
Hello,

you need to construct the message key for list constraint and obtain the translated value via the MessageService / msg root-scoped object (e.g. in FreeMarker template). The message key follows the pattern "listconstraint.<constraintName>.<value>"

Regards
Axel

pnature
Star Contributor
Star Contributor

Hi Axel.

What message key do you write about.

I have model defined in repo:

<type name="iww:reviewTask">
            <parent>bpm:activitiOutcomeTask</parent>
            <properties>
                <property name="iww:reviewOutcome">
                    <type>d:text</type>
                    <mandatory>false</mandatory>
                    <default>Delegate</default>
                    <index enabled="true"/>
                    <constraints>
                        <constraint name="iww:reviewOutcomeOptions" type="LIST">
                            <parameter name="allowedValues">
                                <list>
                                    <value>Approve</value>
                                    <value>Reject</value>
                                    <value>Delegate</value>
                                </list>
                            </parameter>
                        </constraint>
                    </constraints>
                </property>
            </properties>

What I have to put into messages/property file?

iww_workflowModel.constraint.iww_reviewOutcomeOptions.value=Approve?

afaust
Legendary Innovator
Legendary Innovator

In your case you would have properties like:

iww_workflowModel.constraint.iww_reviewOutcomeOptions.Approve=Translated value of Approve

iww_workflowModel.constraint.iww_reviewOutcomeOptions.Reject=Translated value of Reject

iww_workflowModel.constraint.iww_reviewOutcomeOptions.Delegate=Translated value of Delegate

I would always recommend to create a new question instead of responding to a 4-year old thread.

pnature
Star Contributor
Star Contributor

Thank you but it is not working for me.

Here is bootstrap-context:

    <bean id="acProcess-repo-amp.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/${project.artifactId}/model/content-model.xml</value>
                <value>alfresco/module/${project.artifactId}/model/workflow-model.xml</value>
            </list>
        </property>
        <property name="labels">
           <list>
              <value>alfresco/module/${project.artifactId}/messages/content-model</value>
              <value>alfresco/module/${project.artifactId}/messages/workflow-model</value>
           </list>
        </property>
    </bean>

labels from content-model work.

Alfresco documentation doesn't know constraint in properties pattern....

The naming convention patter for these resource properties are as follows:

{content model namespace}_{content model local name}.[type|aspect|property|association|child-association].{content model namespace}_{local name}.[title|description]

douglascrp
World-Class Innovator
World-Class Innovator

Even though the information is not in the documentation, it for sure works.

It would be nice if you send them a feedback on the topic, mentioning the documentation lacks that information.

Now I get it. According to Data dictionary guide right inscription is:

listconstraint.iww_reviewOutcomeOptions.Approve=Approve
listconstraint.iww_reviewOutcomeOptions.Reject=Reject
listconstraint.iww_reviewOutcomeOptions.Delegate=Delegate

marcus_svensson
Champ in-the-making
Champ in-the-making
Great, thanks for the quick reply. That way I would get the message key on the repository side, however, since the web script which generates the page is located in share this doesn't work.

Basically we are fetching all node properties on the repo side and consume them in the share web script. The server side script is generic, so it will just output all properties. The share webscript will format data and output it on a page.

One solution would be to duplicate the message bundle on the repo side and make it available in share as well, but I don't like duplicating stuff. I was more hoping for a service in share which will have access to all data model related translations, do you know of any?

Thanks,
Marcus

afaust
Legendary Innovator
Legendary Innovator
Hello,

I don't know of any service in Share that has access to ALL the data model translations. The FormUIGet has access to list of value constraints and their translations through the FormService. Other than that, I think you need to ship your own…

Regards
Axel

marcus_svensson
Champ in-the-making
Champ in-the-making
Thanks for the response. I ended up with just creating the message bundle on the share side as well as that was most time effective at the moment.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.