Page 1 of 1

Add new item to antoher site list

Posted: 28 Apr 2015
by Sebastian Haugland
I have made a form in one list and in that form I would like to have a button where I can click to add an item (with predefined data) to another list in another site. Any suggestions to a script? (no user input)

Re: Add new item to antoher site list

Posted: 29 Apr 2015
by Dmitry Kozlov
Hi Sebastian,

You can add an item to another list with the help of JavaScript by using CSOM (or REST) and our JS-framework to retrieve values from the current form's fields.

Re: Add new item to antoher site list

Posted: 29 Apr 2015
by Sebastian Haugland
Thanks, but I have allready tried that - gets no error, just not working - , is this only working in SP 2013? (I am on 2010).

Could all functions be in the button script or do they have to be in the JS editor of the form? (only calling them from the button.

Re: Add new item to antoher site list

Posted: 29 Apr 2015
by Dmitry Kozlov
This approach works in SharePoint 2010 as well:

https://msdn.microsoft.com/en-us/librar ... e.14).aspx

You can define functions globally in the general JavaScript editor of Forms Designer but you should use the following syntax:

Code: Select all

window.my_global_func = function() {

}
Next, you will be able to use this function in OnClick handlers:

Code: Select all

my_global_func();