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

Is it possible to control Scheduler activity with Javascript?

Avatar

Avatar
Validate 1
Level 1
uz2020
Level 1

Likes

0 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
uz2020
Level 1

Likes

0 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
uz2020
Level 1

12-03-2021

Hello.

Is it possible to control Scheduler activity with Javascript?

 

Example: Use Javascript to get the first Monday (Javascript is prepared) and reflect them in the scheduler.

Example: Use Javascript to get business or non-business days from your company's own calendar (Javascript is prepared) and reflect them in the scheduler.

 

If Javascript condition is met, the transition will be enabled, otherwise it will be disabled.

Thank you.

Accepted Solutions (0)

Answers (4)

Answers (4)

Avatar

Avatar
Validate 1000
Employee
Sukrity_Wadhwa
Employee

Likes

141 likes

Total Posts

859 posts

Correct Reply

35 solutions
Top badges earned
Validate 1000
Validate 500
Validate 250
Validate 100
Validate 25
View profile

Avatar
Validate 1000
Employee
Sukrity_Wadhwa
Employee

Likes

141 likes

Total Posts

859 posts

Correct Reply

35 solutions
Top badges earned
Validate 1000
Validate 500
Validate 250
Validate 100
Validate 25
View profile
Sukrity_Wadhwa
Employee

24-03-2021

Hi @uz2020,

Were you able to resolve this query or do you still need more help here? Do let us know.

Thanks!

Avatar

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

254 likes

Total Posts

367 posts

Correct Reply

150 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Boost 250
MVP
DavidKangni
MVP

Likes

254 likes

Total Posts

367 posts

Correct Reply

150 solutions
Top badges earned
Boost 250
Validate 1
Give Back 5
Give Back 3
Give Back 25
View profile
DavidKangni
MVP

15-03-2021

Hi @uz2020 

For the first case, just use the scheduler, by selecting monthly, you have first Monday option

DavidKangni_0-1615834867462.png

For your second case: if your calendar is accessible through API, you can do some api call to it and parse the response if it's a business day or not.

 

other choice instead of running permanently a scheduler is to calculate the condition from an external system and trigger the workflow with a signal.

Thanks,

David

Avatar

Avatar
Validate 1
Level 1
uz2020
Level 1

Likes

0 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
uz2020
Level 1

Likes

0 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
uz2020
Level 1

15-03-2021

@_Manoj_Kumar, Thank you for reply.

 

I understood that Advanced JS can branch judgments.
Is usage of Advanced JS correct in the following?

 

 

//First call
if(Today is first Monday and business day){
 task.postEvent(task.transitionByName("ok"));
}else{
 task.postEvent(task.transitionByName("no"));
}
task.setCompleted();

//Next call
return 0;

 

 

And, Is there no choice but to start the scheduler every day and use JS to determine the business day?

Thanks.

Avatar

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

111 likes

Total Posts

309 posts

Correct Reply

97 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile

Avatar
Validate 1
MVP
_Manoj_Kumar
MVP

Likes

111 likes

Total Posts

309 posts

Correct Reply

97 solutions
Top badges earned
Validate 1
Contributor
Ignite 1
Shape 1
Give Back 5
View profile
_Manoj_Kumar
MVP

13-03-2021

@uz2020 

 

Actually, you don't need a scheduler activity to do this.

 

Just use the Advanced javascript activity and enable the transition. If your condition met then run the workflow else divert the transition to the end activity.

 

The advanced javascript activity config will look like this.

_Manoj_Kumar_0-1615643632137.png

 

and the workflow will look like this.

_Manoj_Kumar_1-1615643676775.png

 

Let me know if that helps.