2

I am trying to make a cross site lookup field. So for now I made javaScript file and overrided the JSLink parameter.

I want to made it clear for sharepoint and followed clientforms.debug.js practice.

In clientforms.debug.js they used updateControlValue method for update fieldValue.

So, I use this method for insert my own lookup object to field value. And main problem - updating field value such as the string 5233;#HelpMePlz.

Because after method updateControlValue, SharePoint does not save my own object.LookupValue (HelpMePlz),

SharePoint only save object.LookupId (5233).

I need someone who has already done something similar and can explain the subtleties of working with a client side rendering (JSLink) & lookup field.

1

If you are interested - it was necessary to set up the field, then values ​​began to persist.

UPDATE: That was i mean. This is cut of public partial class LookupFieldProperties : UserControl, IFieldEditor.

     public void OnSaveChange(SPField field, bool isNewField)
     {
        var lookUpField = (LookupField)field;

        if (lookUpField == null)
            return;

        lookUpField.WebProperty = WebPropertyEditor.Text;
        lookUpField.LookupViewId = ViewPropertyEditor.Text;

        if (lookUpField.LookupList != null)
            return;

        using (var web = SPContext.Current.Site.OpenWeb(WebPropertyEditor.Text, true))
        {
            var listId = web.GetList(SPUrlUtility.CombineUrl(web.ServerRelativeUrl,
                "/Lists/" + ListPropertyEditor.Text)).ID;
            lookUpField.LookupWebId = web.ID;
            lookUpField.LookupList = listId.ToString();
        }

        lookUpField.AllowMultipleValues = AllowMultipleValuesEditor.Checked;
        lookUpField.LookupField = FieldPropertyEditor.Text;
    }
  • When you say "setup" what do you mean more precisely? – Robert Lindgren May 14 '15 at 15:21
  • 1
    @RobertLindgren i update my answer. – DenRedSky May 15 '15 at 8:23

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.