Solved

SP2013: Rendering template and SCOM

Posted on 2014-02-12
2
396 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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, …
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
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…
Suggested Courses

624 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