Terminate SharePoint Site Workflows with Nintex Workflow Part 1| SharePoint How-To

We’ve all been there. You schedule a Nintex site workflow to run on a schedule. Everything is working fine and leave for the day only to come back and something went terribly wrong with the workflow and now you have 10s if not 100s of errored workflows with the status of “Error Occurred” that built up overnight. You troubleshoot and fix the problem, but you still have the problem of canceling the errored workflows. You now have to go through the not-so-fun process of canceling all these workflows by hand.

I thought there could be a way to write a Nintex site workflow to terminate all of the errored workflows looping through all the workflow instances and invoking a web service to terminate the workflow, but alas, such a web service doesn’t exist. In the pursuit, I did come across several solutions using PowerShell and the SharePoint Object Model, but nothing through Nintex. So, after spending more time than I typically would for such a task, I gave up on the possibility and chalked it up to a limitation in both SharePoint and Nintex.

That was until I came across Scott Brickey’s article Mission Impossible : Remotely terminating a SharePoint Workflow . This article opened my eyes because although Scott offers up another PowerShell solution, he does it in a different manner. Instead of using the SharePoint Object Model like many of the other solutions, he leverages web requests, the underlying markup of the pages, and form post actions to terminate the workflow. Since Nintex does offer the web request capability, I figured I’d give it one more try.

And guess what… it worked this time.

Terminate Workflow Action – Under the Covers

Before going into the Nintex solution, we need to understand how the “Terminate Workflow” action works under the covers.

When you go to the “Site Workflows” link from the “Site Actions” screen, you are taken to the page <Site URL>/_ layouts/15/workflow.aspx. Clicking on one of the workflow links (that have the status of “Error Occurred”) takes you to this URL: <Your Site URL>/_layouts/15/WrkStat.aspx?WorkflowInstanceID={<some GUID>}.

This is the Workflow Instance Page where the link “End this workflow” shows. If we were to terminate this workflow manually, we would click this link. Since we want to execute the same action through automation, we need to look at this link a bit further. If we look at the HTML markup, we see the following code:

You can see that when clicking this link the JavaScript function “__doPostBack(‘ctl00$PlaceHolderMain_HtmlAnchorEnd’,”)” gets executed. At times, you have to dig deep in the core SharePoint libraries to see how some of these internal functions are defined, but luckily in our case, it’s all on this page.

Further up the markup, you can find the definition for our function:

Here, you can see that when the __doPostBack function is executed, it submits the form with ID “aspnetForm”. The 2 parameters passed into this function (eventTarget and eventArgument) are then passed in as form values with similar names. From the snippet above, you can see that eventTarget has a value of ‘ctl00$PlaceHolderMain_HtmlAnchorEnd’ and eventArgument is blank. It is important to realize that these values do not change from workflow instance to workflow instance.

This isn’t where the magic is, though. Luckily for us again, the actual form that gets submitted (aspnetForm) is contained within the same page markup:

There are a number of hidden input fields that this form can accept, but for our purposes, the important ones are: __EVENTTARGET, __EVENTARGUMENT, and __REQUESTDIGEST. The first 2 we already know are passed in through the __doPostBack call. So we need to grab the __REQUESTDIGEST value from the form itself. Unlike the other 2 values, this value is unique to each workflow instance page and will need to be grabbed dynamically.

The last thing to note in the markup is the action for the form itself. You can see that when this form submits, it performs a post action to the URL: ./WrkStat.aspx?WorkflowInstanceID=<encoded Workflow InstanceID>.

From all of this, we know that with the following information, we can successfully terminate this workflow:

  • Form Action Parameter: Workflow Instance ID
  • Form Field: __EVENTTARGET
  • Form Field: __EVENTARGUMENT
  • Form Field: __REQUESTDIGEST


In our next post, Terminate SharePoint Site Workflows with Nintex Part 2, we will show how to extract all of these values from the markup and programmatically terminate all errored workflows in a loop… all with just Nintex.

