HOW TO CALL APPROVAL WORK FLOW ON BUTTON CLICK EVENT OF VISUAL WEB PART?

Hiall,
I created an OOB an approval work flow I want to start that approval work flow through visual web  part button click event
In work flow Settings I selected to manually start .Is this possible ? if possible please guide me how to do this
Thanking you,
Arun  kumar

Hi,
If you have an instance of SPListItem, and know the workflow association name, you can start it. First you need to find workflow assocation instance and tell SPSite.SPWorkflowManager to start your workflow.
See this for more information:
http://blog.mmasood.com/2012/06/programatically-start-workflow.html
Please remember to up-vote or mark the reply as answer if you find it helpful.

Similar Messages

  • How to redirect to library on button click in sandbox visual web part solution for office 365

    Hi,
    I have created a sandbox solution for Office 365 with one text box and a button. 
    On button click i am creating a library with name from text box. 
    So, what i want is redirect to newly created library as soon it get created on button click.
    how could i do that?
    Thanks

    Got the solution
    <asp:Literal ID="litRedirect" runat="server" />
    string redirectURL =
    listurl;
    litRedirect.Text = "<script type='text/javascript'>window.location = '" +
    redirectURL + "/';</script>";

  • Aps:button onClick event in Visual web part only fires first time - SharePoint 2013

    Below is my markup from ascx file
    <asp:Button ID="exporttopdf" runat="server" Text="Export To PDF"/>
    C# code for button on click
    protected void Page_Load(object sender, EventArgs e)
    exporttopdf.Click += new System.EventHandler(this.exporttopdf_Click);
    protected void exporttopdf_Click(object sender, EventArgs e)
    if (Page.IsPostBack)
    try
    using (MemoryStream stream = new MemoryStream())
    PdfPCell cell;
    SPList list = SPContext.Current.Site.OpenWeb().Lists[this.ListName];
    BaseColor rGBColor = WebColors.GetRGBColor("#AFAECE");
    PdfPTable element = new PdfPTable(2)
    TotalWidth = 300f,
    LockedWidth = true
    float[] relativeWidths = new float[] { 1f, 2f };
    element.SetWidths(relativeWidths);
    element.HorizontalAlignment = Element.ALIGN_MIDDLE;
    element.SpacingBefore = 20f;
    element.SpacingAfter = 30f;
    if (this.PdfHeading != null)
    cell = new PdfPCell(new Phrase(this.PdfHeading));
    else
    cell = new PdfPCell(new Phrase(this.ListName));
    cell.Colspan = 2;
    cell.Border = 0;
    cell.Padding = 4;
    cell.BackgroundColor = rGBColor;
    cell.HorizontalAlignment = 1;
    element.AddCell(cell);
    Document document = new Document(PageSize.A4, 25f, 25f, 30f, 30f);
    PdfWriter instance = PdfWriter.GetInstance(document, stream);
    document.Open();
    document.AddAuthor("Place Holder");
    document.AddCreator("Place Holder");
    document.AddKeywords("Place Holder");
    document.AddSubject(this.ListName);
    document.AddTitle(this.ListName);
    instance.Info.Put(new PdfName("Producer"), new PdfString("Place Holder"));
    PdfContentByte directContent = instance.DirectContent;
    string[] separator = new string[] { ";", "," };
    string[] strArray2 = this.ViewFields.Split(separator, StringSplitOptions.None);
    new StringBuilder().Append(this.ListName + "\n");
    foreach (string str in strArray2)
    PdfPCell cell2 = new PdfPCell(new Phrase(str))
    Border = 0,
    Padding = 4,
    HorizontalAlignment = 1
    element.AddCell(cell2);
    if (str != "Modified By" && str != "Created By")
    PdfPCell cell3 = new PdfPCell(new Phrase(SPContext.Current.Item[str].ToString()))
    Border = 0,
    Padding = 4,
    HorizontalAlignment = 1
    element.AddCell(cell3);
    else
    string[] separatorc = new string[] { "," };
    string[] strArray3 = SPContext.Current.Item[str].ToString().Split(separatorc, StringSplitOptions.None);
    PdfPCell cell3 = new PdfPCell(new Phrase(strArray3[3].ToString().Substring(8).Replace(@"\\", @"\")))
    Border = 0,
    Padding = 4,
    HorizontalAlignment = 1
    element.AddCell(cell3);
    PdfPCell cell4 = new PdfPCell(new Phrase("Footer"))
    Colspan = 2,
    Border = 0,
    Padding = 4,
    BackgroundColor = rGBColor,
    HorizontalAlignment = 1
    element.AddCell(cell4);
    document.Add(element);
    document.Close();
    instance.Close();
    stream.Close();
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ContentType = "pdf/application";
    string filename = SPContext.Current.Item["Title"].ToString() + ".pdf";
    HttpContext.Current.Response.AddHeader("content-disposition", "inline;filename=" + filename);
    HttpContext.Current.Response.OutputStream.Write(stream.GetBuffer(), 0, stream.GetBuffer().Length);
    HttpContext.Current.Response.End();
    catch (Exception exception)
    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("Export To PDF", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, exception.Message, new object[] { exception.StackTrace });
    else
    HttpContext.Current.Response.Write("<script language=javascript>alert('ERROR');</script>");
    it works fine first time but does not do anything from second.
    any advice?

    Hi,
    Please try to the code snippet as below:
    VisualWebPart1.ascx:
    <asp:Button ID="exporttopdf" runat="server" Text="Export To PDF" OnClick="exporttopdf_Click"/>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    VisualWebPart1.ascx.cs:
    protected void Page_Load(object sender, EventArgs e)
    protected void exporttopdf_Click(object sender, EventArgs e)
    Label1.Text = System.DateTime.Now.ToString();
    If the code still do not work from second, I suggest you debug your code and check whick line of code occur the error.
    More information:
    http://social.msdn.microsoft.com/Forums/office/en-US/94931a08-f204-4d30-a230-f468815a76e8/export-aspnet-gridview-to-pdf-from-visual-webpart?forum=sharepointdevelopmentprevious
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • How to create Auto complete text box in share point 2010 Visual web part

    Hi All ,
    I am want to use Auto complete text box in share point 2010 Visual web part ,data need to get from share point list how to  create 
    please guide me how to use Auto complete text box
    Thanking you,
    Arun Darly

    Hi Arun,
    Please refer to the following article.
    SharePoint 2010: JQuery Autocomplete Textbox Containing List Items
    http://smarttools.codeplex.com/wikipage?title=Autocomplete%20Text%20Field
    Please don't forget to mark it as answered, if your problem resolved or helpful.

  • How to call a dynamic URL on 'button press' event, in MVC-based BSP

    Hi,
    My requirement is as below:
    On selecting a row in table view, and pressing a button, I need to open a browser.
    The Browser URL depends on the row selected.
    The key field from table view, is added at the end of the URL string.
    Shortly, I can say that, I am getting a value on row selection & want to pass it to button event.
    In Views Section, there are 2 tags- (1)table view & (2)button.
    Right now, I have put the code for getting the key field, in DO_HANDLE_DATA method.
    In Button's OnClientClick method, I have called the Javascript to open the browser.
    If I now write the code to concatenate the key field value to form the dynamic URL in 'OnClick' method,
    it will be called only after the browser is opened.
    (as OnClick event is executed only after OnClientClick event is executed)
    Could anyone please tell me what event (and in which tag) can be used to solve this.
    Is there any event which is triggered, as soon as the row is selected, &  before the button press event is triggered ?
    Would really appreciate responses made to this query.
    Thanks,
    Nisha Vengal.

    Hi Nisha,
    The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
    function fn_button()
               htmlbSL(this,2,'b_row_selection:onInputProcessing()');
               window.open("new_page",target="BLANK");
    Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
    Try this out and let us know if it works for you.
    Regards,
    Saurabh

  • How to open a text file using button click event

    hi, How can i open a text file in a textpad or notepad on the click event of a button.?
    Thanks
    Jay

    Pnt,
    this will not work LV 8.0.1 and LV 8.6 will give back error 193.
    Attached is a VI to use the ShellExecute WinAPI. The VI is LV 7.1.1.
    Message Edited by waldemar.hersacher on 10-09-2008 10:48 PM
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    ShellExecute.zip ‏27 KB

  • Approval work flow.

    Hi expert's
               could any body tell How to create approval work flow? I am working on CRM marketing planner where I need to use this work flow when( user-1 Head of marketing) select status as approved it should go for (user-2 Branch manager) this is mainlyused  for budget allocation and cost center planning.
    Regards
    subbaraju

    Hi,
    Please follow thes steps:-
    1> find a BO that is defined for CRM Marketing like for Events and Activities we have BUS2000126, Opportunities - bus2000111. Similarly there would be a BO for CRM Marketing.
    2> From that BO find an event that can trigger your Workflow and Start Condition if any required.
    3> SWDD - create custom Workflow - create a User Decision and in that step assign it as a General Task and assign Agent in that screen as an Expression from BO Attribute which corresponds to user 1.
    4> in user-decision implement approval/rejection
    5> in the approval branch add another user-decision for next level approval and do the same as there in step 3..
    Let me know if you have any doubts
    This should work for u..
    be careful with the binding..
    Regards.
    Kanika

  • How to call elem. Search help on Button click event in WD appilcation

    Hello All,
    i have requirement to call elem. search help on button click event in WD application. currently i am calling FM  F4IF_START_VALUE_REQUEST but getting the short dump as below,
    The following error text was processed in the system X31 : Screen output without connection to user.
    The error occurred on the application server saps_X31_31 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    SYSTEM-EXIT of program SAPLSDH4
    Function: F4_PRESEL_WITH_TABSTRIP of program SAPLSDH4
    Form: F4PROZ_STEP_PRESEL of program SAPLSDSD
    Function: DD_SHLP_SINGLE_STEP of program SAPLSDSD
    Form: F4PROZ_LOOP of program SAPLSDSD
    Form: F4PROZ of program SAPLSDSD
    Function: F4IF_START_VALUE_REQUEST of program SAPLSDHI
    Method: ONACTIONSEARCH_CUSTOMER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
    is there any way to achieve the required behaviour.
    please let me know.
    Regards,
    Chandra

    Hi Friends,
    I have the similar kind of requirement. Upon click on a Button on screen i need to call a search help, and collect one or more selected material numbers.
    The search help is working fine and i am getting the entries with the following code.
    The problem is i am finding extra popup on screen.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    tabname         =  space
    fieldname       =  space
    SEARCHHELP      =  'MAT1'
    MULTIPLE_CHOICE =  'X'
    STEPL           =  0
    value           = 'MATNR'
    *dynpprog        =  progname
    *dynpnr          =  dynnum
    *dynprofield     = 'CARRIER'
    CALLBACK_PROGRAM          = 'ZTEST_1_PRA'
    CALLBACK_FORM             = 'F4CALLBACK'
    TABLES
    RETURN_TAB                = RETURN_TAB
    EXCEPTIONS
    FIELD_NOT_FOUND           = 1
    NO_HELP_FOR_FIELD         = 2
    INCONSISTENT_HELP         = 3
    NO_VALUES_FOUND           = 4
    OTHERS                    = 5.

  • Using web services in Approval Work flow in OIM 11g

    Hi All,
    I am a new bie to OIM 11g. I have created an approval work flow and it is working fine.
    Now my requirement is to use a web service in the approval work flow instead of directly embeding the java code in Java Embeding Activity. Can some body share me a document or url for the process of doing it.
    Thanks in advance for the help.
    Thanks,
    Preeti

    If you are using OIM 11gR2 please refer the below document. All steps are very clear with the screenshots.
    http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/request.htm#autoId27
    See section 21.3.5.7 Configuring the Human Task and BPEL Mappings
    Also see this OBE tutorial for getting idea on Java embedding activity and assigning and retrieving data from global variables in SOA
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/oim/oim_11g/Request_Workflow_for_Self_Registration/request_workflow_for_self_registration.htm

  • ***How to call BSP App when custom button event fired from toolbar group***

    Dear PCUI Experts,
       I have created one custom button for the transaction CRMD_BUS2000116.
    And my urgnet requirement is , I need to call BSP application which is used to   take data from custom fields and stores into BP table.
    How to call the BSP App. when i clicks on the button.
    Please help me..
    I will reward with great points.
    Regards,
    Stella.

    Hi Purushothaman,
                                 I have created a button in CRRM_ACCOUNT application.
    Now i want to call  a custom bsp application by clicking on that button.I have followed step given in this blog
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1646. [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    But the event is not triggered.Do I have to create an iview for my bsp application?
    How to do that?Plz help.
    Regards,
    Ruby.

  • PO Approval Work flow Customization

    Hi,
         I want to customize the PO Approval Work flow.
    And interesting thing is never seen or worked in Work Flow.
    So Help me with the steps to customize right from scratch.
    Regards,
    SoundariyaKumar.R

    First you have to study about the workflow then you can move then move for customization.
    https://web.stanford.edu/dept/itss/docs/oracle/10g/workflow.101/b10284.pdf
    https://books.google.co.in/books?id=tl9Nnk9OKvAC&printsec=frontcover#v=onepage&q&f=false
    http://arunrathod.blogspot.in/2010/10/steps-to-customize-po-approval-workflow.html

  • Approval work flow for Role based and Resource based

    Hi All,
    We have to implement approval work flow for the following things in OIM 9.1.0.1
    Approval work flow for Functional Roles (Groups in OIM) (Approvalsrequired for users to get these roles)
    IT Roles (Resources in OIM) (Approvalsrequired for users to get these resource)
    Functional Role (Group) contains policy1,polici2. Polciy1 contains res1,res2 and Policy2 contain res3,res4.I want to create approval work flow for this Functional Role to achieve the following
    User raise a request for the functional role, then it should wait to get manager approval. then once its gets approval, that user account should create on all resources which are involved in that group.
    And, I have to define approoval work flow for all individual resources to get users account creation on target with approvals. These resources may include in the groups as well.
    After getting approval for functional role (Group), then Will OIM starts the approval flow for all resources involved in the group? becase, all resources have approval workflow at resource level also.
    My Goal: Approval work flow for Group, should not process the approval work flow for resource. can we do it in OIM 9.1.0.1?
    And can we do the same in OIM 11g also?
    Please help me and do let me know, if you need any information from my end.
    Thanks.

    Thats configurable buddy ! ! And possible in 10G and 11G both versions.
    Functional Roles : These are the groups/roles in OIM 10g/11g with access policies attached at the backend.
    - Create a dummy resource and name it Request Role or anything as you like. Attach an Object Form to it and have form field for Role Name, this would be a lookup type field linked to all OIM groups (leave system values using lookup query). So a user can select any OIM Group in this request as per configuration. Have approval workflows defined on this dummy resource Request Role and in its Provisioning Process make user/s a part of the requested group.
    - Now once the user is made a part of the group, the associated access policy would be invoked automatically and thereby provisioning. The only thing you need to keep in mind is that create the access policy without approval (there is a check box). If you do this the approvals would never be invoked even if you assign a group manually to the user coz it suppresses all the approvals in this access policy.
    IT Roles : These would be linked to the resource and you can define individual approvals on the resources as required.These approvals would be required if someone raises a request for these resources individually.
    Thanks
    Sunny

  • How do you fire a button click event on apex page from fancybox iframe that was created by page

    I am trying to fire off the button click event from fancybox iframe. The apex page has a button that launches a fancybox iframe which is loaded with an APEX form. On close of that fancy box, I am trying to fire a click event on the parent page which will refresh a div with html that is created with plsql. The button on the page works as expected when clicked from the page. It will show a debug alert message to prove it was called and then load the div with the correct data. I am unable to fire off this button click from the fancybox iframe when it closes.
    A couple of points:
    I using Plug-in: Execute PL/SQL Code and Return Content ("PLUGIN_MULEDEV.SERVER_REGION_REFRESH") to place the create fancybox statement. It is used to populate a div using plsql.
    The name of the button on the main page is P2020_REFRESH_SECTION_BUILDER_BTN.
    The click dynamic action on the button is calling the plugin to replace the html in the div.
    The data in the form in the fancybox is being saved to the database. On close of the fancybox box I want to refresh the div so the new record is included in the div html.
    Can anyone help. Here is the fancybox code:
      function customProcessOnReadyState4(){
        for (var i=0;i<11;i++){
          $( "#tabs"+i ).tabs();
          $("#createNewExerciseLink"+i).fancybox({
              ''width''         : ''60%'',
              ''height''        : ''70%'',
              ''autoScale''     : true,
              ''transitionIn''  : 200,
              ''transitionOut'' : 200,
              ''type''          : ''iframe'',
              ''onClosed''         : function() {
                                         window.parent.$(''#P2020_REFRESH_SECTION_BUILDER_BTN'').click();
    Here are the dynamic actions assigned to the button:
    5 - Execute JavaScript Code
    alert("Starting refresh");
    10 - Execute PL/SQL Code and Return Content [Plug-in]
    begin
      SCTUI.create_sct_tabs2(:P2020_CREATE_SECTION_LOV, '1');
    end;

    user setActionListener...
    <af:setActionListener from="#{bindings.XXX.inputValue" to="#{backingbean.variable}"
                  <af:inputText value="#{bindings.Email.inputValue}"
                                label="#{bindings.Email.hints.label}"
                                binding="#{backingBeanScope.backing_ShuttlePage.it2}"
                                id="it2">
                    <f:validator binding="#{bindings.Email.validator}"/>
                  </af:inputText>
                  <af:commandButton text="commandButton 2"
                                    binding="#{backingBeanScope.backing_ShuttlePage.cb2}"
                                    id="cb2" action="passing">
                    <af:setActionListener from="#{bindings.Email.inputValue}"
                                          to="#{processScope.detail}"/>
                  </af:commandButton>next jsf page:
                <af:outputText value="#{processScope.detail}"
                               binding="#{backingBeanScope.backing_ProcessScope.ot1}"
                               id="ot1"/>setPropertyListener also should work
    <af:setPropertyListener from="#{bindings.Email.inputValue}" to="#{processScope.detail}" type="action"/>

  • Error in work flow wait for change event

    Error in work flow wait for change event of business object bus1014, Actually this business object is triggering for two transaction one is me21n and another is c201 . am trying to create fork with two branches one is create and another if change occurs wait will trigger, bt when i trigger work flow controll is not after fork, it will stop in fork only. and am not getting my workflow container variable getting instantiate, am getting error in wait. please any one get out of me in this

    Hi Sangeetha
    What is LV_MATERIAL? is it a BO container element? or a class element or a just a simple variable?
    Error message is clear, you are trying to evaluate LV_MATERIAL but it does not contain a value.
    This is a custom workflow as it begins with WS9xxxxxxx... what is LV_MATERIAL used for? what are we expecting it to hold? maybe, from event to workflow binding we can pass the value to it.
    Please share the following:
    1) Definition screen shot of LV_MATERIAL
    2) Screen shot of The step where it is first used - from SWDD
    3) Screenshot of Event to Workflow Binding
    4) name of your base Business Object (seen in the triggering events tab of the WF template in PFTC)
    5) What is the corresponding variable for that BO in your workflow container
    6) Screen shot of WF definition from SWDD - please identify the step going in error in that screen shot
    Regards,
    Modak

  • How to open a Filechooser on a button click from jsp page

    can anyone tell me how to open a Filechooser on a button click from a jsp page.
    Thanks

    <input type="file" name="myfile">

Maybe you are looking for

  • How do I repair my library and user account?

    My problem: - Created new user named "admin" and wanted to transfer my entire account there and gave it full rights. Decided not to. <- long story - Now, original account does not have full rights and every setting I change (like desktop wallpaper) c

  • Setting a import job in oracle

    Can you tell me where i can find a good documentation that shows how to create a job in orcle. I would like to schedule a task which will run insert scripts everyday...

  • Download SAP NetWeaver 7.0 Java Trial Version

    Hi, I'm trying to download the SAP NetWeaver 7.0 Java Trial Version. When I start downloading part 1 of the server, the filesize is said to be about 1.677.721.600 bytes. But my download file's size is just 127 MB. anybody tell me if this is the right

  • Ipod touch doesn't mount

    I updated my ipod last week and itunes as well.  Now itunes doesn't recognize my ipod when mounting.  I have mac os 10.6.8 and itunes 10.5 and whatever the latest ipod touch (3generation) os is.  I have re-started both ipod and mac and sometimes the

  • Photoshop 5.0 LE

    I was using a photoshop 5.0 LE with Windows XP and was running well. But now i've got a new sistem with Windows 7 and the program is not compactible. What can I do?