Page 1 of 1

Create list item with button

Posted: 02 Jun 2016
by MikeDLato
Hi There,

I have built a custom SPForm that captures registration data for seasonal workers. When the season completes I want to have the user click a button that creates a new list item in a different list (season history) with a subset of data from the original form, and then blank out the values on the main form. I thought of doing it with a workflow, however if the workflow fails to trigger, then the information will effectively be lost.

I have seen some other posts on doing this, but I haven't managed to get it to work. Any guidence would be great.

Re: Create list item with button

Posted: 03 Jun 2016
by Dmitry Kozlov
Hi Mike,

You can add an item to another list via JSOM. Here is a sample:

https://msdn.microsoft.com/en-us/librar ... onSection0

Re: Create list item with button

Posted: 03 Jun 2016
by MikeDLato
Thanks Dmitry. I've been trying exactly that, I've used that code in the SPForms JS Framework, set the function to global, so I can call it from an OnClick of a button, but the actual adding of the item fails. No error, just simply nothing happening. I know the OnClick call is working, because if I simply call an alert, that works fine. I'll keep pluggin away until it works, but any other ideas would be great.

Thanks

Mike

Re: Create list item with button

Posted: 03 Jun 2016
by MikeDLato
I've worked it out thanks Dmitry. I was just being a doofus and using the wrong List Title.