( sharepoint 2007 )
i am creating a sharepoint workflow
this workflow is started when an item is created or changed in the list called ListA this item has a field called user assigned when the item is created this field is empty the first step in the workflow is - grant item permission in this step the creator of th开发者_JS百科e item is granted contribute permission the second step is to update field user assigned with the value created by of current item.
when the item is created its contribute permission are not with the user who is logged in . Thats why we use the firt step to give the user logged in the contribute permission. and after the first step has got executed . the contribute permissions are given to the user logged in and now he should be able to updated the user assign field as the next step of the workflow.
However the problem is that even before the first step of granting permissions has completed. the second step is executed and since the user logged at that time still doesn't have contribute permissions the workflow stops without updating user assigned field. if i could somehow produce a delay of about 5 seconds between the first and second step of the workflow my problem would be solved.
but I believe in sharepoint designer workflow the minimum pause is of 1 minute , which is much more than i require.
what should i do ?
- Try to update SPListItem object by calling SPListItem.Update() and see if it helps.
- If not, then just answer to your question: execute System.Threading.Thread.CurrentThread.Sleep()
And putting in a delay activity will serialize your workflow into database and only timer job will wake it up (which usally runs no more often than each 5 minutes, even if your activity delay is set to 1 minute).
in sharepoint designer workflow there is an option for set time portion of date/time set time as 00:o5 for your date field(out put to one variable-userdefined variable name) then pause until sources is workflow data field is your varaible name.--ok--> finish the workflow
Add a code item and use System.Threading.Thread.Sleep(5000);
精彩评论