Set-PWDocumentState : Workflow rules not being executed

Hello,

Looking for some help to understand why our Set-PWDocumentState commands do not trigger the WRE when we do state changes.

Our scripts boils down to :

  • New-PWLogin -DatasourceName "name" -LoadWRE -UserName "user"  -Password $Password                                                                
  • $doc = Get-PWDocumentsByGUIDs -DocumentGUIDs GUI                                                                             
  • Set-PWDocumentState -InputDocuments $doc -State "Next state in the workflow"  

We also see the same kind of issue with New-PWDocumentVersion, just like the Set-PWDocumentState, we notice that the workflow rules have not been executed after execution.

Looking on the forums, we also saw the suggestion to use Invoke-WSGWorkflowCommand but that command gives the following:

Error: Manual change state not allowed. Please use Workflow customization rules to change document state.

Anyone has any pointers on how to investigate why the workflow isnt being triggered ?

Thanks !

Parents Reply Children
  • Just to confirm that it ended up working with Invoke-WSGWorkflowCommand

    Our script boiled down to the below :

    1. New-PWLogin -DatasourceName $datasource -UserName $username -Password $SecurePassword
    2. $docs = Get-PWDocumentsByGUIDs -DocumentGUIDs "doc id" //or find the document how ever
    3. $context = New-WSGClientContext -DisplayLabel $datasource -UserName $username -Password $SecurePassword -WsgURL "https://xyz.bentley.com/ws/"
    4. Invoke-WSGWorkflowCommand -DocumentGuid $doc[0].DocumentGUID -CommandLabel $command -WSGClientContext $context -ReturnDocument

    You must have good knowledge of the commands in your workflows but other then that, this works perfectly when you have server side WRE enabled.

    Thanks again for the help everyone

    Answer Verified By: AEC_PW_Interface 

  • Pwps_dab was updated recently to include a hidden -Force command on Set-PWDocumentState

    This now works with Server Side WRE set.

    Regards

    Chris


    AECOM Roads UK&I Digital Engineering, Design & Solutions Lead | Sector Information Management Lead

    Associate Director – Digital

    OpenRoads Designer 10.11 | MicroStation CE 10.17 | ProjectWise CE 3.4 | ContextCapture | ProjectWise PowerShell 2.0 | Generative Components | OpenBridge Designer 10.11

    Revit 2022 | Civil 3D 2022 | Recap 2022 | Infraworks 2022 | Dynamo | Navisworks Manage

    PowerShell | Visual Studio | Office 365 | Power Automate | Teams | SharePoint | Visio

    Speckle | BIMVision | Revizto | Solibri