Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Set-PWDocumentState : Workflow rules not being executed
    • Sign In

    • State Verified Answer
    • Replies 8 replies
    • Answers 1 answer
    • Subscribers 66 subscribers
    • Views 1650 views
    • Users 0 members are here
    • set-pwdocumentstate
    • new-pwdocumentversion

    Set-PWDocumentState : Workflow rules not being executed

    AEC_PW_Interface
    Offline AEC_PW_Interface over 2 years ago

    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 !

    • Sign in to reply
    • Cancel

    Top Replies

    • AEC_PW_Interface
      Offline AEC_PW_Interface Tue, Jul 27 2021 3:19 PM +1
      Ok, thanks everyone ! I will try again with the PWPS_WSG even though it dint work earlier but honestly I think we will just reimplement the workflow rules inside the script. If PWPS_WSG ends up working…
    • AEC_PW_Interface
      Offline AEC_PW_Interface Fri, Oct 8 2021 11:20 PM in reply to AEC_PW_Interface +1 verified
      Just to confirm that it ended up working with Invoke-WSGWorkflowCommand Our script boiled down to the below : New-PWLogin -DatasourceName $datasource -UserName $username -Password $SecurePassword…
    • Chris Andrew
      Offline Chris Andrew Sat, Oct 9 2021 2:37 AM in reply to AEC_PW_Interface +1 suggested
      Pwps_dab was updated recently to include a hidden -Force command on Set-PWDocumentState This now works with Server Side WRE set.
    Parents
    • AEC_PW_Interface
      0 Offline AEC_PW_Interface Tue, Jul 27 2021 3:19 PM

      Ok, thanks everyone !

      I will try again with the PWPS_WSG even though it dint work earlier but honestly I think we will just reimplement the workflow rules inside the script.

      If PWPS_WSG ends up working, ill reply with the solution to help contribute Slight smile

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • AEC_PW_Interface
      0 Offline AEC_PW_Interface Tue, Jul 27 2021 3:19 PM

      Ok, thanks everyone !

      I will try again with the PWPS_WSG even though it dint work earlier but honestly I think we will just reimplement the workflow rules inside the script.

      If PWPS_WSG ends up working, ill reply with the solution to help contribute Slight smile

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    • AEC_PW_Interface
      +1 Offline AEC_PW_Interface Fri, Oct 8 2021 11:20 PM in reply to AEC_PW_Interface

      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 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Chris Andrew
      0 Offline Chris Andrew Sat, Oct 9 2021 2:37 AM in reply to 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.12 | MicroStation 2023 | ProjectWise CE 10.3.4 | ContextCapture | ProjectWise PowerShell 2023 | ProjectWise WSG API | Generative Components | OpenBridge Designer 10.12

      Civil 3D 2023 | Dynamo | Navisworks Manage

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

      Speckle | BIMVision | Revizto | Solibri

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies