?
Solved

SP2013: Rendering template and SCOM

Posted on 2014-02-12
2
Medium Priority
?
397 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 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

718 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