Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can someone please help me with a query on Sharepoint?

Suppose, I have a list called employee database and the list has two columns Name and employee ID.

Employee ID   Name
1             John
2             Mary
3             Peter
4             Mark

Now, I create a new list called, employee registration tracker and have following field in this list; Employee ID Name DOB

Is there any way by which, while entering a new item in this new list, I just enter employee id and using some javascript, it fetches ‘name’ corresponding to that ID from employee database list and automatically populates the field ‘Name’ in this list. So this way we do not have to again enter name.

We have approx 500 team members in different teams and we need to keep track of them. I tried various ways like cascading dropdowns etc, but such a big list it does not allows. Also like I told you earlier, I need to make all this in my enterprise firewall and other restrictions where they do not allow sharepoint integration with MS access , Sharepoint developer etc and the only way I have is easy javascript in CAML.

share|improve this question
add comment

2 Answers 2

Yes you can do this using the JavaScript Client Object Model: http://www.codeproject.com/Articles/60348/SharePoint-2010-Client-Object-Model-for-JavaScript

http://praveenbattula.blogspot.in/2010/02/sharepoint-2010-client-object-model.html

What you can do is capture the key pressed event (using jQuery) of the textbox where you enter the Employee Id and then using the JSCOM, go to the Employee Database list and fetch the employee name with that id. (It should be as simple as getting an item from a list).

And then just push the name of the employee into the appropriate text box.

share|improve this answer
    
Thanks Vardhaman. My understanding of sharepoint is limited and I am not a technie. Can you explain me in detail what I need to do as in which script to copypast in CAML etc ?? I would appreciate that. –  sid Feb 25 '12 at 12:07
    
Moreover I just discovered that this client object is only possible in Sharepoint 2010 and i think my company has 2007 version –  sid Feb 25 '12 at 12:09
    
Have a look at the following link:learningsharepoint.com/2011/09/04/… check out the method of getting all the list items from one list. You can create a caml query where you fetch all the employee names for which the employee id is the one specified in the text box on your form. –  Vardhaman Deshpande Feb 25 '12 at 12:13
add comment

If you are on SP 2007, consider using Web services. For example the SPServices library has a utility called $().SPServices.SPDisplayRelatedInfo that just does what you're looking for.

Another option would be to build a workflow in SharePoint Designer that will fetch the other columns after you save the form.

For the record SP 2010 does this out of the box with lookup columns.

I should also mention that duplicating information is not a good idea. SharePoint provides other techniques, like joined views or Web Part connections, to achieve what you want.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.