Set state of workitem while creating using Plain java Client
Accepted answer
Usually, when creating a work item, the initial activity will be used to set the initial state of the work item.
You have two options:
1. Pick a work flow action and provide that in a second save - the work item would undergo a valid workflow action and all workflow operational behavior is used.
2. Use the deprecated API setState2() to set a state - this avoids all regular workflow and is therefore not desirable, but it can be used in the initial save as well.
For some ideas about how to access workflows and states see https://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/ which explains all this.
PS: You can use Google to search and you can use the search box on https://rsjazz.wordpress.com/ to find examples for a lot of questions you might have.
You have two options:
1. Pick a work flow action and provide that in a second save - the work item would undergo a valid workflow action and all workflow operational behavior is used.
2. Use the deprecated API setState2() to set a state - this avoids all regular workflow and is therefore not desirable, but it can be used in the initial save as well.
For some ideas about how to access workflows and states see https://rsjazz.wordpress.com/2012/11/26/manipulating-work-item-states/ which explains all this.
PS: You can use Google to search and you can use the search box on https://rsjazz.wordpress.com/ to find examples for a lot of questions you might have.
Comments
Hi Ralph,
I used the 2nd option. It works.
Thanks!
Mind that it is deprecated and could be removed at any time. Mind that it is also the only way to do it in one step. Also mind that it does not trigger a workflow action and if you have operational behavior configured it might not get triggered.