.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to Change Workflow Status Programatically on DueDate reached

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :SharePoint

I have developed a sharepoint approval workflow using VS.NET 2008. Workflow fires when any new item is created. Three parallel task is created and waiting for approval.

Workflow will only completed when all three approvers approves/completes their task. I want to change the status (denied) of the workflow every tuesday 11:59PM if any one of the approval is pending. This  denial work I want to perform by programatically within the workflow.

so I need suggestion how do I achieve the above scenario?

Do I write any timer job to monitor workflow status on every tuesday 11:59PM and denied as per the logic mentioned above.


Do I encaptualte the denial logic withing the workflow itself?

Please suggest a way to solve the problem...

thanksArup MCTS - SharePoint

Play Sudoku

View Complete Post

More Related Resource Links

Change the Workflow Status through code


HI Folks,

I have a scenario where i need to develop a 6 stage approval workflow(sequential) using WWF and depoly it to sharepoint. Everythigns fine till here.

Now we look ahead to change the Status field on the documents library which actually has the Workflow Name as the column name and its value being In Progress, depending on the stage of approval. Like(Approved 1, Approved 2, Approved 3.)

And if rejected the status should be rejected than Completed. Any idea how can we update this column of the List item.

I have tried item[workflowProperties.Workflow.ParentAssociation.Name]="Approved 1";

But this throws an error saying input string is not in a correct format.

Any information would be of great help :)


Sreeharsha Alagani

Why is workflow status column empty and how to change it?


One particular instance of the workflow shows workflow status column as empty although it should be showing IN PROGRESS since if click on workflows from item's context menu I can see the workflow running on it;  _layouts/workflow.aspx show it as in progess.
This workflow was not created 60 days ago and its not complete. I wonder why it displays empty in the workflow status column.

Also can this column be changed from web service? I tried using:

<FieldRef Name='myworkflow'>2</Field><FieldRef Name='ID'>23</Field>

and updating it. While the webservice code does not throw any error and ListService.UpdateItems() returns 0x000000, this column doesnt get updated. Any ideas what could be wrong?

Workflow on status column change


I want a workflow on a content type with a status column (new, pending, completed, ....)

I want it to fire off when this column changes, not when the item is updated, because it might be updated for other reasons (the title changed).  How do I make sure it only happens on the column change? 


Terminating a SharePoint Workflow Programatically



I have a custome workflow coded in VS 2005 and deployed in to GAC and associated to a List in the SharePoint Portel through MS SharePoint Designer.


When an Exception happened in the code, the worklow instance' Status is shown as "Error Occured" and get suspended. since this workflow instance is "hung up" at this list item another instance of the workflow can't run. To run another instance you have to go into the SP Portal --> List and click on the "Error Occured" under the workflow of the item and then you have to terminate the workflow by clicking on the "Terminate this workflow now" link.


I just need to do this function ("Terminating the workflow") in the code in my Catch block where i handle the exception of the workflow activity.


could some one please tell me how to do this? or even point me in the right direction?


i've so far tried varity of:





ActivityBind activityBind = new

How to make the Workflow Status remain "In Progress" when a task is "Rejected"


Hi Sir/Mam,

I have a work flow running on a list, when a task is Rejected at a stage then the Workflow status is set to "Completed". Instead of this I want the Status to remain as "In Progress", so that in future after the modification of the document the Approver may Approve it and then take it to the next stages. This is not possible if the Workflow is set to "Completed".

Can you please suggest an easy way to do this

Thanks in Advance


SharePoint 2010 Long Starting if start workflow programatically


In SharePoint 2010, I'm starting workflow #2 programatically from my workflow #1. See code below:

					SPList currentList = web.Lists[new Guid(ListId)];
					SPListItem currentListItem = currentList.GetItemById(ListItem);

					//resolve any lookup parameters
					string workflowId = base.ProcessStringField(WorkflowIdentifier);

					//find workflow association by name
					SPWorkflowAssociation workflowAssoc = currentList.WorkflowAssociations.GetAssociationByName(workflowId, Thread.CurrentThread.CurrentCulture);

					if (workflowAssoc != null)
						//start the workflow
						SPWorkflow workflow = site.WorkflowManager.StartWorkflow(currentListItem, workflowAssoc, workflowAssoc.AssociationData, SPWorkflowRunOptions.Synchronous);

And workflow #2  will hang with Starting status (1-10 minutes), Then the workflow #2 status would be modified  to Completed.

I couldn't find how to start the workflow # 2 immediately and complete immediately without several minutes delay

Change workflow rule file

Hi, I create workflow and rule base condition for that ".rule file"  . But now i have to change rule condition . when i change the condition then it return error can't  validate because of it refer previous values.   Any one can tell how change rule base conditions in workflow.

