Create a new Notification Activity with powershell?
Hi
Im trying to create a new Notification activity with powershell, and i have checked a manual created one that should send email to "Root Work Item" Affected User.. The recipient holds the InternalId.Guid of the user… im using this hashtable to create it, and it is created, but when the worflow runs i get a error..
$ArgHash =
@{"ID" = "RB{0}";
"Title" = $Title;
"Description" = $Description;
"Status" = $Status;
"SelectedNotificationTemplate" = "$($GetEmailTemplate.Id)";
"SelectedRecipients" = $receptiontxml;
"SequenceID" = $SequenceID;
}
The $reciptionxml looks like this:
$receptiontxml = @"
<AllRecipients>
<Recipient RecipientType="RelatedUser" WorkItem="Root Work Item" PrimaryRelationship="" PrimarySeedRole="???" Recipient="$us" SelectedSeedRole="Source" />
</AllRecipients>
"@
where $us is InternalId.Guid of the user..
The error i get is:
An error occured while obtaining an email address from recipient with saved attributes ' RecipientType="RelatedUser" WorkItem="Root Work Item" PrimaryRelationship="" PrimarySeedRole="???" Recipient="the guid" SelectedSeedRole="Source" '. Unable to parse recipient. The guid 'the guid' specified for the relationship class returned no relationship classes.
Someone done this or could point me how th set the recipient via powershell?
Thanks
Best Answers
-
Peter_Nordqvist Customer Advanced IT Monkey ✭✭✭
This is Solved!
Recipient="$us" should contain a guid for the relationship, not user guid..
1 -
Geoff_Ross Cireson Consultant O.G.
Nice find Peter. Care to share the PowerShell snippet for others?
0
Answers
This is Solved!
Recipient="$us" should contain a guid for the relationship, not user guid..
Nice find Peter. Care to share the PowerShell snippet for others?
Sure! Here is the function: