GetValuesForQuery - Setting Lookup vs. Choice Form FieldAnswered
I have an Action Button that I'm using to set a Form Field value to the "Title" value that I retrieve using the Query below. When performing the Test in the form, it successfully returns the value I was expecting (in the Test window). However, in the actual form, the Form Field value is not being set to the correct value.
Note that the Form Field that I'm trying to set is a drop-down (lookup) field that is linked to the same TARGET LIST that I'm doing the query on below. Also note that I did a very similar Action Button that set a Choice Form Field rather than a Lookup field and that one worked.
var x = [[@Web.GetValuesForQuery("TARGET LIST", "<Query><Where><Eq><FieldRef Name=\"Current_x0020_Release_x0020__x00\" ></FieldRef><Value Type=\"Text\">Current Release</Value></Eq></Where></Query>", "Title", "")]];
var varCurrentRelease = x;
Hi Marc Bernard,
to set a lookup in SharePoint, you need to set it via the ID of the lookup item. The Title (Text) does not work.
Please try it whether as "1" or "1;#", like this it should work to set the lookup.
Please sign in to leave a comment.