Tag Archives: workflow

SCSM workflow to add UserInput to work item description

I often get the question from customers that are using SCSM how can we get the user input to the description. Out-of-the-box SCSM will place this in a field called UserInput.

This can be frustrating for some customers because they want to be able to send out an email like this”your request is now registered with the following information”. We would just use the normal email templates and add UserInput it would look something like this.

This is not a very good formatting to use in a email to the end-user. Therefor i have created a SCSM PowerShell workflow that will check for all new SR and IR if they contain any UserInput and if it does it will add that to the description. If there already is a description the UserInput will be added below that text. So if we look at the example a before it will look like this instead.

Now this is much better for an end-user to read. The solution will take all the questions on every request offering there is in the system and add it to the description. The solution is not sealed so feel free to modify the code to fit your need.

Below is a code snip from the service request part where i will explain what i am doing.

First we get the service request object so we have something to work with.

Save the UserInput to a variable

We need an array to save all the question with answers so we call that one $UserInput and we have to check if there is a description already. If it is save it to the userinput array.

The next step is to go throw the Questions in the XML-code. We are doing a split to get each question/answer to a row and then go row to row and extract the information we need. And save the question with answers to the array  $userinput

The last step is to add all information saved in $userinput to the description on the work item.

Tip: If you want to send out an email with your case is now registered in our system i recommend to modify this workflow some. Make the workflow set a tag in the SR class for example and when that value is met you can trigger a new workflow to send out an email.

Why should i do this? If you have an email subscription with criteria send on object created the email can be sent before the user input workflow has run and you don’t get a complete description to the end-user.

This function is not excessive tested so it’s up to you to test it and find possible bugs. The full code is available at Technet gallery, Click here for a link

 

Check for failed workflow jobs in SCSM using powershell

You might have seen that SCSM uses many workflows for different things. You might wanna take a look on the status of the jobs. If you go to your administration tab and workflows -> status you will se a big list.

scsm_wf_list

You can manually go into each workflow and click on the need attention or all instance tab. This is time consuming and you might only want to see what jobs has failed.

scsm_wf_check

 

One way to get this done is using powershell. If we run the script below.

The output will be something like this below. You can now easy parse all the workflows and check for failed jobs.

scsm_wf_script

 

Be aware that this script is pretty resource heavy. So don’t let it run all the time.