Homeβ€Ί Powershell Activity
Options

Stripping prompts out of Description

Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭

As many of you have encountered, we have many AROs mapping "[prompt_guid_property]" for optional, empty form fields. I am attempting to strip those out when an SR is created. For a first attempt, I'm running the following Powersell script which works in the ISE but not in a Monitoring RB! WTF?! What's wrong?


$String = '{Description from SR taken from RB}'

$NewString = $String -replace '\[(.*?)\]'

$SRObject = Get-SCSMObject -ID '8C2551A6-A7CC-499C-86EE-A7E1C472C4A1'

Set-SCSMObject $SRObject -Property Description -Value $NewString

$SRObject.Commit()Β 

Remove-Module SMLets

Best Answer

  • Options
    Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭
    Answer βœ“

    all problems solved.

    1) created the PSA to clean up the Description.

    2) Modified the original New SR notification to exclude the new form

    3) Created a NEW Notification Activity (after the PSA) to simulate the "New SR" notification.


    smoke and mirrors πŸ˜‰πŸ‘Š

Answers

  • Options
    Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭

    ok, I got it working as a PSA at the very beginning of the workflow. HOWEVER, it does not run BEFORE a Notification Subscription notifying the Affected User that a New SR was created for them (triggered upon a SR creation). Is there any way to delay a creation subscription for a minute or two? Just until the PSA has a chance to run?

    This would be a good place to use the Notification Activity, BUT then we would have to retrofit every single SR in our system, so that is no small feat.

  • Options
    Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭
    Answer βœ“

    all problems solved.

    1) created the PSA to clean up the Description.

    2) Modified the original New SR notification to exclude the new form

    3) Created a NEW Notification Activity (after the PSA) to simulate the "New SR" notification.


    smoke and mirrors πŸ˜‰πŸ‘Š

Sign In or Register to comment.