VMware Cloud Community
Aramaki
Contributor
Contributor
Jump to solution

How to abort a workflow?

Hello,

as you know from my other threads, i have created a workflow with a webview which is designed to apply changes to a machines CPU/memory.

I also imlpemented a function which verifies if the machine is powered down or hotplug capable and if it is not, then the VM will be powered down on a user specified date and time. I used a waiting timer for this.

Now what if a user specified a wrong date and needs to abort the workflow he just launched in order to run a new one with the correct date?

Is it possible to abort a workflow while it's waiting for the specified date and time?

If yes, how can i do that? Preferably via a webview.

Thanks

Andreas

0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Jörg Lew wrote:

Hi!,

maybe the brand new article on www.vcoteam.info may help...:

http://www.vcoteam.info/learn-vco/code-snippets-cancel-one-of-your-running-workflows.html

Cheers,

joerg

I have posted the article and I was intending to link it from here but you managed to notice the article and post here before I did Smiley Happy

Have a great week-end !

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
11 Replies
Andreas_Diemer
Enthusiast
Enthusiast
Jump to solution

Hi Andreas,

assuming user is using a portal shown at VCO-Team, he cannot see his executions. So you have to build a own workflow which presents the user his running (waiting) tasks from the desired workflow in a dropdown box for deletion.

Each workflow has a list of his instances (Workflow.executions as Array of Workflowtoken), including running, waiting, completed, failed and so on. You can filter these list by waiting and running user (if you do not use a service user for this) and build an array for the dropdown box. From this WorkflowTokens you can also retrieve the used parameters e.g. to filter / search for the VM name.

Regards, Andreas

------ for correct and / or useful answers please award points visit http://www.vcoteam.info & http://mighty-virtualization.blogspot.com
0 Kudos
Aramaki
Contributor
Contributor
Jump to solution

Hi Andreas,

Yes, i already thought about creating a separate workflow for this which has its own webview.

Since our users are using their own logins and not a service user, there should be no problem to filter by user.

But how can i read out the user from a webview and pass it to the workflow?

Thanks

0 Kudos
Andreas_Diemer
Enthusiast
Enthusiast
Jump to solution

Hi,

RainerVM has done so - I'm just looking for the post / info

------ for correct and / or useful answers please award points visit http://www.vcoteam.info & http://mighty-virtualization.blogspot.com
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Hi!

Also have a look at the actions in the com.vmware.web.webview-module. There are a couple of actions available which return the ExecutionToken for the current user, for a workflow category and so on.

regards,

joerg

Aramaki
Contributor
Contributor
Jump to solution

How can i get a dropdown box to display the informations of getExecutionsForCurrentUser?

Note that i also need to display the name of the VM which is going to be edited by the workflow.

0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

cdecanini_
VMware Employee
VMware Employee
Jump to solution

Jörg Lew wrote:

Hi!,

maybe the brand new article on www.vcoteam.info may help...:

http://www.vcoteam.info/learn-vco/code-snippets-cancel-one-of-your-running-workflows.html

Cheers,

joerg

I have posted the article and I was intending to link it from here but you managed to notice the article and post here before I did Smiley Happy

Have a great week-end !

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
Aramaki
Contributor
Contributor
Jump to solution

Hi Christophe,

i just tried using the action from vcoteam and am encountering a problem:

I've created the action and am trying to use it for the predefined list of elements.

When i click on the little "select action" button, the new action is not being displayed there.

Orchestrator is not displaying any errors within the action, but i'm wondering why the "in" of the for-loop is being displayed in red.

Any ideas, why I can't use it?

EDIT: Oh well, now i know. Forgot to set the return type of the Action -.-

Shame on my blindness.

Thanks and

Regards

Andreas

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

If you do not see the action when you click on the "Select action button" it is certainly because you forgot to set a return type of array of workflowtoken in your action.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
Aramaki
Contributor
Contributor
Jump to solution

Hi Christophe,

i just found out, that your action isn't running as it's supposed to.

I was trying to get the email-address out of the Server.getCurrentLdapUser() and wondered, why the attribute .emailAddress always was empty.

So i tried to get the .username attribute, since i thought it is working in your action. But, this attribute also was empty.

So i asked my colleague to launch the workflow, which is waiting until a given time. After this, i launched the workflow to abort the running workflow and suprisingly i could see the workflowtoken which hat the username of my colleague. Since we use different users, this should not have happened.

Here is the code i used to verify if there are any values:

name = Server.getCurrentLdapUser().username;

address = Server.getCurrentLdapUser().emailAddress;
System.error(name + ", " + address);

and this is the output:

[2011-01-25 15:34:02.368] [E] undefined, null

as you see, the ", " is being inserted correctly but both strings are not containing the information they should contain.

Since i need the E-Mail-Address of the user executing the workflow to notify him about success/failure, this is really important.

Is there a way to get this working correctly?

Thanks and

Regards

Andreas

0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Hi Andreas,

Please look at my comment

Apologies for the unconvenience. This article was rushed.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos