Pass parameter to success method of ExecuteQueryAsync

I have seen how to pass a parameter to a callback method of the ExecuteQueryAsync SP.ClientContext object.  The problem occurs when multiple calls are performed.  The last value is always passed to the callback method.  Below is a sample
of a while loop that performs multiple updates.  cT contains the value i wish to pass.  TitleVal in the success method always contains the last value. 
Thanks in advance.
While...{ cT = currentItem.get_item('Title'); ListItem.set_item("Approval_x0020_Status", currentItem.get_item('Approval_x0020_Status'));
ListItem.set_item("Year", currentItem.get_item('Year'));
ListItem.set_item("Delete_x0020_this_x0020_Risk_x00", currentItem.get_item('Delete_x0020_this_x0020_Risk_x00'));
ListItem.update();
var SPContextUPD = new SP.ClientContext.get_current();
SPContextUPD.executeQueryAsync(
Function.createDelegate(this, function() {
CreateListItem_Success("'" + cT + "'");
Function.createDelegate(this, function() {
CreateListItem_Fail();
function CreateListItem_Success(TitleVal){
SP.UI.Notify.addNotification(TitleVal + ' updated successfully');

also define cT variable inside loop body by adding "var" so it will have narrower scope:
var cT = currentItem.get_item('Title');
If it is global it may store the last updated ct value which explains why you always see the same value.
Blog - http://sadomovalex.blogspot.com
Dynamic CAML queries via C# - http://camlex.codeplex.com

Similar Messages

  • Passing parameter in a method

    hi i have a situation where i have to pass parameter to my method i don't what to pass the parameter define from the viewO because am not using parameter to query from the view,i just what to pass it to my procedure,my method is
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");
                      i don't what to use this-> sub.setNamedWhereClauseParam("tas_id", tas_id); the tas_id is not in AGR1 VIEWO
                      // sub.
                        sub.executeQuery();
                        Row row = sub.first();
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }

    i try this AM IN jDEVELOPER 11.1.2.1.0
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");                 
                        Row row = sub.first();
                        sub.setNamedWhereClauseParam("tas_id", new Number(10));-how will i pass this to my procedure
                        sub.setNamedWhereClauseParam("dref_id", new Number(10));-how will i pass this to my procedure
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        sub.executeQuery();
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }how will i pass the two prameter to my procedure
    Edited by: Tshifhiwa on 2012/07/01 3:14 PM

  • How to pass parameter to action methods

    Hi,
    I have a button.  Enter action method is associated with this.  In the Enter action method, I have added a parameter named param1.  When the button is clicked, this method is called automatically.  But how do I pass parameters to this method, which I have declared ?
    Regards,
    Suresh.

    Hi Suresh Babu,
    The associated method (Event Handler) is triggered by default and cannot pass the values. Instead, use the context node or attributes to set/get the values in the event handler method.
    Regards,
    Sravan Varagani

  • How to pass parameter to the method in EJB session bean from Managed Bean

    Hi,
    I need some guidance in accessing the EJB session bean methods from one of my backing Bean. I use EJB 3.0 Entity Beans and EJB Session Beans. I have to get value from my page and pass it thro the backing bean to the respective EJB session bean. I have no clue of how to do this,
    When i click a command link on the page, in its backing bean click method, i am able to get a value and store in a variable under its click action. But from there i am not knowing of how to pass it as a variable to the EJB session bean and hence execute the query(this is where we have to pass the variable as a parameter in its where clause) in the entity bean.
    I wanna know how to make a call to the EJB session bean and from there execute the Enitity bean.
    Guide me regarding this....
    Thanks
    ri

    Unfortunately dependency injection doesn't work for jsf backing beans, so you have to use a normal jndi lookup to find your session bean. The following example shows you how to find a session bean and call a method:
    public void commandButton_actionListener(ActionEvent actionEvent) {
    Context ctx;
    try {
    ctx = new InitialContext();
    helloWorldEjb = (HelloWorldEJB)ctx.lookup("HelloWorldEJB");
    hello = helloWorldEjb.sayHello(name);
    System.out.println(hello);
    } catch (NamingException e) {
    e.printStackTrace();
    }

  • How to pass parameter to 1 method in adf 11g

    Hi,
    <af:panelAccordion id="id25" clientComponent="true" visible="true" inlineStyle="height:90%;">
    MyBean.leftKey=list
    <af:iterator id="keyId" value="#{MyBean.leftKey}" var="bean">
    <af:showDetailItem text="#{bean.text}" id="arraylistValues">
    (bean.text) which is a KEY, i need to pass to 1 method HERE. ------so that, i can get corresponding ArrayList #{mybean.listPerKey}
    <af:iterator id="mybeanListValuesId" value="#{mybean.listPerKey}" var="bean">
    --some logic...
    </af:iterator
    </af:showDetailItem>
    </af:iterator
    </af:panelAccordion>
    im trying to display the panelaccordion with showdetailitem dynamically.
    logic : 1st iterator rotates for no of keys, that key i want to pass before second iterator so that i can retrieve corresponding list.
    how to call bean method with parameter.
    regards,
    sandeep

    Hi,
    this one would be simple..
    <af:panelAccordion id="id25" clientComponent="true" visible="true" inlineStyle="height:90%;">
    <af:iterator id="keyId" value="#{MyBean.leftKey}" var="bean">
    <af:showDetailItem text="#{bean.text}" id="arraylistValues">
    <af:iterator id="mybeanListValuesId" value="#{mybean.listPerKey}" var="bean">
    --some logic...
    </af:iterator
    </af:showDetailItem>
    </af:iterator
    </af:panelAccordion>in the getListPerKey method you can eaisly get the *#{bean.text}* value , for that you just need to eveluate it.
    Reference code
        public Object evaluateExpressionGet(String expression,
                                            Class expectedType) {
            return getFacesContext().getApplication().evaluateExpressionGet(getFacesContext(),
                                                                            expression,
                                                                            expectedType);
        public FacesContext getFacesContext() {
            return FacesContext.getCurrentInstance();
        public List getListPerKey() {
           Object key = evaluateExpressionGet("#{bean.text}",Object.class);
           return listPerKey;
        here you can eaisly get the corrosponding row values from parent iterator..
    Regards,
    Santosh.

  • Error while passing  parameter fot class method

    Hi abapers,
    i am trying to do alv grdi dispaly using class cl_gui_alv_grid. i am getting error "ITAB1" is not type-compatible with formal parameter 'IT_OUTTAB'.
    i attached code here.
    Internal Tables
    types: begin of itab,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of itab.
    data: itab1 like itab.
    DATA: alvgrid type ref to cl_gui_alv_grid.
    CALL METHOD ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = 'ITAB'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      CHANGING
        IT_OUTTAB                     = itab1.
       IT_FIELDCATALOG               =
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    please help me.

    Try this -
    CALL METHOD ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = 'ITAB'
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    IS_LAYOUT =
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    IT_OUTTAB = <b>itab1[].</b>
    IT_FIELDCATALOG =
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    others = 4
    Cheers

  • Passing Parameter between Methods

    I have some problems because i don't really know how to pass parameter between methods in a java class.
    How can i do that? below is the code that i did.
    I want to pass in the parameter from a method called dbTest where this method will run StringTokenizer to capture the input from a text file then it will run storeData method whereby later it will then store into the database.
    How can i pass data between this two methods whereby i want to read from text file then take the value to be passed into the database to be stored?
    Thanks alot
    package com;
    import java.io.*;
    import java.util.*;
    import com.db4o.ObjectContainer;
    import com.db4o.Db4o;
    import com.db4o.ObjectSet;
      class TokenTest {
           private final static String filename = "C:\\TokenTest.yap";
           public String fname;
         public static void main (String[] args) {
              new File(filename).delete();
              ObjectContainer db=Db4o.openFile(filename);
         try {
            String fname;
            String lname;
            String city;
            String state;
             dbStore();
            storeData();
         finally {
              db.close();
         public String dbTest() {
            DataInputStream dis = null;
            String dbRecord = null;
            try {
               File f = new File("c:\\abc.txt");
               FileReader fis = new FileReader(f);
               BufferedReader bis = new BufferedReader(fis);
               // read the first record of the database
             while ( (dbRecord = bis.readLine()) != null) {
                  StringTokenizer st = new StringTokenizer(dbRecord, "|");
                  String fname = st.nextToken();
                  String lname = st.nextToken();
                  String city  = st.nextToken();
                  String state = st.nextToken();
                  System.out.println("First Name:  " + fname);
                  System.out.println("Last Name:   " + lname);
                  System.out.println("City:        " + city);
                  System.out.println("State:       " + state + "\n");
            } catch (IOException e) {
               // catch io errors from FileInputStream or readLine()
               System.out.println("Uh oh, got an IOException error: " + e.getMessage());
            } finally {
               // if the file opened okay, make sure we close it
               if (dis != null) {
                  try {
                     dis.close();
                  } catch (IOException ioe) {
                     System.out.println("IOException error trying to close the file: " +
                                        ioe.getMessage());
               } // end if
            } // end finally
            return fname;
         } // end dbTest
         public void storeData ()
              new File(filename).delete();
              ObjectContainer db = Db4o.openFile(filename);
              //Add data to the database
              TokenTest tk = new TokenTest();
              String fNme = tk.dbTest();
              db.set(tk);
        //     try {
                  //open database file - database represented by ObjectContainer
        //          File filename = new File("c:\\abc.yap");
        //          ObjectContainer object = new ObjectContainer();
        //          while ((dbRecord = bis.readLine() !=null))
        //          db.set(fname);
        //          db.set(lname);
        //          db.set(city);
            //          db.set(state);
    } // end class
         Message was edited by:
    erickh

    In a nutshell, you don't "pass" parameters. You simply call methods with whatever parameters they take. So, methods can call methods, which can call other methods, using the parameters in question. Hope that makes sense.

  • Passing a Vector object as a parameter to a method

    Hi,
    How can I pass a Vector object as a parameter to a method?
      void buttonAdd_actionPerformed(ActionEvent e) {
        Vector studentHobbies = new Vector();
          String[] items = listHobbies.getSelectedItems();
          for (int i=0; i<items.length; i++) {
            studentHobbies.addElement(items);
    newStudent = new Student(Name,StudentNumber,studentHobbies);
    studentenlist.addTo(newStudent);
    So I want to pass the Vector object 'studentHobbies'  to a method.
    Would I do something like this :import java.util.Vector;
    public Student(String Name, int StudentenNumber, Vector studentHobbies){
    this.Name = Name;
    this.StudentNumber = StudentNumber;
    this.studentHobbies = StudentenHobbies;

    yes, thats how you do it.
    maybe you should first try your idea and then ask people questions?
    also, use ArrayList instead of Vector, its better - google as to why if you care.

  • How to pass entire class as a parameter in a method of other class- OpenScr

    Hi Folks,
    Whenever we create a script in OpenScript, it can contain only one class. However I want to declare several variables in a class/script and pass this entire class B as a parameter in a methodA of classA.
    What I mean by mean that is , I create ClassB something like below
    public class MyParams.....
    variable1;
    variable2;
    variable3;
    variable4;
    variable5;
    public class Original.....
    public void methodA(MyParams params)
    params = new MyParams();
    field1 = params.variable1;
    field2 = params.variable2;
    field3 = params.variable3;
    field5= params.variable5;
    Edited by: OATS Explorer on Mar 8, 2012 1:53 AM

    Hi
    I have a stand alone program (can be used by all other users) which will accept request_id and To_Email as parameters. I am developing a new request set in which I want to incldue this stand alone program and want to pass Prog#1 request Id to the 2nd stand alone program as a parameter so that I can send the output of the Prog#1 to the users through E-mail.
    Do we have any options to pass Prog#1 requeset id in to Prog#2 as a parameter in the request set without modifying the stand alone concurrent program code.
    Please note that i dont want to change stand alone program code becuase this code/program was developed to work in general for all the users and I dont want to change this code for new requirement/purpose...
    Hope you understood my requirement...
    Thanks!!

  • Pass parameter from javascript to backing method

    Hello professional ,
    i have an ADF (JSF page) there is news bar on it when the user click on any news link i want to pass the news parameter to backing method .
    The problem is how can i pass javascript value to commandLink jsf tags to setActionListener sub Tags:
    <tr:commandLink id="openNewsActionLink"
    text="#{screenLabels.NEWS_DETAILS}"
    inlineStyle="display:none; visibility: hidden;"
    action="#{publishedNewsBackedBean.openNewsDeatilsAction}">
    <tr:setActionListener from="6"
    to="#{publishedNewsBackedBean.selectedID}"/>
    </tr:commandLink>
    i want to pass the from value from java script code how can i do it and if i can not do it directly what is the work around for it.
    Regards
    Mohd79

    Hi,
    assign an ID to the inputText and use the JavaScript Document Object Model to access it. Also use a good browser with good DOM source viewer to browse the HTML page your JSP creates at runtime Firefox and Chrome have good source viewers.
    there are truckloads of JavaScript examples on the Internet.
    Or as Frank said if you get the setActionListener working properly you can easily copy a value from one input value binding to another.
    Brenden

  • Open Document Method Passing Parameter and Logoon Toke Examples

    I'm looking for Open Document Method Passing Parameter and Logoon Toke Examples. Is it possilbe for a user inside the firewall to click a url link with all the logon token and parameters built in using open document method, i have not bee able examples? Thanks

    Hi,
    Make sure to apply the latest Patch2.11 and retest.
    Also, please state your datasource type. This can influence the syntax (i.e. when passign BEx variable values)
    Finally, have you tried the Web (DHTML) editor (bilaunchpad webi preference)?  it has an OpenDocument 'wizard' to help you build-up the correct syntax . 
    please do the 2 above steps, and get back to us.
    Regards,
    H

  • How to Pass Select-options Single values as Parameter value to Method ?

    Hi Friends,
    I need to pass select-options values(single values) for s_arbpl to the method "process_percent_planned". Now all single values are in internal table s_arbpl-low field. I need to pass this internal table(s_arbpl-low) values to the method where i will run query based on these single values.In my below code i am passing value through variable w_arbpl. I have defined this parameter in the method.But here only one value is passed to method. I want multiple single values (in s_arbpl-low) should be passed. Please let me know how to correct code.
    Tables: crhd.
    Data: ktext type auftext,
    w_arbpl type arbpl.
    select-options: s_arbpl for crhd-arbpl.
    ktext = 'Test'
    create object obj_plan.
    call method obj_plan->process_percent_planned
    exporting
    ktext = ktext
    w_arbpl = s_arbpl-low.
    Thanks

    hi ,
    when you want to pass  S_ARBPL AS PARAMETER IN SELEC OPTION
    ARBPL SUCH AS  
       WIN002
      WIN003
      WIN004
      WIN005
      WIN006
      WIN007
    IN MULTIPLE SELECTION  S_ARBPL
    THEN
    USE  
    Tables: crhd.
    Data: ktext type auftext,
    w_arbpl type arbpl.
    select-options: s_arbpl for crhd-arbpl.
    ktext = 'Test'
    LOOP AT S_ARBPL .
    create object obj_plan.
    call method obj_plan->process_percent_planned
    exporting
    ktext = ktext
    w_arbpl = s_arbpl-low.
    ENDLOOP.
    REGARDS
    dEEPAK .
       THEN SELECT THAT
    call method obj_plan->process_percent_planned
    exporting
    ktext = ktext
    w_arbpl = s_arbpl-low.

  • Passing an Internal Table as parameter to a method

    Hi,
       Can we pass an internal table as a parameter to a method.if so how can we do that?i am new to abap objects..

    Hi Matt,
            Here is the code that i am trying to execute.I am extracting the data in the method "Extract" and passing it to the method "Display" to produce a report output.When i execute this it is giving me an error saying that t_mara is not an internal table since i just refered it with x_mara in the class definition.So how can i modify this code to pass t_mara as an internal table from the method "Extract".Please help me.
    *& Report  ZOBJ_PRAC                                      *
    REPORT  zobj_prac                                                   .
          CLASS example DEFINITION
    CLASS example DEFINITION.
      PUBLIC SECTION.
            TYPES : BEGIN OF x_mara,
                  matnr TYPE matnr,
                  ersda TYPE ersda,
               END OF x_mara.
        METHODS : extract EXPORTING t_mara TYPE x_mara,
                          display IMPORTING it_mara TYPE x_mara.
    ENDCLASS.                    "example DEFINITION
    "example IMPLEMENTATION
          CLASS example IMPLEMENTATION
    CLASS example IMPLEMENTATION.
      METHOD extract.
        DATA :lt_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0,
                  lw_mara TYPE x_mara.
        SELECT matnr ersda FROM mara INTO TABLE lt_mara UP TO 10 ROWS.
        t_mara[]  =  lt_mara[].
      ENDMETHOD.                    "extract
      METHOD display.
        DATA :lt_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0,
              lw_mara TYPE x_mara.
        lt_mara[]  =  it_mara[].
        LOOP AT lt_mara INTO lw_mara.
          WRITE:/ lw_mara-matnr,
                20 lw_mara-ersda.
        ENDLOOP.
      ENDCLASS.                    "example IMPLEMENTATION
    START-OF-SELECTION.
      DATA :  b1 TYPE REF TO example.
    CREATE OBJECT b1 TYPE example.
      TYPES : BEGIN OF x_mara,
                  matnr TYPE matnr,
                  ersda TYPE ersda,
               END OF x_mara.
    data : t_mara type standard table of x_mara initial size 0,
           it_mara type standard table of  x_mara initial size 0.
      call method b1->extract
        importing
         t_mara = t_mara.
         it_mara[]  =  t_mara[].
      call method b1->display
        exporting
         it_mara = it_mara.
    Edited by: Sai Chaitanya on Dec 2, 2008 5:30 AM

  • How to pass a value to the export parameter for a method (public instance)?

    Hello,
      I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.
    Thanks in advance,
    Ranjini

    Hi,
    "class definition
    class lcl... definition.
      public section.
        method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
    endclass.
    "in program
    data: r_lcl type ref to lcl...
    create object r_lcl.
    call method r_lcl
      exporting
         par    =  "pass any reference variable here
    Regards
    Marcin

  • Passing Internal table as parameter to a Method

    Hi,
    Can somebody tell me how to pass an Internal table as a parameter to a method?
    Thanks in advance,
    Best Regards,
    Manish

    data: itab1 type string occurs 0 with header line.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
    exporting
    FILENAME = 'C:\ftext.txt'
    APPEND = 'X'
    changing
    DATA_TAB = <b>itab1[].</b>
    Svetlin

Maybe you are looking for

  • Exported currency values are not seen as numbers

    Hee Guys, I've asked this question a couple of weeks before but I didn't really get an answer. I am astounded that I'm the only one that has this problem but our application mostly works whith currency values. And our reports revolve around these num

  • Balance Sheet Value

    Hi, The calculated key figure used in the report (Balance Sheet Value) is adding stock value + flow value. I’m not sure what those two fields connect to in R3 but it appears that they do not calculate correctly.      I attempted to trace those two da

  • Create script (Procedure?) to help build query in app?

    Hi, Working with SQL 2012 Express and C# WinForms. Sorry, not experience with Procedures/Functions stored within DB. Wondering if it's possible to create a script (Function or Procedure?) to build only "part" of a sql query and then use the output (r

  • How to display stored procedure results in SJSC table?

    I have been able to create a cached rowset and debug/watch the results, but do not understand how to transfer those results to a Table component. Can anyone point me in the right direction? Details: In SessionBean1.java, I declared the stored procedu

  • Java.lang.AssertionError when opening persistence unit info on Weblogic 10.3.6

    Hello everyone! Any idea of what could be causing this internal error in WLS 10.3.6.0 OOTB? It raises whenever I try to access to any persistence unit information on any deployed web application: Error opening /jsp/persistence/PersistenceUnitGeneral.