Is there a way to refer to an existing Activity inside a ActivityDiagram (goto)

+6 votes
asked Feb 20, 2014 in Wanted features by micatom (120 points)
retagged Sep 18, 2015 by plantuml
Hello guys,

I just wanted to know if there is a way to refer from an outgoing action of an Activity to another alreay existing Activity (like a goto feature)

If not is it planned to be ?







:User Data Form << View >>;
if (email exists) then (yes)
 goto :User Data Form << View >>;
 :User Presentation Form << View >>;



2 Answers

+4 votes
answered Mar 6, 2014 by arnaud.bourree (140 points)


I'm not specially for goto keywork but, I personaly need possibility to simplify Activity2 like:

if (condition1?) then (yes)
  if (condition2?) then (yes)
else (no)

from 2 action KO to something like only one action KO



+4 votes
answered Aug 24, 2014 by plantuml (257,940 points)

Goto is one of the most asked feature, so we have decided to give a try.
The real issue with goto is that it is breaking the execution flow, and this is completely incompatible
with the way Activity Diagram are drawn.

However, nothing is ever impossible to do...

So starting with V8004, we have implemented a pre-alpha goto feature.
You can now use label/goto keywords to use goto feature:

label lab1
if (some test) then
  goto lab1

However, again, this is only pre-alpha software : the drawing is ugly (line in green), goto are only working backwards,
this is not working with swimlanes...

We need users help for two things:
1) We want to validate that everyone is ok with the syntax
2) More important, we are very interested by real diagrams from end users : this will indeed help us to build the design
of the solution for goto. So please either publish here (or send us by mail) the text diagram you wanted to see working
(even if it's not working with the V8004 version). We are waiting for real diagrams, large enough to be realistic.

Thanks for you help!

commented Dec 3, 2014 by Jerome2606 (100 points)
edited Dec 3, 2014 by Jerome2606
something like the sample with menu choosen on
And this is a diagram like we want to achieve with plantUML:
Finally here is a diagram from formation:
commented Mar 10, 2015 by Jerome2606 (100 points)

Is there any update for this most asked feature ?

commented Jun 17, 2015 by anonymous

I would need the goto to have the possibility to go back upwords if an error occurs

Is there anything I can help to improve the goto functionality?

commented Nov 24, 2016 by IanRogers (150 points)
General "goto" is always going to be a pain to implement and won't really reflect real code anyway... The "break" out of a loop(s) is much more useful.
commented Dec 11, 2018 by Nica MLG
Instead of

label X
goto X

Why not using "as" keyword and arrows?

:"Act 2" as label1;
if (contidion) then (No)
 :Decision 23;
:Next, please;

Using -> together with : before the alias to keep the semantics. Or something clearer.
Of course, a simple goto label1 could also be added, but in most cases, this approach would be enough. The old activity already does so when many activities point to the same activity name, right?
commented Nov 18, 2019 by Steve B.
Would also be possible to put an activity on that goto/return line?

I'm working through a process where I would like to do something like:

label Ticket
:Open Ticket;
:Review Ticket;
if (Submission Complete) then (no)
  return to Ticket
    :Assign Ticket to Originator;
    :Update Ticket;
else (yes)
:Process Ticket
commented Jan 27 by alexaiezza (100 points)

Unfortunately, this doesn't seem to help me still.

The closest I was able to get was to use break to just disconnect the if logic branch that I wanted to actually continue to the next item.

This is what I'm aiming for.

This is as close as I'm able to get by hacking around with the repeat keyword.

commented Mar 20 by TS

I want to do something similar but real simple - just a flowchart of "A or B" but it just doesn't completely connect the goto line. Some variations on this cause java exception with stack trace, but this is how I'd like to write the code

if (A) then (yes)
 goto success
else (no)
  if (B) then (yes)
    label success
    :A or B;
  else (no)

    / \
  <  A  >--yes------->
    \ /              |
     | no            |
     |               |
    / \          +--------+
  <  B  >--yes-->| A or B |
    \ /          +--------+
     | no            |


Unfortunately this doesn't work. I can kind of get this using the old style but don't like the layout because the layout is messier than it should be. (also it would be great if there were a skin parameter for making true go right and false go down)