Questions tagged [sp.sod]

SP.SOD make sure the Scripts loaded properly. SP.SOD is defined in init.js and will be load in the HTML head section automatically.

Filter by
Sorted by
Tagged with
1
vote
1answer
754 views

SP.SOD.executeOrDelayUntilScriptLoaded wait until function has executed

We have some code that needs to access values from _spPageContextInfo. The problem is that our Custom.js file is loaded before the information is available/defined. We put the following code at the ...
2
votes
0answers
87 views

Another “load required sharepoint files” issue

I know there are many posts on the subject of dynamically loading SP files. I've tried so many of them, but none of them seem to work. As I was trying to solve an issue I realized I had to back up and ...
0
votes
1answer
74 views

How to wait on JavaScript file/function to return before executing other code?

Scenario: A web part page with multiple custom web parts that should act independently. These web parts share a lot of the same list data. My current solution makes multiple calls to the REST API to ...
0
votes
1answer
340 views

SharePoint App Part TypeError: SP.SOD is undefined

Visual Studio generates some code when you create a new add-in. I want to develop a app part which shows the current user. I added a new web-part in Visual Studio and modified the code from App.js and ...
1
vote
2answers
310 views

Do I need to load SP.ClientContext More Than Once?

I have a script that begins as follows: SP.SOD.executeFunc('sp.js','SP.ClientContext',auditCheck); function auditCheck() { var clientContext = new SP.ClientContext(); var oList = clientContext....
0
votes
1answer
433 views

Need to call SP.SOD.registerSod twice?

I have created two functional Units on my application page. One comes along in a separate script, the other is embedded via script editor web part. The external script is called fiirst all the time ...
0
votes
2answers
1k views

context.executeQueryAsync not working in Master Page

I have some JSOM code in my master page(seattle.master). The code runs until load() method on the context object but executeQueryAsync is not executing. SP.SOD.executeOrDelayUntilScriptLoaded(...
0
votes
1answer
61 views

Scripts on Demand SOD

I've been bludgeoning my way through SOD, got it all working to a point however, some strange oddities. If I create a page via the browser, add some script web parts with SOD in eg: SP.SOD....
1
vote
1answer
82 views

SP2013 CEWP not working - hardcoding of Navigation links

I have noticed that the javascript in the Content Editor webparts of my SharePoint site have intermittent failures. The page seems to be ignoring all <script> commands in the CEWP. After a bit ...
3
votes
3answers
3k views

Can't get People Picker value on 'Edit' form load

When opening a SharePoint EDIT form, I'm trying to capture a people picker value using JavaScript. Unfortunately, the people picker isn't loaded with data when I call .GetAllUserInfo. I'm using the ...
6
votes
2answers
7k views

Proper way to call multiple functions using SP.SOD.executeFunc

I need to make sure sp.js is loaded before I call several functions. I currently call them as follows in SP 2013. It works, but I suspect there is a better/more efficient way. SP.SOD.executeFunc('...
6
votes
2answers
5k views

executeFunc not working in Sharepoint 2013

I have this simple piece of code: <script type="text/javascript" src="AnotherLibrary.js" /> <script type="text/javascript"> SP.SOD.executeFunc('sp.js', 'SP.ClientContext', ...
4
votes
3answers
2k views

Custom .aspx as modal dialog not working: 'SP' is undefined

SharePoint 2013 server... I have created a custom aspx page for use as a modal dialog. I want this pop up to collect field values and return them to the form the pop up was called from. The pop up ...
2
votes
1answer
176 views

SharePoint 2013 and javascript

What is meaning of OnDemand scripts and what is not-on-demand scripts? In SharePoint 2013, when do we use SP.SOD.executeFunc and when to use ExecuteOrDelayUntilScriptLoaded ? What is best practice?