Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Workflow branch based on tags via ECMA Scripts

Avatar

Avatar
Validate 1
Level 2
davenichols79
Level 2

Likes

4 likes

Total Posts

16 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 3
Boost 3
Boost 1
Give Back
View profile

Avatar
Validate 1
Level 2
davenichols79
Level 2

Likes

4 likes

Total Posts

16 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 3
Boost 3
Boost 1
Give Back
View profile
davenichols79
Level 2

07-06-2018

Hi,

Please can somebody help or point me in the right direction.  I'm creating some workflows for assets and setting up some "OR branches".  I have been using the example in ECMA Script on the Adobe documentation based on location of the asset, but I would really like to base the "or branches" on the tags that the asset has or if not possible then the meta data of the asset.

Is it possible to use ECMA Script to get the tags on the asset that the workflow is running on and can anybody please point me in the right direction to documentation or provide an example where ECMA Script is picking up the asset tags and checking for one ?

Thank you very much for your time.

Replies

Avatar

Avatar
Validate 1
Level 2
davenichols79
Level 2

Likes

4 likes

Total Posts

16 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 3
Boost 3
Boost 1
Give Back
View profile

Avatar
Validate 1
Level 2
davenichols79
Level 2

Likes

4 likes

Total Posts

16 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Affirm 3
Boost 3
Boost 1
Give Back
View profile
davenichols79
Level 2

28-06-2018

For anybody interested, we managed to do this using the script below.  Thanks.

function getParticipant() {

   

    var workflowData = workItem.getWorkflowData();

var path = workflowData.getPayload().toString();

    log.info(path);

    var node = workflowSession.getSession().getNode(path);

    var tagValues = node.getNode("jcr:content").getNode("metadata").getProperty("cq:tags").getValues();

    for (var i=0 ; i < tagValues.length; i++) {

        if(tagValues[i] == "global:test/testing") {

            return "Product Marketing";

        }else{

            return "Technical";

        }

    }

return "Product Marketing";

}