Solved

SP2013: Rendering template and SCOM

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now