Advanced JavaScript Activity | Community
Skip to main content
Level 2
January 18, 2024
Solved

Advanced JavaScript Activity

  • January 18, 2024
  • 2 replies
  • 1358 views

Hi team,

 

1) Anyone help me What is the use of Advanced JS activity in Adobe Campaign Classic?

2) What is the use of First call and next calls?

3) what is task.setCompleted();

4) what is return 0 in both calls?

 

please any one help me any share use case for clarify this question?

@parthasarathy 

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 AnanthanJa

Hi @kumar_27,

 

The First Call is the code base which will be executed at each start of the workflow.

 

The next call is the code which will run post the first call. If you are using the scheduler functionality in the Advanced Javascript, then first run of the Advanced JS will trigger the First Call code block and then Next call.

 

Subsequent runs triggered by scheduler within Advanced JS will trigger only the next call and not the first call.

 

Transitions similar to split help to change the flow of data based on some inputs which can be configured programmatically. For transitions consider the following example:

 

var input = 1;
if(input == 1)
{
task.postEvent(task.transitionByName('ok'));
}
else
{
task.postEvent(task.transitionByName('notOk'));
}

 

As we see in the above example, the code will evaluate to give output to the 'Ok' transition and hence the workflow will move towards 'Ok' transition.

 

If the value of input was any numeric value other than 1, then the workflow will move to notOk transition.

 

Refer to following link for more info:

 

https://blog.floriancourgey.com/2018/06/how-to-specify-the-transition-in-an-advanced-javascript-code-in-adobe-campaign

2 replies

Parvesh_Parmar
Community Advisor
Community Advisor
January 18, 2024
Parvesh Parmar – Adobe Community Advisor https://www.linkedin.com/in/parvesh-parmar/
AnanthanJaAdobe EmployeeAccepted solution
Adobe Employee
January 20, 2024

Hi @kumar_27,

 

The First Call is the code base which will be executed at each start of the workflow.

 

The next call is the code which will run post the first call. If you are using the scheduler functionality in the Advanced Javascript, then first run of the Advanced JS will trigger the First Call code block and then Next call.

 

Subsequent runs triggered by scheduler within Advanced JS will trigger only the next call and not the first call.

 

Transitions similar to split help to change the flow of data based on some inputs which can be configured programmatically. For transitions consider the following example:

 

var input = 1;
if(input == 1)
{
task.postEvent(task.transitionByName('ok'));
}
else
{
task.postEvent(task.transitionByName('notOk'));
}

 

As we see in the above example, the code will evaluate to give output to the 'Ok' transition and hence the workflow will move towards 'Ok' transition.

 

If the value of input was any numeric value other than 1, then the workflow will move to notOk transition.

 

Refer to following link for more info:

 

https://blog.floriancourgey.com/2018/06/how-to-specify-the-transition-in-an-advanced-javascript-code-in-adobe-campaign