Update list item fields with SPDisplayRelatedInfo?

May 18, 2011 at 7:49 PM

Trying to work out a method of updating fields in a list item based on a lookup value.  Could do it after create/update with workflow but the user needs to see the related info based on the lookup to validate before save. Let's say that my list has:

  • ProjectID (lookup from Projects list)
  • ProjectName (autofill based on ProjectID lookup)
  • ProjectStatus (autofill based on ProjectID lookup)
  • ProjectEndDate (autofill based on ProjectID lookup)
  • SponsorTolerance (entered by user)
  • Comments (entered by user)

As you can see, I'm hoping to autofill the related info fields as I'd do in InfoPath but I need the actual values stored in this list for sorting and analysis instead of just displayed on newform, editform and dispform. Thoughts? 




May 18, 2011 at 7:54 PM

Sure. You could use SPDisplayRelatedInfo if you want the user to see the information which they have chosen. If you want to use this approach, then you'd grab the values which are populated in the page. See the docs for some hints on how to select them.

If not, you can build this using SPServices core Web Services calls. The latter would look something like: On change of the ProjectID, call GetListItems with the value to get back the matching item. Populate the columns in the current form with the values from the returned XML.