cancel
Showing results for 
Search instead for 
Did you mean: 
ignasitt
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Here you are a nice PowerShell Script to unblock all the blocked tasks. You still should review the cause of the block (usually other workflow that goes to error in the task list).

[system.reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")

$siteUrl="https://yourSubSiteURL"

$site=new-object Microsoft.SharePoint.SPSite($siteUrl)

$web=$site.OpenWeb()

$web.url

$i=0

write-host $web.lists

foreach($list in $web.lists){

    foreach($item in $list.items | where {$_[[Microsoft.SharePoint.SPBuiltInFieldId]::WorkFlowVersion] -ne 1}){

    

            if($item["Status"] -eq "Not Started")

            {

                  Try

                  {

                        Write-Host Unlocking workflow on $item.name

                        $item[[Microsoft.SharePoint.SPBuiltInFieldId]::WorkFlowVersion]=1;               

                        $item.SystemUpdate()

                        $i++

                  }

                  Catch [System.Exception]

                  {

                        Write-Host Caught error trying to unlock workflow -ForegroundColor Red

                  }

            }        

      }

}

Write-Host Unlocked $i workflows within $web.url

$web.dispose()

$site.dispose()

Reply
Not applicable

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Thank you Ignasi Tebé​ for the powershell script.

It will be very helpful!

Thanks

Karen

Reply
jaycheong
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Thanks Ignasi Tebé. We ran the script and the workflow was successfully unlocked.

Unfortunately when the user actioned on the task, the error re-occurred. Any ideas? I might add a 'Pause For' action and see if it worked.

Karen Lillystone​ - did you manage to resolve your problem? If so what steps did you take? Running the script? Or the Pause actions? Or others?

Btw, here is the error we're encountering. Appreciate any assistance. Many thanks.

Best regards,

Jay

LockedTask error.png

0 Kudos
Reply
ignasitt
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Hi Jay,

The script really unlock all blocked tasks, and there's no additional effort necessary.

Maybe your problem is in this script we are only unblocking the tasks with status "Not Started". You should able to add more status, like "In Progress" (a tipical issued one, also).

Please, try to re-launch the script replacing the line :

          if($item["Status"] -eq "Not Started")

with this other one:

           if(($item["Status"] -eq "In Progress") -or ($item["Status"] -eq "Not Started"))

I hope it will help you!

Best regards

Reply
jaycheong
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Hi Ignasi Tebé​,

This has been helpful, many thanks for the additional info. I have bookmarked in case we need to refer to this in future.

I tried resolving my problem again and I got lucky this time. I got another user to action the flexi task and also had the error. However, we received the reminder notification (as originally intended) shortly and the user was able to action the task thereafter without error.

We ran another test and had no issue. It would seem that the reminder task notification tripped us up by getting 'stuck' and 'locked'. Thankfully we were testing in our DEV region and hope that we can chalk this one as an environment issue.

Thanks again Ignasi!

Best regards,

Jay

Yousef AzarSajeev Kunjappan

0 Kudos
Reply
Not applicable

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Hi Jay Cheong

Sorry for the delay in my reply.

I have not encountered the issue for a while as we have moved environments to UAT and noted that this is slightly better the dev generally.    Therefore I was unable to implement the script or the pause action as was originally planned.

I have taken notes of the script however should I have need of it though.

Thank you

Karen

Reply
jaycheong
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

No problem Karen Lillystone​. I got lucky when I retested and the problem went away.

Like you, I've bookmarked this page thanks to Ignasi's post on the scipt.

Thanks,

Jay

Reply
jaycheong
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Hi Ignasi Tebé​,

We encountered the problem again. This time we ran the script with the updated line, and it worked perfectly!

We managed to unlock and action the task without any reoccurrence of the error.

Thank you very much for the help, it was most useful.

Best regards,

Jay

0 Kudos
Reply
dweyrick
Nintex Newbie

Re: Task Lock - Task is locked by a running workflow and cannot be edited

Jump to solution

Excellent script, ‌!  Worked perfectly for my situation with this error.

Thanks for sharing.

0 Kudos
Reply