Home Powershell

Add Activities to Service Request Template using Powershell

Harold_HarrisHarold_Harris Customer IT Monkey ✭
Is there a way to add activities to a Service Request template using PowerShell?

I see ways to add activities to Service Request that have been created but not to a template.

So I would look for Activities that start with a certain name and for each add it to template.


  • Options
    Donson_PhamDonson_Pham Partner Advanced IT Monkey ✭✭✭
    Hi Harold, 

    What scenario are you trying to do?  You could possibly just leverage Service Manager out of the box Workflows configuration to do this.  

    I've seen one that depending on a specific criteria in the service request, will slap that specific template for approval.  
  • Options
    Harold_HarrisHarold_Harris Customer IT Monkey ✭
    This would mostly be for when creating and testing Service Request.

    At times I need to change multiple PS or other actvities.  

    So instead of going thru the process of deleting the templates and then searching and adding them back in one at a time.  It would save time to be able to just run a script to update all of the templates in the SR template.

    I always name Activity templates that belong to one SR template to start with the same name so that is how I would identify which templates needed to be added.  

    This is just something I thought about after updating activities in a SR template what seemed like about 10 times in 1 hour.  And could not find a way to do it.
  • Options
    Nick_FlintNick_Flint Customer Advanced IT Monkey ✭✭✭
    To avoid editing activities on SR Templates (AND to avoid the tedious process of updating PowerShellActivities across multiple templates) I created a PowerShellActivity to run a script that acts as a traffic director. The script grabs the TemplateID of the ServiceRequest once it's created and uses a switch statement to load the script specific to that ServiceRequest. The SR specific script then handles all of the activity creation.

    I find it much easier and faster to edit the powershell script than to mess around in the console editing the activities on the template. 
  • Options
    Harold_HarrisHarold_Harris Customer IT Monkey ✭

    Nick, can you share the PowerShell script you use to do this?


  • Options
    Peter_MiklianPeter_Miklian Customer Advanced IT Monkey ✭✭✭

    After struggling with often RO template editing and requirements to have different activities in the same SR according to UserInputs which are not yet known when saving ticket (consider ARO for 'Computer: Request new/Upgrade hardware/Return to IT/...'), we decided to generate activities dynamically like @Nick_Flint, too.

    We have just 1 RO template. Orchestrator runbook monitors SR creation. Activity using PowerShell looks into our human readable and easy for editing CSV templates containing all relevant info, assigns new SR to Support group, Analyst, changes priority, etc. and generates activities regarding UserInput. PowerShell activities could be used instead of Orchestrator PS runbook, too.

Sign In or Register to comment.