How to configure notification workflow to notify if assigned to user is empty or Incident is not assigned

In this blog post, I will walk you through the steps to configure the notification workflow to notify if assigned to user field is empty for Incident/Service Request.

We get frequent requests from customers on how to create notification workflow to notify if assigned to user filed is empty for Incident or Service Request. Currently this is not possible out of the box but this can be done using XML magic.

For this blog post, I'll create the notification workflow which will notify helpdesk every 10 mins until the Incident/Service Request is assigned.

So lets start,

For detailed steps on creating notification workflow in Service Manager, please refer this TechNet link https://technet.microsoft.com/en-us/library/hh519719.aspx

Step 1: Create notification template.

Refer this TechNet https://technet.microsoft.com/en-us/library/hh519719.aspx

Step 2: Create notification workflow (periodic subscription)

I selected the target class as Incident but if you want to notify for Service Request then select Service Request.

 

  

 Add 'First assigned date' in the criteria. This field will be updated with the date time when Incident/Service Request is assigned to user. So if this field is empty then incident is not assigned to any user yet. So we need to check if this field isNull or isEmpty but we don't have these operators in the UI. Add any temporary criteria here like "is less than or equal" to '05/05/2013' as UI will not allow to click next until we specify something here. We will modify this MP and add isNull operator from XML.

 We can also add additional criteria's here based on the requirement, like if you have multiple helpdesks (ex. Network, SQL). make sure that you add all the criteria that you need here along with first assigned date as we will not be able modify this workflow form UI after we do the changes in XML.

 

  In recurring notification section, specify the criteria that suits your requirement for recurring notifications. For this scenario, I want to notify helpdesk every 10 mins until the incident is assigned to analyst. If you want to notify once then you can set 'End after number of occurrences' = 1.  This workflow will run every 10 mins if criteria is true. This criteria will be false when incident has assigned to user.

  

 Select the notification template and add required recipients on the next screen.

 So we are done with creating notification workflow from UI, now its time to modify it from XML. Export management pack and open it in XML editor.

Locate the <Criteria> section in the MP for "First assigned date" as below.

<Criteria> 

<Expression>
       <SimpleExpression>
               <ValueExpressionLeft>
                <Property>$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/FirstAssignedDate$</Property>
               </ValueExpressionLeft>
                <Operator>LessEqual</Operator>
                 <ValueExpressionRight>
                <Value>2013-04-27T18:30:00</Value>
                </ValueExpressionRight>
          </SimpleExpression>
</Expression>

</Criteria>

We need to replace the lines between the tag <Expression> </Expression> with below code.

<UnaryExpression>
       <ValueExpression>
            <Property>$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/FirstAssignedDate$</Property>
       </ValueExpression>
       <Operator>IsNull</Operator>
</UnaryExpression>

So this will look like as below.

<Criteria>
  <Expression>
      <UnaryExpression>
        <ValueExpression>
              <Property>$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/FirstAssignedDate$</Property>
        </ValueExpression>
           <Operator>IsNull</Operator>
      </UnaryExpression> 
   </Expression>
</Criteria>

Save the management pack and re-import it back and you're done with XML code changes.

Note:  Once you modify and re-import the MP, do not modify it from the UI as it will break the XML code.

I have attached sample MP with this post.

 

Hope this helps!

ManagementPack.3bef2f9daf4e454ba542aa8e44e4786a.xml