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

Debugging Adobe Campaign Javascript

Avatar

Avatar
Validate 1
Level 2
akshayk23775697
Level 2

Likes

9 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
akshayk23775697
Level 2

Likes

9 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
akshayk23775697
Level 2

18-10-2019

Being new to Campaign I am having trouble debugging JS code In Campaign..

I have a general question on the debugging aspect of the Code ( javascript )

  1. How to see the XML that is being returned . I tried doing logInfo( response ) in the below code, but nothing is shown

var query = xtk.queryDef.create( 
  <queryDef schema="nms:recipient" operation="get">   
    <select>     
      <node expr="@firstName"/>     
      <node expr="@lastName"/>     
      <node expr="@email"/>   
    </select>       
  </queryDef>)

var response = query.ExecuteQuery()
lofInfo( response.recipient ); =>  shows nothing

2. What are the tips/guidelines  for debugging the javascirpt code  in Campaign ?  how do the experts do it   🙂

cheers

akshay

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Shape 1
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Shape 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Shape 1
MVP
Jyoti_Y
MVP

Likes

87 likes

Total Posts

123 posts

Correct Reply

55 solutions
Top badges earned
Shape 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
Jyoti_Y
MVP

20-10-2019

Hi,

Use below syntax:

var query = xtk.queryDef.create(
  <queryDef schema="nms:recipient" operation="get">  
    <select>    
      <node expr="@firstName"/>    
      <node expr="@lastName"/>    
      <node expr="@email"/>  
    </select>      
  </queryDef>)

var response = query.ExecuteQuery()

logInfo("response: "+ response.toXMLString());

Also if your output has more than one row then use for each loop.

for each( var res in response){

logInfo("response: "+ response.toXMLString());

}

Thanks.

Answers (3)

Answers (3)

Avatar

Avatar
Validate 10
MVP
MarcelSzimonisz
MVP

Likes

102 likes

Total Posts

224 posts

Correct Reply

56 solutions
Top badges earned
Validate 10
Validate 1
Shape 1
Boost 50
Boost 5
View profile

Avatar
Validate 10
MVP
MarcelSzimonisz
MVP

Likes

102 likes

Total Posts

224 posts

Correct Reply

56 solutions
Top badges earned
Validate 10
Validate 1
Shape 1
Boost 50
Boost 5
View profile
MarcelSzimonisz
MVP

21-10-2019

Hello,

You need to display res.toXMLString()  instead of response or directly res.@firstName res.@lastName or res.@email

Marcel

Avatar

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

89 likes

Total Posts

94 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Contributor
MVP
Raj_bounteous
MVP

Likes

89 likes

Total Posts

94 posts

Correct Reply

32 solutions
Top badges earned
Contributor
Shape 1
Give Back 10
Give Back 5
Give Back 3
View profile
Raj_bounteous
MVP

18-10-2019

hi,

logInfo( response.@firstName) will give log or for that matter any attribute you used in select node

2. What are the tips/guidelines for debugging the javascript code in the Campaign ?  how do the experts do it   🙂

use external debugger tools for the syntax and campaign does not have Linting to identify potential errors

Avatar

Avatar
Validate 1
Level 2
akshayk23775697
Level 2

Likes

9 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
akshayk23775697
Level 2

Likes

9 likes

Total Posts

11 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
akshayk23775697
Level 2

28-10-2019

thanks a lot @jyotij .. I owe you a beer