Home › Forums › General discussion › Making lookup columns available to add to forms
- This topic has 6 replies, 2 voices, and was last updated 8 years, 2 months ago by Alexander Bautz.
-
AuthorPosts
-
-
September 15, 2016 at 20:29 #13169
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! -
September 18, 2016 at 09:30 #13195
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
-
September 20, 2016 at 21:08 #13291
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! -
September 22, 2016 at 20:35 #13374
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!
-
September 22, 2016 at 21:32 #13376
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
-
September 27, 2016 at 17:22 #13446
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.
-
September 29, 2016 at 18:48 #13479
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.