locked
Is it possible to combine InstanceSubscription and RelationshipSubscription? RRS feed

  • Question

  • Hi all,

    I was wondering if it would be possible to create a notification trigger condition via XML where an InstanceSubscription (e.g. WI Status -eq Pending) is combined with RelationShipSubscription (e.g. AddRelationship) by using an <And> or <Or> expression?

    I've been trying this now for a couple of hours but couldn't get it work. Everytime I try to import the affected MP I'm receiving an error message like:

    The management pack import failed. 
    Errors (1):
    The configuration specified for Module DS is not valid.
    : Schema validation failed.
    The element 'Expression' has invalid child element 'RelationshipSubscription'. List of possible elements expected: 'SimpleExpression, UnaryExpression, And, Or'.
    

    If that's not possible, I'd like to ask if there's a simpler way to notifiy the 'assigned to' user in this particular case:

    The implementer of a Manual Activity should only receive a notification when the Manual Activity becomes active (status -eq 'In Progress'). This should be simple by specifying the 'change from' and 'change to' to match the required status. The difficult thing comes now -  there's a possibility that the implementer changes while the Manual Activity is already in progress, therefore we'd like to add a relationshipsubscription to ensure that the new 'assigned to' user get's notified as well (that's why a simple change from / change to on the status enum is not sufficient, as it wouldn't trigger because the activity is already in progress while the implementer changes).

    I hope you guys understand what I'm looking for :)

    Thanks in advance.

    Merry christmas to you all by the way!

    Cheers

    Alex

    Friday, December 21, 2012 12:28 PM

Answers

  • Anton, you're right..I completely forgot about that. I've been trying to programatically invoke them for another reason..for alexander, adding the SendNotificationsActivity to the workflow is definitely the best way. The blog post about adding custom activities is the one I posted earlier..it's about half-way down the post (subtitle: Using Custom Workflow Activities in the Authoring Console ) and shows how to add any activity from any library to the authoring tool.

    Alexander, the SendNotificationsActivity you want to add to the authoring tool is in the Microsoft.EnterpriseManagment.Notifications.Workflows.dll

    Sorry for the runaround!

    Anton, thanks for the reality check :)

    Wednesday, January 16, 2013 6:58 PM
  • Alexander, here is the post about SLA, just search the subtitle "Using Custom Workflow Activities in the Authoring Console". Thanks Aaron to pointing me.

    SCSMSolutions
    email: freemanru (at) gmail (dot) com

    Wednesday, January 16, 2013 7:43 PM

All replies

  • Unfortunately, no, you can't combine the two. So, you'll need two workflows (more precisely, a subscription and a custom workflow). The subscription will simply send an email to the activity's assigned-to user when the status changes to In Progress.

    The second workflow will trigger when the assigned-to user is changed (by using <AddRelationship /> in a relationship subscription). This workflow will fire a custom script that checks the activity's status. If the status is in-progress, invoke Microsoft's SendNotificationsActivity workflow using the appropriate parameters.

    Friday, December 21, 2012 9:41 PM
  • Unfortunately, no, you can't combine the two. So, you'll need two workflows (more precisely, a subscription and a custom workflow). The subscription will simply send an email to the activity's assigned-to user when the status changes to In Progress.

    The second workflow will trigger when the assigned-to user is changed (by using <AddRelationship /> in a relationship subscription). This workflow will fire a custom script that checks the activity's status. If the status is in-progress, invoke Microsoft's SendNotificationsActivity workflow using the appropriate parameters.

    Hi Aaron, thanks for your response.

    regarding the 2nd custom workflow you've mentioned, do you mean with this a workflow created by using the Authoring Tool which is then stored in a MP or something created by using Visual Studio? So far I've only created workflows by using the Authoring Tool which only contained PowerShell Script activities - I suppose it's not possible to invoke the SendNotificationsActivity workflow by using PowerShell? I guess it requires C# code, no?

    Do you have perhaps a link to a reference where it's described how to create custom workflows with C# code?

    Thanks in advance!

    BR

    Alex

    Monday, January 7, 2013 10:48 AM
  • Powershell just lays on .NET, so you can invoke anything .NET with Powershell.

    Personally, I prefer C# for building workflows, but that's just me :) As for blog posts on building C# workflows, I don't know of any off the top of my head. I started by building custom workflow tasks, then plugging them into the authoring tool (which is very cumbersome, imo). http://blogs.technet.com/b/servicemanager/archive/2011/08/11/3330977.aspx (towards the middle of that post).

    Then I just started building Sequential Workflows in Visual Studio and invoking them directly with WriteActions (like Microsoft does).

    As for instantiating an out-of-the-box workflow (or WriteAction) on your own, you can..but I don't know, yet, which is the most efficient/effective way of invoking them (ie: directly using windows workflow foundation, or using the SCSM TaskRuntime? Either way, there's some legwork involved in setting up the parameters, etc.) I'm actually working on that myself for another reason, so when I figure it out, I'll share it.

    There's also a good chance one of the gurus here already knows how to programatically invoke an SCSM WriteAction. Hopefully they'll chime in :)

    Wednesday, January 16, 2013 5:15 PM
  • Also you can build your own workflow with Authoring Tool and YES you can use the standard activities like SendNotificationsActivity inside of this workflow. So with If\Else activity you can check parameters and if they true then execute the SendNotificationsActivity

    I was pretty sure what a blog post existing about adding custom activities to AuthTools but I can't find them.


    SCSMSolutions
    email: freemanru (at) gmail (dot) com

    Wednesday, January 16, 2013 6:00 PM
  • Anton, you're right..I completely forgot about that. I've been trying to programatically invoke them for another reason..for alexander, adding the SendNotificationsActivity to the workflow is definitely the best way. The blog post about adding custom activities is the one I posted earlier..it's about half-way down the post (subtitle: Using Custom Workflow Activities in the Authoring Console ) and shows how to add any activity from any library to the authoring tool.

    Alexander, the SendNotificationsActivity you want to add to the authoring tool is in the Microsoft.EnterpriseManagment.Notifications.Workflows.dll

    Sorry for the runaround!

    Anton, thanks for the reality check :)

    Wednesday, January 16, 2013 6:58 PM
  • Alexander, here is the post about SLA, just search the subtitle "Using Custom Workflow Activities in the Authoring Console". Thanks Aaron to pointing me.

    SCSMSolutions
    email: freemanru (at) gmail (dot) com

    Wednesday, January 16, 2013 7:43 PM
  • Brilliant, thanks a lot guys! That's exactly what I was looking for :)

    The rest shouldn't be too difficult to accomplish!

    Cheers

    Alex

    Thursday, January 17, 2013 7:52 AM