How can I call a Jscript function from XML, which is written seperatly outside the xml file

Dear All,
I have made a SharePoint ribbon button which should display an alert message with SharePoint custom list
ID information. But it has problem for calling the Jscript methods, It may be a XML tag mistake!!! Unable to
find the error in code line!!!, can somebody please tell me this error by referring my code snippet????
It is a farm SharePoint solution I have kept the Jscript file in mapped folder named "Layouts"
It  is showing the error as : JavaScript runtime error: The value of the property 'myFunction' is null or undefined, not a Function object
That means, as I understand the control is not moving or not calling the function from JScript file....why it
is so...not able to debug JScript or xml using Visual Studio that makes my effort tedious!!!
Code:
Elements.xml
<CommandUIHandlers>
<CommandUIHandler Command="ShowAlert" CommandAction="javascript:retrieveListItems()" EnabledScript="return true;"/>
</CommandUIHandlers>
<CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js"/>
</Elements>
RibAlert.js
<script>
var siteUrl = http://A5-1224';
function retrieveListItems()
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Measurements'); //getByTitle('Custom List');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
</script>

Hi,
I suggest you write an alert() in your function to check whether it can be executed first.
If alert() is ok, then it would be an issue of the code with Client Object Model, you can take a look at the link below about How to retrieve List Items Using JavaScript:
http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
If alert() can’t be executed, then please check whether the steps of created ribbon button is correct.
The links below about how to add a custom button to the ribbon:
http://aarebrot.net/blog/2010/09/adding-a-custom-button-to-the-ribbon-using-a-feature-in-sharepoint-2010/
http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-create-custom-button-in-sharepoint-2010-ribbon-user-interface/
https://pholpar.wordpress.com/tag/custom-actions/
What’s more, there seems no query succeeded handle function in your code, please take a look at the link provided above for a reference.
Thanks
Patrick Liang
TechNet Community Support

