I need to get the value of a lookup control on a display form and store it in a variable. I was thinking I could use SPServices to accomplish this, but (unfortunately) I don't have much experience with it.

I also need to do the same on the edit form, but also recapture the value if it changes.

Any pointers would be greatly appreciated.

  • Just use javascript to get the value of the element containing the field value. jQuery may make this easier if you're new to JS. – wjervis Mar 17 '18 at 20:34
  • What are you going to do with the value stored in a variable? Can you give us a few more details about your project? – Mike Smith - MCT - MVP Mar 17 '18 at 22:54
  • I’m planning to create a cookie and pass the variable to it. The cookie will be used to pass the value to a hidden field in another form. In theory, this hidden field will be used to filter a lookup in this second form via spservices. – Jonathon Carrell Mar 17 '18 at 23:56
  • The big picture goal is to filter a lookup in a child form based on a lookup value in the parent form. There is a relationship between the parent and child lookups that I’m hoping to leverage as a filter. – Jonathon Carrell Mar 17 '18 at 23:58
  • You probably want to use SPUtility.js not SPServices.js. github.com/kitmenke/sputility/blob/master/README.md – mannaggia Mar 18 '18 at 1:20

I was able to store the parent lookup value and pass it to a new cookie using the following ... Thanks for suggesting SPUtility.js!

enter image description here

Now for the next step!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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