Add items in another list
I have 2 lists A and B,list A has a custom newform, in this newform i want to provide 2 sections, one section has textboxes which saves the items in the current list ie A, and another set of textboxes needs to save the item in list B,
In short i should be able to save the items values in 2 different lists at my will.
OOB, You can do that in infopath form
http://sharepoint.stackexchange.com/questions/46679/submit-multiple-entries-to-one-list-with-one-infopath-form
http://www.sharepointsharon.com/2011/11/infopath-2010-one-form-multiple-views/
Or
http://sharepoint.stackexchange.com/questions/22360/single-form-for-multiple-lists
you need to write a event receiver
In easier to implement option than an event receiver is a Workflow, triggered by the first list, to insert data from that entry into another list.
This can be easily built using SharePoint Designer
If this helped you resolve your issue, please mark it Answered
Similar Messages
-
Update one list item to another list using WF
hi
i have a SP Designer workflow which copies one list item to another list
but if i edit the 1st list this will copy a new item to another list i want the same item to be edited without making a new copy of the item.
Alen Austinso in the workflow separate between on edit and on new item, so mostly you will need to either do checking and have variable saved to know if you are editing only, or create 2 workflows one when you add new item and other when u edit (if needed)
Kind Regards,
John Naguib
Senior Consultant
John Naguib Blog
John Naguib Twitter
Please remember to mark this as answered if it helped you -
How to check if a list contains items from another list
Hi all,
I am trying to check whether a text list contains items form
another list and then do something. I tried:
tlist contains text phrases (e.g., test1,test2,test3)
phrases = ["test1","test2"]
n = phrases.count()
tList.getPos(phrases.item[n])
alert("should not be inluded in the list")
But it is not working any ideas why?myPhrase is the loop index, but instead of a numerical index
(like n in your sample), myPhrase is set equal to each item in the
phrases list, first item to last. So, on the first iteration
myPhrase = “test1”, on the second iteration myPhrase =
“test2”. The loop automatically exits when the end of
the list is reached. The Director help docs have more information
on this syntax under “repeat”
BTW: if you're more comfortable using a numerical index, the
syntax for getting at the n-th item in a list is list[n], or in
your sample phrases[n] -
How to add item to a List with a bounded wildcard
Hi,
Is there a way to add a subtype instance to a List with a bounded wildcard? For example, say I have an
abstract class called Car. Then I have 2 concrete subclasses--Ford and Toyota. Now say I have another
class that contains a prepopulated list and is wildcard bounded like this: List<? extends Car> carList. I
want to add a method where I pass in a Car subtype as a parameter and then add it into this list, e.g:
public void addCar(Car car) {
carList.add(car);
Trying this, I keep getting "cannot find symbol" compilation errors. When I went back to read the Generics
tutorial by Bracha, he mentions that explicitly adding a subtype, e.g. carList.add(new Ford()), can not be
done. But here I'm adding the "upper bound" of the wildcard, i.e. the Car type. Therefore there should be no
discrepancy between supertype and subtype an thus the carList.add(car) should be ok, IMO.
Am I misunderstanding something with this logic? Also, if carList.add(car) can not be done, then how can
I go about doing something similar which will allow me to add subtypes to a "generic" list?
Thanks in advanced!
-losI get a compilation error expecting an Object instead of a Car. Of course you did. List<? super Car> is a list into which you can put cars -- and possibly other stuff. List<? extends Car> is a list out of which you can get cars (possibly of different makes).
Do you need a list that you can put cars in and get cars out? That's List<Car>
This isn't a linguistic problem you are having; this is a design problem. If you have a function that takes an argument which is a list that you can put any kind of car into and be sure of getting a car out of, it isn't reasonable to pass in a List<Ford> (because the function might put in a Chevy) or a List<Object> (but there might be motorcycles already in there). By the requirements you have, you need a List<Car> and nothing else.
Yes, you could use a cast, but all you are doing is circumventing the type system by saying "I know this List<Object> only has Cars in it." -
SPListItem deleting save the list item into another list.
Hi Friends,
Using SPList Item deleting event receiver ,before deleting the item I want save the list item to the another SharePoint list.
How can we do this using event receivers.Please help me anyone.
Thanks,
Tiru
TiruBefore delete the item, use the below logic
http://stackoverflow.com/questions/1075323/copy-list-items-from-one-list-to-another-in-sharepoint
or
You can do this by 2 workflows one creating list item by copying and second workflow on the copied item which will delete the original list item.
http://sharepoint.stackexchange.com/questions/93441/move-items-from-one-list-to-another-list-using-sharepoint-designer-2010
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/100c0b3c-72d9-4427-a48f-8300be508aa2/how-do-i-copy-the-items-in-a-sharepoint-2010-list-to-another-list?forum=sharepointgeneralprevious -
Unable to add items to dropdown list using javascript
Hi,
I'm trying to add additional items to a dropdown list at runtime using javascript.
I'm doing this by invoking the addItem method on the dropdown list field during its initialize event.
However when I run the generated pdf in Acrobat Pro, I get the following error in the console -
GeneralError: Operation failed.
XFAObject.addItem:3:XFA:form1[0]:#subform[0]:field0[0]:initialize
Method: 'addItem' cannot be called because doing so would violate this document's permissions settings.
The pdf form has no signatures or any other stuff in it.
What additional permissions do I need to add and how ?
You can view the pdf here -
https://dl.dropboxusercontent.com/u/8022836/xfa3_test.pdf
Thanks,
JoelIs there a reason to use the code you did? It looks like the problem is with the variable's permissions when going through the template.
This code works just fine in that same event:
this.addItem("new item");
As does:
var f = xfa.resolveNode("form1.#subform1[0].field0");
f.additem("new item"); -
Add Item In Dynamic List form ...
Hello ,
I have created a dynamic list form using C# webpart in SharePoint 2013 .. Now it is creating List new Item form based on list view selected items ...
I want to create functionality to add the list item .. how can I achieve this.?
I am confused because list is creating dynamic controls and having dynamic id's ..then how can i get reference of all controls from dynamic form ..
Thanks in Advance..Hi,
I’m not quite sure about what your requirement is, please provide more detailed information such
as screen capture or code, it will be easier for others to find a solution for you.
Best regards
Patrick Liang
TechNet Community Support -
Problem i have is with method called wordMenu() which is inside method called show(). Problem is that last line of method wordMenu() should add newly created words to the mDatabase.
If i use method listWords() (SWITCH 3) i see newly added words on the bottom of the list which is intended. But they never appear if i run the game test again (SWITCH 1). Those newly created words by user should
be added to the mDatabase and program should be able to use them to create new random word list for test.
I dont understand why newly created words appear if i just list words by method from switch 3 but they do not appear in new test-switch1, can someone help me understand and fix this problem with my program.
import java.util.Scanner;
* Class which interacts with user using scanner.
* And runs the main method of the program.
public class Menu
public Scanner mScanner;
private static TestGenerator mGenerator = new TestGenerator();
private WordDatabase mDatabase;
* Constructor for objects of class Menu
public Menu()
mScanner = new Scanner(System.in);
mDatabase = new WordDatabase();
* Main method that runs our program.
* From welcome menu trough test or adding new words.
* Up to the goodbye screen.
public void show()
login();
while(true)
welcomeMenu();
if(!mScanner.hasNextInt())
System.out.println(mScanner.nextLine() + " är inte giltigt input");
continue;
int option = mScanner.nextInt();
switch(option)
case 1:
//clearScreen();
Test test = mGenerator.generateNewTest();
test.start();
break;
case 2:
clearScreen();
wordMenu();
clearScreen();
break;
case 3:
clearScreen();
listWords();
break;
case 4:
clearScreen();
if(goodbyeMenu()){
return;
else{
break;
default:
System.out.println("--> Förstår inte <--");
break;
* Method that list all words currently in database.
private void listWords()
for(int i = 0; i < mDatabase.size(); i++)
System.out.println(mDatabase.get(i));
System.out.println();
* Method that prints out welcome text.
* Helps with keeping main method easier to understand.
private void welcomeMenu()
System.out.println("Hej och välkommen till Igor's glostränare!");
System.out.println();
System.out.println("1.Kör glostest");
System.out.println("2.Registera ord");
System.out.println("3.Skriv ut alla glösor.");
System.out.println("4.Avsluta testet.");
System.out.println();
System.out.print("Vad vill du göra ? --> ");
* Method that takes users name.
* Helps with keeping main method easier to understand.
private void login()
System.out.print("Ditt namn: ");
mScanner.nextLine();
System.out.print("\f");
* Method that allows user to add new words into database.
private void wordMenu()
System.out.println();
System.out.println("Lägga till ord menyn");
System.out.println();
System.out.print("Svenska:-->");
String Svenska = mScanner.next();
System.out.println();
System.out.print("Engelska:-->");
String Engelska = mScanner.next();
System.out.println();
System.out.print("-->");
System.out.println(Svenska + ":" + Engelska);
System.out.println();
Word word = new Word(Svenska, Engelska);
mDatabase.add(word);
* Method that creates goodbye screen.
private boolean goodbyeMenu()
System.out.println("Är du säker att du ska avsluta program");
System.out.println();
System.out.println(" 1 - avsluta");
System.out.println(" 2 - gå tillbaka");
System.out.print("-->");
int input = mScanner.nextInt();
if(input == 1){
return true;
else{
return false;
* Method that clears the screen allowing better overwiev.
private void clearScreen()
System.out.print('\u000C');
}Another class which holds method start()
import java.util.ArrayList;
import java.util.Iterator;
* Class that runs test and counting results.
public class Test
private ArrayList<Word> mTestWords;
private int mScore;
* Constructor for objects of class Test.
* @param is ArrayList wordlist from class Word.
public Test(ArrayList<Word> wordList)
mTestWords = wordList;
mScore=0;
* Method which count and print out test results.
public void start()
System.out.println("Nu startar testet");
Iterator<Word> it = mTestWords.iterator();
while(it.hasNext())
if(it.next().answer())
mScore++;
System.out.println("Testet avlklarat; " + mScore + "/" + mTestWords.size());
} Third class that generates test
mport java.util.ArrayList;
* This class generates tests using class RandomN and WordDatabase.
public class TestGenerator
private RandomN mRandom;
private WordDatabase mDatabase;
* Constructor for objects of class TestGenerator.
public TestGenerator()
mDatabase = new WordDatabase();
mRandom = new RandomN(mDatabase.size());
* Method that add new words to our wordlist.
* @param new (word).
public void addWord(Word word)
mDatabase.add(word);
mRandom = new RandomN(mDatabase.size());
* Method which randomly pick values from our database.
* @return Test randomly picked values from database list.
public Test generateNewTest()
ArrayList<Word> wordlist = new ArrayList<Word>();
for(int i = 0; i < 10; i++)
int max = mDatabase.size();
Word word = mDatabase.get(mRandom.getRandomValue(max));
while(wordlist.contains(word))
word = mDatabase.get(mRandom.getRandomValue(max));
wordlist.add(word);
return new Test(wordlist);
}Edited by: 901605 on 2011-dec-10 12:32
Edited by: 901605 on 2011-dec-10 12:35
Edited by: 901605 on 2011-dec-10 12:37Because you're using 2 word databases, when you apparently want only one.
The mDatabase in your Menu class is used for adding the words and displaying, but in your TestGenerator class you create another mDatabase to be used for creating the random tests. -
Retrieve Title field values from multiple lists and add into another list
Hi , Iam trying to retrieve Title field value from multiple lists. and add them into another list. using Javascript. Can any one help me in doing this. Below is the code.. function save() { clientContext = new SP.ClientContext.get_current(); oWebsite = clientContext.get_web(); oList = clientContext.get_web().get_lists().getByTitle('MainList'); clientContext.load(oList); clientContext.executeQueryAsync(OnSucceeded, onQueryFailed); } function GetListItemValue(listName, fieldName) { var list = oWebsite.get_lists().getByTitle(listName); var eventValue = document.getElementById(fieldName).value; eventValue = eventValue.replace(",", ""); var camlQuery = new SP.CamlQuery(); var filterdata = '<view><query><where><eq><fieldref name="Title/"><value type="Text">' + myreqValue.trim() + '</value></fieldref></eq></where></query></view>'; camlQuery.set_viewXml(filterdata); listItems = list.getItems(camlQuery); clientContext.load(list); clientContext.load(listItems, 'Include(Id)'); clientContext.executeQueryAsync(Succeeded,Failed); } function OnSucceeded() { itemCreateInfo = new SP.ListItemCreationInformation(); oListItem = oList.addItem(itemCreateInfo); oListItem.set_item('Title', 'My New Title'); var deptItemLookupField = new SP.FieldLookupValue(); //Problem in below line...I was unable to get ID var getId = GetListItemValue("Listname1", "txtboxname1"); alert("ID" + getId); if (getId != undefined) { deptItemLookupField.set_lookupId(getId); } var getId12 = GetListItemValue("Listname12", "txtboxname12"); alert("ID" + getId12); if (getId12 != undefined) { deptItemLookupField.set_lookupId(getId12); } oListItem.update(); clientContext.executeQueryAsync(itemadded, itemFailed); } function itemadded() { alert('Item added successfully'); } function itemFailed(sender, args) { alert('Item added itemFailed' + args.get_message() + '\n' + args.get_stackTrace()); }
RajHi,
For this requirement, you will need to retrieve all the lists objects you want firstly, then execute the requests one by one to get the value of the Title column using CAML or
LINQ.
How to: Retrieve Lists Using JavaScript
http://msdn.microsoft.com/en-us/library/office/hh185009(v=office.14).aspx
About
retrieve list items:
http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
You can use
Promise in your script to make your requests sequentially:
http://www.shillier.com/archive/2013/03/04/using-promises-with-the-javascript-client-object-model-in-sharepoint-2013.aspx
http://www.learningsharepoint.com/2013/08/13/using-deferred-and-promise-to-handle-async-calls-in-sharepoint-client-object-model/
Best regards
Patrick Liang
TechNet Community Support -
Component to allow the user to build a list from another list's items
Hello everybody,
I'm looking for a widget that allows the user to create a list by choosing from items from another list.
Something like the tool to customize the button bar in MS Office or MS Explorer. You can see an example of what I'm talking about:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/databoundcomponents/displayedcolumns.gif
It would be easy to program a component like this (and I've already found some piece of code by Googling), but I'd like to know if someone made a stable Swing component of it to avoid reinventing the wheel.
Thanks in advance.There is one here
http://www.geocities.com/nirajkagarwal/html/ListSelect
or.htmlThanks, I already found this one via Google but I was looking for something more "professional".
It seems the apache project team made a utility to
control elements in a list...it seems very generic
(maybe over-flexible if there is such a thing...) and
really needs a tutorial !!!
http://incubator.apache.org/uima/apidocs/org/apache/ui
ma/tools/util/gui/ListSelector.htmlYes, it really looks like a work in progress.
I'll wait some more to see if other readers come with links, then I'll start coding my own ListSelector ;-)
NB: another example of what I want to accomplish is shown in figure http://java.sun.com/products/jlf/ed2/book/images/SelectableList1.gif -
Javascript help to copy selected items from one list to another list on same site
Hello,
So I have a request that I am not sure how to handle. I have created a page with a list view webpart that displays all the items from one list.
The user is then supposed to select off multiple list items and click on a button (most likely a ribbon button) that will take the selected items and copy them to another list on the same SharePoint site.
I would like to do this with JavaScript, but have only found an example that copies library items to another library.Hi KansaiKel,
According to your description, my understanding is that you want to copy selected list items to another list.
I suggest you can use JavaScript Client Object Model to achieve it.
Here is a code snippet for your reference:
<script type="text/javascript">
var context = SP.ClientContext.get_current();
var siteUrl = 'http://sp2013sps/sites/test';
var clientContext = new SP.ClientContext(siteUrl);
var web = context.get_web();
context.load(web);
var sourceId = SP.ListOperation.Selection.getSelectedList();
var source = web.get_lists().getById(sourceId);
var oList = context.get_web().get_lists().getByTitle('Copy');
context.load(oList);
var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);
alert('debut');
for(var i in selectedItems)
var currentItem = source.getItemById(selectedItems[i].id);
context.load(currentItem);
context.executeQueryAsync(Function.createDelegate(this,test),Function.createDelegate(this,error));
function test(sender, args){
var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', currentItem.get_item('Title'));
oListItem.update();
oList.update();
alert('done');
function error(sender, args){ alert('error');}""
</script>
Here is a detailed article for your reference:
Complete basic operations using JavaScript library code in SharePoint
Best Regards
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Zhengyu Guo
TechNet Community Support -
Not able to set databinding for dropdown with another list datasource
Hi
I have created one dataviewwebpart on the basis of list1.
Now I want to add one dropdown in one of the column which will display the values of another list.
So I added link datasource as list2 for another datasource.
I want to display versionID's from another list for the item present in the row to this dropdown and when user click on icon I will pass selected version ID and ItemID(available in the row). So the user will able to see the selected version of the
seleted item in another list.
But I am not able to select versionID form list2 in "Change databinding" for the dropdown.
In select a datasource dropdown its not showing the linked datasource of List2.
What can I do ?
Is there any other solution ? Am I missing anything?Hi,
I recommend to edit the dropdown control with the code below:
<SharePoint:DVDropDownList runat="server" id="ff5{$Pos}" DataSourceID="FilteredLookup" DataTextField="Title" DataValueField="Title" SelectedValue="{@MathTeachers}" __designer:bind="{ddwrt:DataBind('u',concat('ff5',$Pos),'SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@MathTeachers')}"/>
Please remember to change the id, DataSourceID, DataTextField, DataValueField and SelectedValue to the value in your page code.
More reference:
https://www.mriwm.com/Public/PamBlog/Lists/Posts/Post.aspx?ID=39
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
How to create new subsite while adding new item to the list by using javascript?
hi,
I hav a task ie, when I add item to the list then subsite will create with that list item title and description . So By using javascript, I have to create subsite while adding new item to the list.
Help me to solve this.
Thank you,Is your item getting added through Javascript client object model ? If yes, you can write in the success delegate of your list creation method the logic to create the subsite.
function CreateListItem()
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('List Name');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', 'My New Item!');
oListItem.set_item('Body', 'Hello World!');
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.CreateListItemOnSuccess), Function.createDelegate(this, this.onQueryFailed));
function CreateListItemOnSuccess() {
var subsiteTitle = oListItem.get_item('Title');
//Logic to create a subsite
function onQueryFailed(sender, args) {
I have added a sample flow for the above scenario. Have a look at the following lnk for how you can craete a subsite using ecmascript.
http://ravisoftltd.wordpress.com/2013/03/06/sharepoint-2010-create-site-with-ecma-script-with/
Geetanjali Arora | My blogs | -
How to Update multiple items in other list using event handler?
Hi All,
If i update a item in a list, then i should update multiple items in another list need to be update. How to achive using event receivers?Hi Sam,
According to your description, my understanding is that you want to update multiple items in another list when updated a list item.
In the event receiver, you can update the multiple item using Client Object Model.
Here is a code snippet for your reference:
public override void ItemUpdated(SPItemEventProperties properties)
string siteUrl = "http://sp2013sps/sites/test/";
ClientContext clientContext = new ClientContext(siteUrl);
List oList = clientContext.Web.Lists.GetByTitle("another list name");
ListItem oListItem = oList.GetItemById(1);
oListItem["Title"] = "Hello World Updated!";
oListItem.Update();
clientContext.ExecuteQuery();
Best regards,<o:p></o:p>
Zhengyu Guo
Zhengyu Guo
TechNet Community Support -
Ecma script add item with people picker field
hello,
I need to add item to a list which is having people picker ,i need to insert the value but it is not working for that field alone.
is there any different procedure is there.
thanksHi Krishnakumar_DeV,
Do you mean to add list item with people and group field value, multiple users and groups?
Use the follow sample code:
var users = new Array();
users.push(SP.FieldUserValue.fromUser(“user1alias”));
users.push(SP.FieldUserValue.fromUser(“user2alias”));
item.set_item(columnname, users);
item.update();
How to User ECMA CSOM to Set a field of Type SPFieldUserValue:
http://sharepoint.stackexchange.com/questions/47872/how-to-use-ecma-csom-to-set-a-field-of-type-spfielduservalue
Thanks,
Qiao Wei
TechNet Community Support
Maybe you are looking for
-
Photos I take now don't appear on the map?
I have the new ipod touch. It was working until yesterday evening. I love this feature. GPS is working by the way. Any ideas?
-
Songs in itunes music folder not showing
Hello all: Songs in user/music/itunes music folder are not showing up in itunes 7.6.1 are not showing in the itunes application. Recently upgraded from previous version. TIA for any advice.
-
Recently when using iTunes to print a CD case insert the album artwork just comes out as a black square on both sides. I have used this OK previously (before recent iTunes updates).
-
WRT160N Router Firmware - Download page incorrect
I am trying to check if the firmware on my new WRT160N was the latest (I have 1.02.4-CA). I found to the Linksys Canada support page for the WRT160N (http://www-ca.linksys.com/servlet/Satellite?c=L_Content_C1&childpagename=CAen%2FLayout&cid=115378111
-
Problem while starting Mini SAP
In Mini SAP when clicking Start SAP MBS before calling SAPLogon-it is giving errors as- Call clean-up function... ***ERROR=>SigICallExitRoutine: not initialized[Signt.C0239] return from clean-up function... (1)disp+work.exe has encountered a problem