Similar Messages

  • How can I call a plsql function from an attribute?

    I have an attribute defined in an element. I want execute a PLSQL function from the attribute, and display the returne value with an HTML template.
    I've defined the attribute's type like PLSQL, and I've put the called of the function in the value of the attribute, but it doesn't work. The only value I obtain is an URL (I think that is the URL of the function or someting like this).
    How can I call to my function from the attribute and display the returnes value in the page?
    Thanks.

    Thanks, but it doesn't work. I have an attribute called ID_BOL and I want to associate a sequence to that attribute. I've created a function, with the sequence. This function return de value of the sequence. I want taht the attribute takes the value of the sequenece dinamically.
    I've tried it, creating the type attribute like PLSQL, and calling the function from the attribute, but it doesn't work.
    How can I return the sequence value to my attribute?
    Thanks.

  • How can I Re-Download Purchased Movies from Itunes store. Somehow I lost The original File?

    The movie “The Hunted” could not be used because the original file could not be found. Would you like to locate it?
    The above message appears whenever I try and play a movie from Itunes
    Is it possible to Re-Download purchased movies from Itunes as I have lost the original files somehow?

    You can re-download music, books, tv shows, and 3rd apps, but not movies.
    http://support.apple.com/kb/ht2519

  • How can I run a BW Function from EXCEL-IN-PLACE (BPS)??? Please give any ex

    How can I run a BW Function from EXCEL-IN-PLACE (BPS)using VBA??? Please give any example.
    I would like to run my function module ZMY from EXCEL-IN-PLACE using VBA and get a result.

    if you are using excel in place in the web application environment I doubt you can, you've never really had any macro functionalty there.
    If you are in the gui environemnt (Planning folders) it will depend on how you want to invoke the module...

  • Can any one tell me how can i call a shell script from pl/sql

    i like to call shell script from pl/sql procedure.
    can any one suggest how can i do this

    Have you not mastered in asking the same kind of question ?
    First do write a script...
    no one will spoon feed you.
    How can i call a shell script from procedure
    How to call Shell Script from pl/sql block
    -Sk

  • How can i call mouse click event from keypress event???

    How can i call mouse click event from keypress event???
    I want same GUI changes to be occured at key press.....i.e . button going down & comming up.....
    for calculator

    Put all the code that happens on those events into a method. Then call that method from both events.

  • How can i call Apple in usa from Egypt to buy an iPhone from Apple store please who khnow the contacting number answer me :)

    how can i call Apple in usa from Egypt to buy an iPhone from Apple store please who khnow the contacting number answer me

    http://www.apple.com/eg/buy/
    There are three companies linked to towards the bottom right to purchase an iPhone from. Above those three is Arab Business Machine. Choose one, or check each one out.

  • How can I move my iPhoto Library from one Mac to another without losing the comments on the individual photos in the process?

    How can I move my iPhoto Library from one Mac to another without losing the comments on the individual photos in the process? The source Macbook (OS 10.4.11 and iPhoto 6.0.6 (3.2.2.)) is with my husband in Germany, the target MacBook Pro (OS 10.8.5, iPhoto 11) is with me in Japan. Thanks for your help.

    I copied the iPhoto Library to a CD and from there to the new MacBook
    If you copied the library to the CD via the Finder it would be no different than the methods Terence suggested.  If you used the Share ➙ Burn menu option from inside iDVD you'll get a mini library that has to be accessed from the open library and the events/alubums copied into the destination library.  Not the same as the other methods.
    The Share ➙ Burn method is no longer supported with iPhoto 9 and later.
    OT

  • How can i erase my .me mails from my iPhone and keep them in the server

    how can i erase my .me mails from my iPhone and keep them in the server

    You can't. The iPhone doesn't actually store all your emails anyway. It is showing you what is on the server directly.
    Only the most recently accessed emails are cached (stored temporarily) on your phone for access when you are offline. If you delete an email from your iPhone, you are actually deleting it from the server.

  • How can i call a shell script from procedure

    I have a shell script.now i am i a situation to call that shell script from one of my procedures and need to get a value from that script.
    can u suggest me that how can a call the shell script from pl/sql?

    Is the same question you asked here
    How to call Shell Script from pl/sql block
    -SK

  • How do I call pl/sql function from Toplink

    I can easily call a stored procedure from Toplink
    ====================================================
    public Collection executeSelectingStoredProcedure(StoredProcedureCall storedProcedureCall) throws DAOException
    Collection returnValue = null;
    Session session = null;
    session = this.getSession();
    returnValue = session.executeSelectingCall(storedProcedureCall);
    session.release();
    return returnValue;
    ====================================================
    The same does not work for pl/sql functions. Doesnt Toplink treat function calls as a callable statement as in JDBC?
    "select <function_name>(<arguments>) from dual" seems to be a work around. If this or using expressions is the only solution can someone please tell me the reasoning behind this shift.
    Regards
    Aamir Dehlavi

    I have the same problem.
    I have a PL/SQL function that returns a number. This function receives 2 parameters. I use StoredProcedureCall plus ValueReadQuery.
    Session aSession = SessionManager.getManager().getDefaultSession();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CIO_UTILS.COUNT_USER_ROLES_IN_MODULE");
    call.addNamedArgument("p_persid");
    call.addNamedArgument("p_module");
    call.addUnamedOutputArgument("rolesnum", Integer.class);
    ValueReadQuery query = new ValueReadQuery();
    //query.bindAllParameters();
    query.setCall(call);
    query.addArgument("p_persid");
    query.addArgument("p_module");
    Vector parameters = new Vector();
    parameters.addElement(persid);
    parameters.addElement(theModule);
    Integer rolesnum = (Integer) aSession.executeQuery(query,parameters);
    aSession.release();
    if(rolesnum.intValue()<=0)return false; else return true;
    However, I receive the following error:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 96:
    PLS-00312: a positional parameter association may not follow a named association
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call:BEGIN CIO_UTILS.COUNT_USER_ROLES_IN_MODULE(p_persid=>'SANCRA2791', p_module=>'PSL_MONITORING', ?); END;
         bind => [=> rolesnum]
    If comment the line
    "call.addUnamedOutputArgument("rolesnum", Integer.class);"
    Toplink is trating it as a procedure, and I also receive an error from PL/SQL.
    There should have to be a way of make it to receive the resoult somehow, but I do not know what.
    Thanks in advance.

  • How can I call a LabVIEW executable from within another LabVIEW executable?

    I have a customer requirement for two LabVIEW executables. Based on their current setup, they need to run executable "A" or "B", both of which are under independent revision control. I have created a third "selection" executable that allows the operator to choose between one of the two, but I am receiving errors when I attempt to call a LabVIEW executable from within a LabVIEW executable using either the "System exec" VI or the "Run Application" VI. If I call a non-LabVIEW executable (such as Windows Explorer) everything works fine.

    > I have a customer requirement for two LabVIEW executables. Based on
    > their current setup, they need to run executable "A" or "B", both of
    > which are under independent revision control. I have created a third
    > "selection" executable that allows the operator to choose between one
    > of the two, but I am receiving errors when I attempt to call a LabVIEW
    > executable from within a LabVIEW executable using either the "System
    > exec" VI or the "Run Application" VI. If I call a non-LabVIEW
    > executable (such as Windows Explorer) everything works fine.
    As with the other poster, I suspect a path problem. You might try the
    path out in a shell window, and if it works, copy the complete absolute
    path to LV to see if that works. LV is basically passing the comma
    nd to
    the OS and doesn't even know what is in it, so you should be able to get
    it to work.
    The other poster commented on subpanels, which is a good suggestion, but
    without going to LV7, an EXE can have open more than one VI. You can
    use the VI Server and the Run method to fire up another top-level VI.
    The decision is whether you want both to be in unique processes.
    Greg McKaskle

  • How can I call a java object from Web dynpro ABAP application?

    I made Web dynpro ABAP application and posted it to SAP EP.
    For certain business purpose, we need to call external 3rd party java object using 3rd party's java api in Web dynpro application.
    Is there anybody who experienced this kind of java interface issue?
    I know Web dynpro Java environment can fully support this kind of requirement. but regarding Web dynpro ABAP, I couldn't find any clue for this.
    Any comment or suggestion would be greatly appreciated.
    Thanks,
    Raymond, ABAP Consultant

    if you have jco configured, then you can make calls to java api from ABAP .
    check out this weblog.
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    Raja

  • Can I call a C function from Java (using JNI) ??

    hello,
    I need to call one C function from remote device and get its return value(o/p) (for my application it is device SSID ) and display in the client PC.
    Is it possible in java without using SNMP connction?.
    please give me idea about it.
    I need this information as soon as possible.
    Thank you.

    see JNI...
    basically declare a native method in your java class, then run javah on the class thus generating a *.h file. Then implement the c/c++ function. Compile the c/c++ part as a shared library, and make sure its accessible from your LD_LIBRARY_PATH env variable.
    Go through the steps in the JNI docs, and things shoulde be fine... hopefully ;)

  • How can I call a server function by a button?

    Hello, world...
    I have a problem...
    I need to call a server function by pushing a button. I put the condition on the label...
    This is my script:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                 checkBtn = (writeBtn1.label == "Conferma" && textInput1.text != "" );  //my condition...
                 if (checkBtn)
                     nc.call ("WriteNow",null,textInput1.text+"\n");
                    writeBtn1.label = "Fatto";
    I'd like to call the function on the release of the button...
    Can someone helps me?
    Please...
    Emiliano.

    use:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn2.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn3.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                if(e.currentTarget==writeBtn1){
                 // do whatever
               } else if(e.currentTarget==writeBtn2){
                 // do whateverelese
              } else {
                 // it's writeBtn3

Maybe you are looking for