Making lookup columns available to add to forms

Forums General discussion Making lookup columns available to add to forms

Viewing 6 reply threads
  • Author
    Posts
    • #13169
      Penny Kingston
      Participant

      Hi Alex,
      I have set up a lookup to an external data source with one key field and then pulled over about 15 other fields from the source. While those additional fields show up in list views, do you have any tips or tricks for me to be able to show those additional fields on my forms? right now, only that one key field is available to add to the forms.
      Thanks!

    • #13195
      Alexander Bautz
      Keymaster

      Hi,
      You should be able to add these additional columns in DispForm, but as in a standard SP form, then are not available in NewForm or EditForm.

      You can find some examples on reading these “extra fields” using a scrip in the forum: https://spjsblog.com/forums/topic/show-notification-on-new-form-based-on-lookup-column/

      You could adapt this code to read the extra fields and write them to a single line of text column in the form, but keep in mind that these values will not be “live” – if you change the original lookup item, the changes will not be reflected in the forms you have pulled these values into.

      Alexander

    • #13291
      Penny Kingston
      Participant

      I have attempted to add them to my display form (they all appear to be in the list of fields to add to a tab), however after saving the configuration and viewing the display form, only the key field is on the form.
      Does that sound like the expected behavior?
      Thanks!

    • #13374
      Penny Kingston
      Participant

      I have been able to view the ECT lookup fields on my display and edit forms using the following code:

      
      
       function getItemAdditionalField() {var ids = $("span.getItemAdditionalField")
                                              .map(function() {return this.id;}).get();
                                                               var qRes = spjs.utility.getItemByID({
                                                               "listName": _spPageContextInfo.pageListId,
                                                               "id": spjs.dffs.data.thisItemID,
                                                               "viewFields": ids });
                                              $.each(qRes, function(key, value) {
                                                                                  $("span.getItemAdditionalField#" + key).html(value);
                                                                               });
      
                                          }
      <span class="getItemAdditionalField" id="FieldInternalName" />

      However, I have noticed some odd behavior regarding the ECT primary field which holds the lookup value. In the edit form, When I try to create a rule with the trigger “this ECT field changes” the field itself is not available in the list of fields. (The field type is SPFieldBusinessData).
      The other quirky thing is that the ECT primary field IS available to set as required using a rule, however even if I set it as required, the form will still save and close even if it is not populated. Are there different properties with ECT fields that could cause this behavior?

      Thanks!

    • #13376
      Alexander Bautz
      Keymaster

      Hi,
      The validation on multiselect taxonomy fields was actually fixed in v4.4.0 released a few days ago. Could you try this version and see if this fix might also work for your external content type column? – please note that this version has a new installer, but you should be able to just change the JS / CSS and plugins and not the “loader” or “installer” if you want to keep your current loading method – although I would recommend an update.

      I have no real experience with this column type, but unfortunately it is not currently available as a trigger field for a rule.

      You can however make a trigger manually – like this example for using an RTE field as a trigger: https://spjsblog.com/forums/topic/use-multiline-text-as-trigger-in-dffs/

      Alexander

    • #13446
      Penny Kingston
      Participant

      In your example for RTE fields, do you know what I would replace “#dffs_NameOfYourMultilineField div.ms-rtestate-write” with for an ECT field type?

      If I can’t use the ECT field to trigger a rule, do you know how I can at least get the value out of it? when I try “getFieldValue(“FieldInternalName”) I get an error that says “unknown field type:SPFieldBusinessData”

      Thanks for your help on this.

    • #13479
      Alexander Bautz
      Keymaster

      Hi,
      Unfortunately I don’t have any “external content types” available for testing so I need you to use the developer tools to “inspect” the field (right click > inspect) and send me a screenshot of the HTML code.

      If you could do that, I’ll see what I can do.

      Alexander

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