Change Default Column Value programatically

On a Document Library Settings Page, there is a new setting in SP2010: "Change Default Column Value". Changing the default value of the Field is different from this value. Does anyone know what this value is and where to set it programatically? Also, what libraries is this setting available on? This code updates the field's default value but not the property mentioned above: SPField field = list.Fields["Column"]; field.DefaultValue = "DefaultValue"; field.Update(); Thanks!

SPD workflow status show "starting" when I create a document from the library !!. and hangs

I have a document library in MOSS 2007. Have created a WF and that starts "autmatically when new item created" In the document library I have created couple of column those are mandatory (required columns) and user has to fill those column while uploading a document as well creating a document from library. WF has ran and completed succefully  when I use "upload" option to load a document.  As you are aware, when we "upload" a document, we will have to fill all "required columns" and the click "check in" command button.  After I do all this, document get loaded and WD ran succesfully. However, the WF is not running when I create a document (.docx) from this library (using "new" button) !!.  I have filled all required field in the document information panel . After save & exit from WORD application, I can see WF status as "starting". But, it never started and completed.  So I did following and found WF worked !! a) After creating document (.docx) using "new" option I found WF status "starting"!. So,  I did "Check-out and Check-in" manually from document library. After doing this,  WF ran and status has been changed as "completed" b) In SPD, I change workflow start option from "Automatic" to "Manually start".&nb

how to change the permissions list items using the workflow?

How to change the permissions list items using the workflow? Or how to instull SPDActivities on sharepoint 2010?

Workflow Status

DocLib TaskLib Workflow History List How can i get workflow status that was started over document in DocLib ? What field is it ? I need to understand when doc is approved with OOB wf.

Change Variable and Argument editor in workflow designer?

Is it possible, in Beta 2, to customize the behaviour of the editing grids use for entering data about a workflow's variables or arguments in the workflow designer?  Can I:- add my own custom column to the grid?- can I customize the variable type drop down editor? (e.g. have my own editor or otherwise filter the list of types)- can I change the "default" expression editor (and possibly remove it)?Thanks,Notre

How do I change Associated task list in a workflow

Hi, I use Sharepoint Designer 2010. How do I change Associated task list in a workflow that I just made. I didn't see any settings where I could adjust the associated task list! Please help.   Regards, Luka

OOTB Approval Workflow - Approval status could not be updated

I've setup up a standard OOTB (out of the box) approval workflow on a Pages library, in order to manage the approval of all pages created and updated.  This operates as expected, and the users are mostly happy, execpt for one scenario: Once a page has been submitted for approval, if the approver wants to edit the page, it stops the workflow (after prompting) which then requires the workflow to be started again.  They would like it so the approver can edit and then approve, without restarting the whole workflow process. There is a setting in the approval workflow configuration of the 'Complete the Workflow' section in the 'Cancel this Workflow when the' area, and by unchecking the 'Document is changed' option, I believe this should enable approvers to edit the page and then approve the page, without stopping the workflow  However, the workflow appears to operate as expected, except the page does not automatically get approved.  By looking in the workflow history, I can see the following error: Post-completion activity performed. Approval status could not be updated. I've tried this on two separate MOSS 2007 Enterprise farms, both are publishing sites and I'm running as a site collection administrator, both with the same results. Is anyone else getting this, is this normal?! Is there another way to approach this, without having to go

Workflow status

HI, How can I get a report of all workflows available and their current status? Thanks,kesari suresh

Workflow status page "unknown Error"

Hi ,

  Since two days I am facing weired error from simple workflow. I have created a simple infopath form and WF (in SPD). Workflow starts normally and ends also. But when I click the status link "completed" it just throws an 'unknown error' page. It used to work few days back and suddenly stopped. I canno't see the the log or any status. Other workflows in other site collections work fine.  

The link to the page is :http://servername/_layouts/WrkStat.aspx?List={656C7595-C056-483A-8058-C2402BC78B9C}&WorkflowInstanceID={8ac46ac9-aae0-434d-a3ea-f8125f08df96}

Checking the moss log I found :

Exception Type: System.NullReferenceException Exception Message: Object reference not set to an instance of an object

Any help ??



Approval Workflow does not update the Content Approval status if started automatically



I’m using a simple Approval Workflow associated with Content Approval on site pages. It works fine when I set it to be started manually (by using Allow this workflow to be manually started by an authenticated user with Edit Item permissions  option) and on the completion of the workflow the Content Approval status is updated accordingly. But when I set it to be started automatically (by using Start this workflow when a new item is created  / Start this workflow when an item is changed options), it does not updates the Content Approval status. Note that I’ve set the Update the approval status after the workflow is completed (use this workflow to control content approval) option to true.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend