Pages

Tuesday, April 13, 2021

Unlock SharePoint NIntex Workflow Tasks With PowerShell

 

We had struggled with this task locking problem for a few months, once approver's completed task.  It seemed that the problem started after making updates from Microsoft and Nintex.  

It will display in the following message to edit workflow tasks

"This task is currently locked by a running workflow and cannot be edited."

After few hours research, I found out ways to unlock SharePoint Nintex workflow tasks using PowerShell script.


Solution:





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

$siteUrl="http://TestSIte/"

$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()

Tuesday, March 2, 2021

Thursday, January 28, 2021

Friday, June 19, 2020

Wednesday, May 20, 2020

Wednesday, April 29, 2020

Friday, March 20, 2020

How to find MS Flow instance running to SharePoint list item or document


We implemented MS flow in the custom share point list, when an item is created then MS flow will trigger & do business logic's.

if we go to MS flow Log History, which is very difficult to find which MS flow run is related to that Sharepoint List ID

this is workaround to update hyperlink value with MS flow instance running URL, So that you can click on the link to open respective MS flow instance.


Add compose action with workflow function to get flow details


Add another compose action and update this formula

concat('https://asia.flow.microsoft.com/manage/environments/',
workflow()?['tags']['environmentName'],
'/flows/',
workflow()?['name'],
'/runs/',
workflow()?['run']['name'])



update compose 2 value into hyperlink column in the list


now you can click on the link to open MS flow