Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Set-PWDocumentState enhancement
    • Sign In

    • State Suggested Answer
    • +2 person also asked this people also asked this
    • Replies 21 replies
    • Answers 1 answer
    • Subscribers 67 subscribers
    • Views 6538 views
    • Users 0 members are here

    Set-PWDocumentState enhancement

    Peter Willmen
    Offline Peter Willmen over 5 years ago

    Would it be possible to add an 'Admin Override' option to the 'Set-PWDocumentState' command in PW PowerShell?. This option should only be useable by members of the Administrator group or by using a '-AdminOverride' option

    When this function is used on an object managed under the Workflow Rules Engine (WRE) it returns a 58268 error ("Manual change state not allowed. Please use Workflow customization rules to change document state")

    Access to this additional option is required for system Administrators to fix problems with WRE where on occasion the rule action times-out and the file is left in the wrong state. This can be caused by a number of things such as large/corrupt files or even a slow network connection.

    I know this can be achieved by editing the database entries but I need a managed function that can be configured to achieve the result in a consistent and controlled manner.

    • Sign in to reply
    • Cancel

    Top Replies

    • PaulDuffy12
      Offline PaulDuffy12 Wed, Nov 29 2017 5:24 AM in reply to Brian Flaherty +2
      That's fine in a sterile environment, but when a supplier is screaming because their submission is delayed and Early warnings and compensation events are set to be initiated against your organisation it…
    • Glenn Ryan
      Offline Glenn Ryan Tue, Apr 7 2020 7:48 AM in reply to Jim Irvine +2 suggested
      Jim Set-PWDocumentState will change a document's state (even versions) to whatever state you give it. I've used it to change a file stuck in CADQA state back to WIP,l for example. Cheers G
    • Peter Willmen
      Offline Peter Willmen Wed, Nov 29 2017 4:56 AM in reply to Brian Flaherty +1
      The fact is that the WRE does fail at times and also there is a requirement to move files through the workflow programmatically outside of Projectwise Client (the benefits of PowerShell). As long as…
    Parents
    • Glenn Ryan
      0 Offline Glenn Ryan Thu, Aug 2 2018 6:07 AM

      I'm getting some strange behaviour with Set-PWDocumentState. PWPS_DAB version = 1.5.15.0.

      I have a workflow and have bounced a file along to 'Checking' state with a 'CAD' account. I then logged in as an 'Engineer' account to bounce it along from 'Checking' to 'Package Shared'. At this stage, if this is done through PWE, one of the checks that WRE does is the suitability code (BS 1192) to make sure it's not at S0, with a NOT_EQUAL_TO call. Also, the minor rev gets dropped (P01.1 -> P01) amongst other things. This does not happen if I do this through the PS commandline. The file happily bounces along to 'Package Shared' state, with no intervention by the WRE.

      # Log in with test accoiunt capable of moving to next state in workflow

      New-PWLogin -NonAdminLogin -LoadWRE

      $doc = Get-PwDocumentsBySearch -DocumentName 'Some-Doc-Name-Number' -GetAttributes

      # File is at 'Checking' state

      $doc | Set-PWdocumentState -State 'Package Shared'

      It seems like the LoadWRE switch is getting ignored completely

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Glenn Ryan
      0 Offline Glenn Ryan Thu, Aug 2 2018 9:11 AM in reply to Glenn Ryan

      Right. I looked at the release posts and noticed that the LoadWRE switch appeared in 1.5.0.0, so I threw out 1.5.15.0 and installed the version before 1.5.0.0 which is 1.4.0.0.

      This does not have LoadWRE, nor does it have the NonAdminLogin switch, so I had to log in with my admin account. Once that was done, I tried to move the file from 'Checking' to 'Package Shared' and received the same error as Pete did in his original post. I then decided to try 1.5.0.0 and see what happened.

      After removing 1.4 and installing 1.5 it had the LoadWRE switch, but no NonAdminLogin switch. I logged in wioth New-PWLogin as before and specified LoadWRE and tried the same move from 'Checking' to 'Package Shared' and it went through, exactly as I noted originally.

      So it's broken.

      Ideally, if you don't log in with the LoadWRE switch, you should be able to bypass the WRE as Pete originally suggested. Sometimes this is necessary because things can become...stuck or unstable.

      However, if you log in with LoadWRE it should run all the actions that you would expect the WRE to run as if you were performing the same operation in PWE.

      I'm writing Pester tests to test infrastructure changes to the ProjectWise system. This involves logging in with some test accounts. These test account have different access rights at different stages of the workflow i.e. drafter, reviewer, authoriser etc.

      So the tests log in with user account, move through workflow, check results, try to move further than user account can and test failure etc. Then log in with next person in the chain and repeat. Being able to do this against the WRE and with Non Admin accounts is critical to the whole process, otherwise it's pointless.

      Can this be fixed?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Reply
    • Glenn Ryan
      0 Offline Glenn Ryan Thu, Aug 2 2018 9:11 AM in reply to Glenn Ryan

      Right. I looked at the release posts and noticed that the LoadWRE switch appeared in 1.5.0.0, so I threw out 1.5.15.0 and installed the version before 1.5.0.0 which is 1.4.0.0.

      This does not have LoadWRE, nor does it have the NonAdminLogin switch, so I had to log in with my admin account. Once that was done, I tried to move the file from 'Checking' to 'Package Shared' and received the same error as Pete did in his original post. I then decided to try 1.5.0.0 and see what happened.

      After removing 1.4 and installing 1.5 it had the LoadWRE switch, but no NonAdminLogin switch. I logged in wioth New-PWLogin as before and specified LoadWRE and tried the same move from 'Checking' to 'Package Shared' and it went through, exactly as I noted originally.

      So it's broken.

      Ideally, if you don't log in with the LoadWRE switch, you should be able to bypass the WRE as Pete originally suggested. Sometimes this is necessary because things can become...stuck or unstable.

      However, if you log in with LoadWRE it should run all the actions that you would expect the WRE to run as if you were performing the same operation in PWE.

      I'm writing Pester tests to test infrastructure changes to the ProjectWise system. This involves logging in with some test accounts. These test account have different access rights at different stages of the workflow i.e. drafter, reviewer, authoriser etc.

      So the tests log in with user account, move through workflow, check results, try to move further than user account can and test failure etc. Then log in with next person in the chain and repeat. Being able to do this against the WRE and with Non Admin accounts is critical to the whole process, otherwise it's pointless.

      Can this be fixed?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    Children
    • Glenn Ryan
      0 Offline Glenn Ryan Mon, Aug 6 2018 4:35 AM in reply to Glenn Ryan

      Also, it seems to be returning the document passed in, in it's original state, even when the call succeeds. The error I suspect is just being output using Write-Host and is not being thrown, which would probably be better...

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Mon, Aug 13 2018 5:00 PM in reply to Glenn Ryan

      are you adding the -ErrorAction Stop to ensure errors get thrown properly?

      Also, when logging in as Non-Admin the account still needs to be in a group named "PowerShell Users"

      you probably won't be able to get around the WRE restrictions.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Glenn Ryan
      0 Offline Glenn Ryan Tue, Aug 14 2018 9:49 AM in reply to Kevin van Haaren

      Kevin

      I've tried with and without ErrorAction Stop - the results are the same. Also, the account is in the 'PowerShell Users' group.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Glenn Ryan
      0 Offline Glenn Ryan Thu, May 2 2019 5:06 AM in reply to Glenn Ryan

      Still appears to be broken. Logged in with restricted user account that is in PowerShell Users group, -LoadWRE and -NonAdmin switches then tried moving a file from one state to the next. This would normally fail due to a WRE check for suitability I mentioned previously, but it happily advances the file.

      Based on the above I have no confidence whatsoever that the rules and attribute setting/updating specified ion the WRE are being used.

      PWPS_DAB: 1.10.3.0

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Glenn Ryan
      0 Offline Glenn Ryan Tue, Sep 3 2019 9:34 AM in reply to Glenn Ryan

      Still apears to be completely ignoring the rules defined in the WRE. Version tested: 1.12.5.0 in both 32 and 64 bit pwps_dab.

      Can we get this looked at please?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify 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