I would like to set up a generic process to retrieve specific information about a workflow via a java script node?
The specific information I would like to retrieve are :
1) Workflow name
2) Workflow path, for example for a technical work flow => administration/production/technical workflows/Work Flow Folder Name
Is there a list of workflow variables that are automatically set which can be retrieved?
Solved! Go to Solution.
You can use queryDef to fetch workflow details
var query = NLWS.xtkQueryDef.create( {queryDef: {schema: "xtk:workflow", operation: "select", select: { node: [{expr: "@id"}, {expr: "@label"}, {expr: "@internalName"}] }, where: { condition: [{expr: "[folder/@name]='nmsTechnicalWorkflow'"}, {expr: "@production = 1"}] }, orderBy: { node: {expr: "@internalName", sortDesc: "false"} } }}) var res = query.ExecuteQuery() var workflows = res.getElementsByTagName("workflow") for each (var w in workflows) logInfo(w.getAttribute("internalName"))
(https://experienceleague.adobe.com/developer/campaign-api/api/sm-queryDef-ExecuteQuery.html)
You can use queryDef to fetch workflow details
var query = NLWS.xtkQueryDef.create( {queryDef: {schema: "xtk:workflow", operation: "select", select: { node: [{expr: "@id"}, {expr: "@label"}, {expr: "@internalName"}] }, where: { condition: [{expr: "[folder/@name]='nmsTechnicalWorkflow'"}, {expr: "@production = 1"}] }, orderBy: { node: {expr: "@internalName", sortDesc: "false"} } }}) var res = query.ExecuteQuery() var workflows = res.getElementsByTagName("workflow") for each (var w in workflows) logInfo(w.getAttribute("internalName"))
(https://experienceleague.adobe.com/developer/campaign-api/api/sm-queryDef-ExecuteQuery.html)
@david--garcia Thanks, that helps. I don't see anything related to => Workflow path, for example for a technical work flow => administration/production/technical workflows/Work Flow Folder Name. Is this information available?
You can add the following expression to your query
[folder/@fullName]
Views
Replies
Total Likes
@david--garcia Thanks David, that's perfect.
To view "all your options" you can simply check them by right clicking on a workflow (in workflow view) then "configure list" to see all workflow attributes. That will give you an idea of what is available to use in your JS. While you can do this in JS, you can do the same thing in a standard Query if you needed to.