One Step over Approve WorkFlow RRS feed

  • Question

  • I am developing a SharePoint WorkFlow which is SharePoint Approvals workFlow..,


    This WorkFlow have a Qeue of Emp1 , Emp2 ,manager1,manager2..

    To approve ListItems in ProductList.


    I created another list for managers to make it easyer to approve items ..,and made some more modifications on it so it look deferant but I want it's attetude to act like if Emp or manager gose to TaskList -> Approve item.

    I want my custom list to make the same action.

    this List have a copy of Items to which in productList Items which I want the emp or manager to approve.


    I found a code in the Internet to complete or Approve/Reject the WorkFlow automaticlly

    but this is not my need ..,


    because if the current user is Emp2 for example ,

    so this action will end the whole WorkFlow which is not logic .., Because still there is another persons/steps have to be done ..,

    here is the code I found:

                  SPList list = web.Lists["TestList"];
      SPListItem item = list.GetItemById(22);
      SPWorkflow workflow = item.Workflows[0];
      SPWorkflowTask task = workflow.Tasks[0];
      Hashtable ht = new Hashtable();       
      ht[SPBuiltInFieldId.Completed] = "TRUE";
      ht["Completed"] = "TRUE";
      ht[SPBuiltInFieldId.PercentComplete] = 1.0f;
      ht["PercentComplete"] = 1.0f;
      ht["Status"] = "Completed";
      ht[SPBuiltInFieldId.TaskStatus] = SPResource.GetString(new CultureInfo((int)task.Web.Language, false), Strings.WorkflowStatusCompleted, new object[0]);
      * ht[SPBuiltInFieldId.WorkflowOutcome] = "Approved";
      ht["TaskStatus"] = "Approved";
      ht["FormData"] = SPWorkflowStatus.Completed;
      web.AllowUnsafeUpdates = true;
      SPWorkflowTask.AlterTask((task as SPListItem), ht, true);

    as you can see .., it approve or reject the whole WorkFlow while I need to make approve/reject the current Task for the current user only.


    thank u for help
    Tuesday, January 17, 2012 4:30 AM

All replies

  • ASA Tareq,


    can you please clarify what do you want in more details?? till now , i can't get what you need.


    Best Regrads, Ahmed Madany MCTS @twitter http://twitter.com/ahmed_madany @Blog http://ahmedmadany.wordpress.com @tumblr http://ahmedmadany.tumblr.com
    Wednesday, January 18, 2012 7:27 AM
  • Thank you Mr.Ahmed for care ,


    I have created a Workflow ..,which have many steps (Applovals )

    my objective is :

    I want a code which see where is the WorkFlow is and (Approve/Reject ) the Current step only,

    Then stop at the next step ..

    So this mean:

    -  I want to know Where is My Work Flow ( Approveal step)

    - Move the work flow to the next approval step.


    The code I got above always Complete the whole workflow cycle.

    thank u for help
    Monday, January 30, 2012 7:03 AM