How I can force the Update item Action inside SharePoint 2010 workflow to be part of the edit operation which fires the workflow

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/140349

Вопрос

I am working on an Enterprises wiki site collection inside SP 2013. and i define a workflow that will do the following, when the wiki page is modified:-

  1. Check if the Wiki page name and wiki page title is not the same, as set the title=name accordingly.

  2. Then send email to the approver & modified by users , when the wiki page is editing,approved or rejected.

Here is the workflow as defined inside SP designer:

enter image description here

Now everything is working well, except when the user edit the wiki page name, where in this case the "Update item" action to set title = name inside the workflow will execute, and this will cause the wiki page two be edited twice (2 versions are going to be added). For example when I check the page history after modifying the wiki page name (from "old name" to "new name for trsting") , we can see that there are two new versions being added, one for the edit operation that fires the workflow (edit the page name) , while the for setting the title=name inside the workflow.

enter image description here

So my question is how I can force the Update item action inside the workflow to work as if it is part of the edit operation that cause the workflow to fire,, in other word how I can force the Update item Action (set title = name) inside the workflow to not generate a separate version for the page ? Thanks

Это было полезно?

Решение

The short of it is you can't with workflow, they operate after the item has been added or changed.

You need to use an event receiver to do that if you want to perform some operations before the item is saved. You would want to look at the ItemUpdating event, since you want to do it as part of the edit operation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top