| | | Supreme Being
       
Group: Forum Members Last Login: Wednesday, March 05, 2008 Posts: 80, Visits: 277 |
| Hi there,
Is there a way of obtaining the current workflow execution id in design or run time?
I know how to do it with help from the parent, but I was wondering if there is any variable where this is stored.
Thanks in advance for your help,
Rui |
| | | | Supreme Being
       
Group: Forum Members Last Login: Friday, February 11, 2011 Posts: 13, Visits: 27 |
| | Hi Rui, Current workflow execution ID has no meaning in design time since at that time no execution is occuring. During runtime it depends upon the context of your code. For instance if you are creating custom activities you can get the ID using ExecutionID property of ExecutionContext. Arvind
Arvind Agarwal (Skelta) |
| | | | Supreme Being
       
Group: Forum Members Last Login: Wednesday, March 05, 2008 Posts: 80, Visits: 277 |
| You are right, I didn't express myself correctly.
What I meant was: Is there any way of defining something in design time that would allow me to get it in run time?
For example, you also cannot have a Parent Workflow Id in design time, but if you define a variable called ParentWorkflowId on your child workflow it will automatically be instantiated by the skelta workflow with the parent's execution id.
How can I do something like that but concerning the workflow itself and not it's parent.
Thanks,
Rui |
| | | | Supreme Being
       
Group: Forum Members Last Login: Friday, February 11, 2011 Posts: 13, Visits: 27 |
| You can get it in several ways,- If you want to use it any of the properties of an activity, you can use the small icon above the property to invoke the expression builder, where you can pickup executionId.
- In script activity, executionId is passed as a paramter.
- In Custom Activities, executionId is passed as a parameter again.
- Using the ExecutionContext object, the current running workflow executionId can also be retrieved.
Arvind Agarwal (Skelta) |
| | | | Supreme Being
       
Group: Forum Members Last Login: Wednesday, March 05, 2008 Posts: 80, Visits: 277 |
| Arvin,
First of all, let me thank you for your time and the proposed solutions.
As for the solutions itself, they are great and fortunately I had though of them already :-)
The thing is I needed this to use it as an argument for a web service.
In the beginning I was a bit lost and the first idea was to retrieve it from a variable (just like ParentworkflowExecutionId). Then I found out that we could get it on the expression editor (however you don't have expression editor for webservices arguments) , and that reinforced my idea that there would be a variable with that value stored.
Yesterday I found out about the script activity and I am now comparing the pros and cons of that solution with the one I currently have.
Currently, I always have a variable called "currentExecutionId" wich I update immediately when I start a workflow trough the API, or in the case we are on a child workflow I invoke a web service that will get that value from the parent workflow (based on the activity that called the childworkflow, i have the activity name on the contents)
What do you think it's the best approach?
I know that keeping thins on "skelta side" would probably be the best idea, but I'm still no sure.
The variable thing would really be the best
Thanks once again,
Rui
|
| | | | Supreme Being
       
Group: Forum Members Last Login: Friday, February 11, 2011 Posts: 13, Visits: 27 |
| | Better approach could be to update the variable using Script activity inside the workflow. If you want to use executionId in all your workflows, one more approach could be to extend the Start Activity Handler, and in IActionRun method of the inherited Start Activity you can store the executionId in some variable. This way you wont have to put script activity in every workflow for updating the executionId, however this will require you to inherit from the Start Activity.
Arvind Agarwal (Skelta) |
| | | | Supreme Being
       
Group: Forum Members Last Login: Wednesday, March 05, 2008 Posts: 80, Visits: 277 |
| Ok Arvind, thanks once again for your input.
I'll take a look to your latest suggestion when I have the time.
best regards,
Rui |
| |
|
|