Solved

SP2013: Rendering template and SCOM

Posted on 2014-02-12
2
395 Views
Last Modified: 2014-02-21
I have  a rendering template which contains SCOM code to delete list item. Nothing fancy.

            var clientContext = new SP.ClientContext("XXXXURL");
            var oList = clientContext.get_web().get_lists().getByTitle('XXXLIST');
            var oListItem = oList.getItemById(FROMVARIABLE);

            oListItem.deleteObject();
            clientContext.executeQueryAsync( ...

Open in new window


Problem. SharePoint deletes target list items but gives me an error: "Error: Unable to get property 'apply' of undefined or null reference" (ScriptResource.axd). I am not able to figure out what I am missing.  Seems like like I need need to include spjavascriptX. Any help would be appreciated.
0
Comment
Question by:tolppa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
devic earned 500 total points
ID: 39854046
I'm not familiar with  SP/SCOM, but one common mistake is, if someone is trying to access some element, that not exists yet.

maybe you can move your code to the end, just before </body>

maybe you need run this code after page loaded or something already added.


try check step by step.

var clientContext = new SP.ClientContext("XXXXURL");
console.debug('clientContext :' + clientContext );

var oList = clientContext.get_web().get_lists().getByTitle('XXXLIST');
console.debug('oList: ' + oList );

var oListItem = oList.getItemById(FROMVARIABLE);
console.debug('FROMVARIABLE:' + FROMVARIABLE);

Open in new window

0
 
LVL 1

Author Closing Comment

by:tolppa
ID: 39876592
I were able to fix my problem when I replaced clientContext.executeQueryAsync(onQuerySucceeded) ... with clientContext.executeQueryAsync(function () { //CODE.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Jquery Calculation 3 43
Pass a js value to an html form 5 43
How does this modal gets closed? 6 42
Global version website variable for clearing cache 10 33
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question