Accessing work flow details in a javascript node | Community
Skip to main content
Ken_Qrious
December 2, 2021
Solved

Accessing work flow details in a javascript node

  • December 2, 2021
  • 2 replies
  • 1557 views

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?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by david--garcia

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)

2 replies

david--garcia
david--garciaAccepted solution
December 2, 2021

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)

Ken_Qrious
December 5, 2021

@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?

david--garcia
December 6, 2021

You can add the following expression to your query

 

[folder/@fullName]

 

 

David_Loyd
Adobe Employee
Adobe Employee
December 2, 2021

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.