69 thoughts on “Terminate SharePoint Site Workflows with Nintex Workflow Part 1| SharePoint How-To”

  1. Большинство бытовой электротехники и инструментов достаточно безболезненно воспринимают перепады напряжения в сети, если диапазон отклонений не превышает 10–15% от номинала — 230 В. Если скачки напряжения в сети происходят часто, может понадобиться стабилизатор напряжения. Читайте подробнее на electrotorg.ru

  2. Incredible update of captchas recognition software “XRumer 19.0 + XEvil 5.0”:

    Captchas solving of Google (ReCaptcha-2 and ReCaptcha-3), Facebook, BitFinex, Bing, Hotmail, SolveMedia, Yandex,
    and more than 12000 another categories of captcha,
    with highest precision (80..100%) and highest speed (100 img per second).
    You can use XEvil 5.0 with any most popular SEO/SMM programms: iMacros, XRumer, SERP Parser, GSA SER, RankerX, ZennoPoster, Scrapebox, Senuke, FaucetCollector and more than 100 of other programms.

    Interested? You can find a lot of demo videos about XEvil in YouTube.

    Free XEvil Demo available.

    Good luck!

  3. Преимущества сайта Hydra

    Используя сайт Гидра, вы можете легко приобрести многие запрещенные товары. Процесс покупки ничем не отличается от приобретения заказов через обычные интернет-магазины. Пройдя на сайт Hydra вы сможете легко заказать не только наркотические вещества, но и базы данных пользователей, ворованные кредитные банковские карты и многое другое.

    Доставка товаров с Гидры

    Приобретая запрещенные препараты, например, экстази, нельзя использовать обычную почту или другие службы доставки. В этом случае клиент получает свой заказанный товар посредством «закладок». Именно так работает Гидра сайт, покупателю отсылается место и GPS-координаты, где находится его заказ. Осталось только пойти и забрать.

  4. Бесплатные игры и Регистрация в Miggster https://miggster.com/signup/evg7773 Это лидер мобильных игр +6 в Мире! Нас уже более 7 млн. Все начинают с уровня 1. Достигнув уровня 5 Вы выигрываете потрясающие призы! Первые игры это головоломки, социальные и базовые игры (такие как Candush Crush, Angry birds и настольные игры). Можно играть в автономном режиме там, где нет хорошего подключения к Интернету

  5. Профессиональная Реклама Серых тем, Казино онлайн, Casino online, Gaming Звоните: Telegram @evg7773

  6. Как и обещал, запускаю конкурс на 10 призов по 0,001 BTC среди подписчиков! Подписывайся на канал https://t.me/neweconomytime – узнай условия и удачи!

  7. С 2012г. гарантированно раскручиваю продажи handmade в Etsy с помощью Pinterest. Это дает Заказчикам заработки от 7000 до 100 000 usd в месяц https://youtu.be/vrlMJu5BaQI Ведем аккаунты через пинтерест также в Ebay, Amazon, Shopify и др. Ручная работа, Цена 500 – 1000 usd за месяц

  8. В Pinterest с 2012 г. Реклама в нем дает Заказчикам из в Etsy, Shopify, amazon заработки от 7000 до 100 000 usd в месяц. https://youtu.be/vrlMJu5BaQI Ручная работа, Цена 300 – 500 usd за месяц

  9. В Pinterest с 2012 г. Реклама в нем дает Заказчикам из в Etsy, Shopify, amazon заработки от 7000 до 100 000 usd в месяц. https://youtu.be/9FnqPvyhgq4 Ручная работа, Цена 500 – 1000 usd за месяц

  10. В Pinterest с 2012 г. Реклама в нем дает Заказчикам из в Etsy, Shopify, amazon заработки от 7000 до 100 000 usd в месяц. https://youtu.be/v-b2HL-ZF4c Ручная работа, Цена 500 – 1000 usd за месяц

Comments are closed.