Skip to main content
Ken_Qrious
Level 4
December 2, 2021
Solved

Accessing work flow details in a javascript node

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.
david--garcia
david--garciaAccepted solution
Level 10
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)

https://www.linkedin.com/in/david-garcia-uk/ | https://martech.network

5 replies

david--garcia
david--garciaAccepted solution
Level 10
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)

Translate
https://www.linkedin.com/in/david-garcia-uk/ | https://martech.network
Ken_Qrious
Level 4
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?

Translate
david--garcia
Level 10
December 6, 2021

You can add the following expression to your query

 

[folder/@fullName]

 

 

Translate
https://www.linkedin.com/in/david-garcia-uk/ | https://martech.network
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.

 

Translate