how to update WorkFlow Task Outcome field from infopath code behind button click - InfoPath Dev
in

InfoPath Dev

how to update WorkFlow Task Outcome field from infopath code behind button click

Last post 06-01-2015 12:50 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-24-2015 01:27 PM

    • nasir
    • Not Ranked
    • Joined on 09-10-2014
    • Doha Qatar
    • Posts 2

    how to update WorkFlow Task Outcome field from infopath code behind button click

    Guys,
    i've created an infopath form let assume it has 2 views...... 1) Requester / Submitter 2) Manager View
    i've one text field in infopath form "FormStatus"
    when requester submit the form to a document library, i wrote code behind on submission

    public void btnSubmit_Clicked(object sender, ClickedEventArgs e)
    {
    string strValue = "Submitted To Manager";
    string strXpath = "/my:myFields/my:FormStatus";
    MainDataSource.CreateNavigator().SelectSingleNode(strXpath, NamespaceManager).SetValue(strValue);
    this.Submit();
    }

    when user submit form, it successfully submitted to the library and i'm creating a task for the next approver (Manager) from SharePoint Designer 2013 list Workflow
    on formloading event i'm checking if the logged in user is a Manager then switch to Manager View that contains two custom buttons (Approve, Reject)
    i'm Approving from code behind as follows

    public void btnApprove_Clicked(object sender, ClickedEventArgs e)
    {
    string strValue = "Approved by Manager";
    string strXpath = "/my:myFields/my:FormStatus";
    MainDataSource.CreateNavigator().SelectSingleNode(strXpath, NamespaceManager).SetValue(strValue);
    this.Submit();

    //Here i want to update this particular task Outcome to "Approved" so that my workflow moves forward. if i manually Approve Task from Workflow Task then its fine but i need to do this from code

    }

    when i open WorkFlow task list and perform approve reject of that task, it works fine.
    but i want to update Workflow Task Outcome field to "Approved" when Manager clicks on Approve button of that particular task assigned to him, also want to update %Complete and Task Status to Completed.
    Thanks
  • 06-01-2015 12:50 PM In reply to

    Re: how to update WorkFlow Task Outcome field from infopath code behind button click

    Hi Nasir,

    You probably don't need code to do this. Just promote the field that you are using for the task outcome and add a SharePoint workflow that sets the task status based on the field.

    Good luck! 

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.