The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we change the workflow of ITG based on status

Highlighted
sam.greg
Senior Member

Can we change the workflow of ITG based on status

Hi,

Can we change the workflow of an ITG based on status?

For example:

I have two Request Types called ‘A’(using workflow 'C') and ‘B’(using workflow 'D').

I have now created New ITG on request type ‘A’ and updated fields and now the workflow status is pending.
If workflow status changed to 'approved', ‘A’ ITG should use workflow ‘D’.
Key details such as title should be 'imported' into the ITG ’A’ and workflow status changed to 'closed'
Item closed (no further action required)
6 REPLIES
Mahen M
Honored Contributor

Re: Can we change the workflow of ITG based on status

Can you keep the status as a field and have a field change rule which change the workflow name based on your field?

Just a click of an idea, not sure how far it will succeed.

Regards,
Mahendran M
Jason Nichols K
Honored Contributor

Re: Can we change the workflow of ITG based on status

The description is a little vague, but it sounds like this is the scenario you trying to achieve: when a Request of Type 'A' is set to an Approved status, a new Request of Type 'B' is created. This would copy over fields that are in common (same Tokens) from 'A' to 'B'. Request 'A' then closes while 'B' continues as normal.

If this is the scenario you are going for, the answer is yes, it's possible. You would create an execution step that would use the ksc_copy_request command to create the new Request. Then the transition out of the execution step for a successful completion would be to a close step.
sam.greg
Senior Member

Re: Can we change the workflow of ITG based on status

Hi Mahendran,

Could you please provide me the query which chages the workflow name when status field changes.


Hi Jason,

when a Request of Type 'A' is set to an Approved status, workflow of 'A' should change to 'D' and Request 'A' should be closed

Re: Can we change the workflow of ITG based on status

Hi,

I'm not sure if Mahens suggest will work.
"Apply on Field change" rules will only fired when the user changes the field value in the request.

This solution can work:
Have a command execution step with Approved status.
1. Command:
Change Workflow Field:
ksc_itg_run_sql QUERY_STRING="SELECT workflow_id FROM kwfl_workflows WHERE workflow_name='D'"
ksc_store REQ.WORKFLOW_ID=[SQL_OUTPUT]
ksc_store REQ.WORKFLOW_NAME="D"

2. Command
Move Request to desired Step:
ksc_move_request_workflow REQUEST_ID="[REQ.REQUEST_ID]" FROM_WORKFLOW_STEP="1" TO_WORKFLOW_STEP="2" EVENT_NAME="FORCE_TRANSITION" RESULT_VISIBLE_VALUE="Automatic"


But there a some questions left:
1. Does the ksc_store work with build-in tokens? I guess not.
In this case you must create a database function to solve the issue.

2. Is it sufficient just to change the workflow field in the database and everything works? I guess not.
Maybe it is better to close the request first and change the workflow field after i.e with a database trigger.

3. Why?
I haven't understand why you want to move a request to a new workflow just to close it?

Complete other solution:
Configure workflow D as a subworkflow of workflow A.


Regards
Volker
Jason Nichols K
Honored Contributor

Re: Can we change the workflow of ITG based on status

I have to agree with Volker. I can't understand why you would want to change the workflow and the close the request immediately afterwards. Once a request is closed, no further processing is possible, so the workflow wouldn't matter. I guess I would like to have a better understanding of the requirement.

The Advanced Rules won't let you change the Workflow and changing it through a back end procedure is more complicated than just changing the field in the KCRT_REQUESTS table, so I would highly recommend you forget you even heard that option. You can change the Workflow through the Simple Defaults but only if the Department or Application fields change. Any other field would require using Advanced Defaults and the Workflow drops out of scope there.
Raj Ghimire
Occasional Visitor

Re: Can we change the workflow of ITG based on status

Looks like things are getting pretty complicated around here :-)
I have had to deal with similar situations in the past and we usually handle this kind of requirement by utilizing ITG Subworkflow functionality just like Volker mentioned in the very end of his comments. That should work wonderfully as that will also give you options to route back to "any" part of original workflow when needed "very easily". Guys, please remember, simpler the WF executions the better, especially for Support purposes.
Thanks.
-Raj
//Add this to "OnDomLoad" event