Home › Forums › Classic DFFS › Rule to set lookup field to field that is empty
Tagged: lookup rule
- This topic has 4 replies, 2 voices, and was last updated 7 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
August 8, 2017 at 15:02 #17661
Hello all,
In a list I have implemneted a dropdown functionality with a filter. And that works fine, unless you do not want to make the field empty.
This is how I did this:
In a list i have a text field named OpposingPartyLookupWork
For this field, in the Custom JS tab, I implemented SPJS.lookup. So that a dropdownlist is shown based on items in another list and I implemented a filter on active entries.spjs.lookup.init({
“fieldToConvertToDropdown”:[“OpposingPartyLookupWork”],
“listName”:”{907d734b-f46b-4c0d-a9ea-a7eff0eb314c}”, //OpposingPartiesTest
“listBaseUrl”:”/Sites/010008/”,
“optTextFieldInternalName”:”Title”,
“sortFieldName”:”Title”,
“filterObj”:{
“on”:true,
“folder”:””, // Leave empty to search in all folders
“CAML”:null, // If used, the rest of the filterObj settings are disregarded
“fin”:”ActiveYN”,
“isLookup”:false,
“operator”:”Eq”,
“filterVal”:”Yes”
},
“dropDownDefaultvalue”:”Geen”,
“addYouOwnValue”:{
“on”:false,
“linkText”:”Write your own value”
},
“addToExternalList”:{
“on”:false,
“customFunction”:null, // Function name as a string. If a function name is supplied, this will be used in stead of the default function. The function will be passed the argument object as a parameter.
“linkText”:”Add new item”,
“saveNewItemText”:”Save new item”
},
“debug”:false
});This works fine.
Now with a rule I copy the selected value in OpposingPartyLookupWork to another field named OpposingPartyTestLookup in the list. This field is actually a SharePoint lookup field to that same list where the dropdown text field OpposingPartyLookupWork got it’s entries from.
So in this rule I assign (in the “Set field value” section) to field OpposingPartyTestLookup the value of OpposingPartyLookupWork. The rule triggers on OpposingPartyLookupWork field change.
This works fine as well. Now i have implemented a lookup functionality for a lookup field with a filter in the values shown in the dropdown menu (only active entries can be selected). Great.
But to my disappointment this does not work if I want choose an empty value “Geen” in my case. For some reason “Set field value” does not work with empty values. Is there a way to work around this?
Thanks! -
August 8, 2017 at 15:16 #17663
DFFS frontend 4.4.2.5 Backend v4.4.2.5|CSS version: 4.18 / 4.18|spjs-utility version: 1.27
-
August 9, 2017 at 23:22 #17678
I’m not 100% sure I understand. Are you selecting a “empty” value in the dropdown, and have a rule triggering on this change that sets the lookup field to the same value (empty string)?
Are you using the “Set field value” section and leaving the “Value” field empty?
If this is correct, and it doesn’t work, I’ll look into it and see if I can fix it or make a custom function workaround.
PS: If the lookup column is required you cannot clear the value – are you able to do it manually in the lookup column?
Alexander
-
August 10, 2017 at 08:33 #17693
Yes, I’m selecting the empty value, (in my case in the dropdown “Geen”, see the spjs.lookup.init parameter). This results in an empty string for the field OpposingPartyLookupWork, but the lookup field OpposingPartyTestLookup remains unchanged (only if the field OpposingPartyLookupWork is empty, otherwise it works fine). And yes, I am using the “Set field value” section and setting the field to the value of {OpposingPartyLookupWork} . And the lookup column is not a required field. Manually I am able to make this field empty.
-
August 14, 2017 at 19:32 #17734
Hi,
I was finally able to test this, and it’s working in my setup now, but I might have fixed this issue in an updated version of spjs-utility.js.Please try updating DFFS to the latest version, or try changing the SPJS-utlity.js version to the one found in the plugins folder in the latest DFFS package.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.