Following up on last weeks post, this week we will look at using our Azure Function app to post work item information from a custom task in the Cireson Portal to Slack.

Now that we have our Azure Function app in place and we know it’s working, you will be surprised how simple this custom task is going to be. It really just takes a basic knowledge of javascript and the underlying viewmodel in the Cireson Portal.

For information on customizing the Cireson Portal you can take a look at if you are an existing customer. I’m just going to give you a very brief explanation here.

Basically, when working with the portal you are going to do all your work in the CustomSpace folder. Specifically, most of what you will do can be done in the custom.js file in this folder. That is where we are going to be working today.

The first step is to setup a custom task using the following format:


You can add multiple tasks, and change the first variable to ‘ServiceRequest‘ or ‘ChangeRequest‘ in order for the task to show up on those forms as well. In this case we will just focus on the Incident form.

The second variable is the name you want the task to show up as. With just this bit of code saved in the custom.js we now see this on the Incident form:


Right now, if you were to click the link it would do absolutely nothing, as we have nothing in our code block… so let’s resolve that by adding the following code inside the codeblock:


Now if we save and refresh our page, we can click the task and we should see the information above (nearly identical to our post from postman previously) show up in Slack like this:


It worked, but you might have noticed an error in your browser developer tools though when you clicked the link. This has to do with CORS or the processes of passing a data request from one domain to another via the browser, it still worked so you can ignore this, but I don’t like errors so let’s see if we can fix it…

Open up your Azure portal and head over to your Azure Function app and select the ‘Function app settings‘:


From there we can select ‘configure CORS‘:


And then remove all of the existing sites and add a (*):


Save your settings and wait just a minute or so and then run your custom task from the portal again and this time you should see a clean developer console. With that you are pretty much set! We are now grabbing work-item data and posting it into Slack. We can then expand this a bit if we desired just to make the experience a little better.

As a quick example we will add a loading mask while the function is posting and then remove the mask when it posts successfully. To do this simply update your postToSlack function like so:


Now when you click the custom task you’ll see a waiting screen while the asynchronous function runs:


And then the mask is removed when the function completes, successfully or with an error.

That’s really all there is to it! You can add and remove properties that will be displayed in the text and even format the posts different by simply using mrkdwn in your text fields.

Next week I’ll show you how to use powershell and a scheduled task to do the same thing but for all newly created Incidents inside SCSM!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s