Creating a Change from workflow using template AND variables

FinToy
Mega Expert

Hi guys,

After reading a couple of days Docs and this forum, I still didn't find the answer.

(link to Docs: Scripted templates)

I'm running a workflow from RITM and creating a Change ticket with a couple of change tasks. I'm using a template to create all these -- success.

However, the template is not adding the affected CI to the change ticket and I also cannot add it by passing the values from the workflow. If I don't apply the template, the values are passed successfully but together with template it seems that it's not possible. Can someone suggest a workaround?

1 ACCEPTED SOLUTION

FinToy
Mega Expert

Finally got this working. I created an event that I launch from Change Request workflow as a final task. RITM workflow then waits for this event and continues after it's launched.


View solution in original post

12 REPLIES 12

FinToy
Mega Expert

OK guys.



The reason the first script doesn't need a row change.insert (or update) is that the template has child templates. When I took those off, Change ticket was not created anymore. Then I just added rows:


change.cmdb_ci = current.configuration_item;


change.parent = current.number;


change.insert();


And Change ticket is now created using template. Just like I wanted.



Next solution was to modify the Change process workflow to add child tasks (again, using a template) with another workflow (as the original workflow also does) - and wait for that to complete before creating the second one. Now I was also able to pass affected CI from current ticket to the child task. Child tasks are also completed in the correct order and the later task is not created until the first one is complete. Excellent!



Now the last issue is left:


The original RITM ticket is waiting for the Change ticket to close. In my workflow, I have a "Wait for" condition that checks whether the change ticket is in state "Closed". When a change ticket is closed, it writes comments to the RITM and changes the State from 'Pending' to 'Open'. I tried using both these as indicator for the workflow to continue but no success. Help with this?


Surendra Raika1
Kilo Guru

So now you have change.insert() in the added code lines.




Yes. Do you have any idea for the last issue? How can I check that the Change ticket is closed as I explained in my previous message?


FinToy
Mega Expert

Finally got this working. I created an event that I launch from Change Request workflow as a final task. RITM workflow then waits for this event and continues after it's launched.


Krithi
Tera Contributor

Hi latvamik,

 

am trying to create the change request using template from workflow. Change Tasks are not getting attached to it. can someone help me with this?