Pass OperationReason control to a workflow when triggered from a PS script?

Hello, we are triggering an on-demand workflow from a Powershell script using Set-QADObject but we need to record the request reference number as the OperationReason in the workflows activity operation so if someone checks the users change history the reference number should be recorded in the "reason" box next to the operation performed by the workflow

Example of code we are using:

$workflowParams = @"
    <RunParameterValues xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:schemas-quest-com:ActiveRolesServer:WorkflowParameters">
      <RunParameterValue name="userDN" syntax="String">
        <Values>
          <Value isEncrypted="false">
            <RawValue>$userDN</RawValue>
          </Value>
        </Values>
      </RunParameterValue>
      <RunParameterValue name="mbxLimit" syntax="String">
        <Values>
          <Value isEncrypted="false">
            <RawValue>$mbxLimit </RawValue>
          </Value>
        </Values>
      </RunParameterValue>
     </RunParameterValues>
"@

Set-QADObject -Identity $WorkflowDN -ObjectAttributes @{edsvaStartWorkflow=$true;edsvaWorkflowRunParameerValues=$workflowParams} -Control @{OperationReason="RITM580647 - Test"}

The -Control doesnt do it.

Also looked at this ADSI approach but still cant find a way of passing a string to a workflow activity operation reason.

Then found this but cant see a way passing a workflow parameter to the Control Value

Any advice is appreciated for this seemingly simple task.

Parents
  • I'm just curious now - is your ticket number being entered by a user or is it coming from some other automation?

    If the former, you could implement some customization of the Web UI to allow the user to enter the ticket number, have a Change Workflow "catch" this and then have a script activity insert the ticket # etc. into your Change history using a set command line like you have.

  • is your ticket number being entered by a user or is it coming from some other automation?

    It is coming from another automation which retrieves Requests from ServiceNow. Our security team does not allow direct integration between ServiceNow and Active Roles

Reply Children
No Data