Rule with Lookup field

Forums Dynamic Forms for SharePoint Rule with Lookup field

Viewing 10 reply threads
  • Author
    Posts
    • #27726
      Leonid
      Participant

      I have a multiple lookup field, type of SPFieldLookupMulti.
      The fields isnt listed in Rules. Is that a limitation or Im missing something?

    • #27728
      Leonid
      Participant

      adding to above: the SPFieldLookupMulti field is not exposed in
      `spjs.dffs.beforeProperties

    • #27733
      Alexander Bautz
      Keymaster

      Hi,
      Unfortunately a multi lookup column cannot be used as a trigger. You can use a trigger of type “Custom javascript function” and write your custom code in a function in Custom JS – returning true or false to use it on form load.

      If you need to have it triggering on change you must write some custom js to sense it changing and then use a custom function to do your magic.

      I tested now and my multilookup column does show in spjs.dffs.beforeProperties. Maybe there is some difference with older versions of SharePoint – which version are you on?

      Alexander

    • #27741
      Leonid
      Participant

      Alex,
      This is SP Online. I checked spjs.dffs.beforeProperties in dffs_PreSaveAction and value is empty. What am I missing?

      Attachments:
    • #27745
      Alexander Bautz
      Keymaster

      Is this in EditForm? – the beforeproperties only reflect the value the field had last time it was saved and not the previous value when editing in the same session.

      Alexander

    • #27751
      Leonid
      Participant

      Its a New form. Other properties correctly show the fields values.
      By “Custom javascript function” you suggect jQuery instead of getFieldValue?

    • #27754
      Alexander Bautz
      Keymaster

      In NewForm, the object will contain the default values that the form is loaded with, but in general it is supposed used to keep track of the values that the form had when it loaded, and not the changes made withing the current session.

      If you can explain what you are trying to do I’ll see if I can help you with a code snippet.

      Alexander

    • #27815
      Leonid
      Participant

      Alex, other fields show defined values when checked in dffs_PreSaveAction. Only multi- lookup is empty. Single- lookup field shows correct value as well. Feels like a bug.
      I hope theres a way to make a Rule work with multi- lookup field. If not, I need to check multi- lookup values before submitting the form and populate a hidden field based on selection.

    • #27838
      Alexander Bautz
      Keymaster

      I’m still not 100% sure I follow. If you are in NewForm you cannot really have a “beforeproperty” of any fields other than the ones that have a default value set in the list settings for that field (and a required single lookup field has the first item selected by default when it is set to required in the list settings).

      What is it you try to do exactly? – if you give me some more details I’m sure I can find a solution for you.

      Alexander

    • #27989
      Leonid
      Participant

      Alex,

      The NEW form has a lookup field with multiple values. I need to read its value BEFORE form is submitted. Please suggest approach. So far all the spjs.dffs objects I looked have empty value:
      getFieldValue()
      afterProperties
      beforeProperties

    • #28004
      Alexander Bautz
      Keymaster

      You can use a snippet like this:

      var arr = [];
      jQuery("#dffs_MultiLookup select:last option").each(function(i,o){
        arr.push(jQuery(o).text());
      });
      // arr is an array of all the text values selected in the multilookup

      Replace MultiLookup with your field name.

      Alexander

Viewing 10 reply threads
  • You must be logged in to reply to this topic.