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

JS to check if a workflow is running

Avatar

Avatar
Validate 10
Level 2
maurizio_coro
Level 2

Likes

15 likes

Total Posts

37 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
maurizio_coro
Level 2

Likes

15 likes

Total Posts

37 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
maurizio_coro
Level 2

29-10-2018

Hi!

Is there any way to check from a JSSP page (inside AC) if a specific WF is actually running?

I can't use @state because it's always in "started"

Thanks a lot.

Maurizio

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 10
Level 2
sagil23995776
Level 2

Likes

17 likes

Total Posts

32 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
sagil23995776
Level 2

Likes

17 likes

Total Posts

32 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
sagil23995776
Level 2

29-10-2018

Hi,
If the workflow is always 'started' because there is a signal or scheduler activity

then you can just query how many activities (except for signals/schedulers) did not finish running - meaning the workflow is currently running.

You can do something like:

instance.vars.workflowId = <your workflow Id>

instance.vars.running=sqlGetDouble("select count(*) from xtkworkflowtask where iworkflowid= " + instance.vars.workflowId + " and tscompletion is null and sactivity <>'schedule' and sactivity <>'signal' ");

if instance.vars.running > 0 then your workflow is currently running.

Hope it helps,

Sagi

Answers (2)

Answers (2)

Avatar

Avatar
Coach
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

183 posts

Correct Reply

41 solutions
Top badges earned
Coach
Contributor
Shape 1
Give Back 25
Give Back 10
View profile

Avatar
Coach
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

183 posts

Correct Reply

41 solutions
Top badges earned
Coach
Contributor
Shape 1
Give Back 25
Give Back 10
View profile
david_garcia1
MVP

29-10-2018

You can also use the following method to check various states/statuses for one/multiple workflows

Here are the enum mappings

======================================

@state

0-Being edited

9-Request to start in simulation mode

10-Start requested

11-Started

12-Pause requested

13-Paused

14-Resume requested

15-Stop requested

16-Stop in progress

17-Restart requested

18-Restarting

20-Finished

======================================

@status

0-Not started

1-In progress

3-Suspended

4-Stop in progress

5-Finished

Avatar

Avatar
Validate 10
Level 2
maurizio_coro
Level 2

Likes

15 likes

Total Posts

37 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
maurizio_coro
Level 2

Likes

15 likes

Total Posts

37 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
maurizio_coro
Level 2

29-10-2018

Perfect! Thanks