Refresh cascade when a new item is added

Forums Cascading dropdowns Refresh cascade when a new item is added

This topic contains 7 replies, has 3 voices, and was last updated by  Alexander Bautz 1 month, 3 weeks ago.

  • Author
    Posts
  • #21976

    chgrnet
    Participant

    I am using a vLookup to add a new item to a cascade list and would like to get the cascade field to update when the new value is added. The vlookup works perfectly to add the new item, but how do I get the cascade field to update and see the new value?

  • #21999

    Alexander Bautz
    Keymaster

    There is not built in method for refreshing it automatically, but you can use the callback from vLookup. To do this, you must use this approach to initiate it in Custom JS and not use the dedicated Cascading dropdown tab in DFFS:
    http://spjsblog.com/dffs/dffs-plugins/spjs-cascading-dropdowns/#Invoke_the_function_manually

    Here is a quick mock-up (not tested so might contain typos):

    function initMyCasc(){
        spjs.casc.init({
            ...
            ...
        });
    }
    // Call the function initially
    initMyCasc();
    
    function vlookupChildAddedCallback(){
        spjs.casc.kill("FieldInternalName"); // use first field in thisListFields array
        initMyCasc();
    }

    Let me know how this works out.

    Alexander

  • #22064

    Mike
    Participant

    I’d like to have this same functionality with DFFS Cascading Dropdowns, i.e., the cascade field AND associated cascade fields refresh when the lookup list item is updated.

  • #22105

    Alexander Bautz
    Keymaster

    Hi Mike,
    I don’t understand exactly what you mean – can you clarify it a bit more?

    Alexander

  • #22127

    Mike
    Participant

    No problem. Here’s an expanded description.

    I have two lists related by Cascading dropdowns v3.7.22 in DFFS. There is a field in the lookup list from which I select a value using a pulldown in the current list. Since these are all text fields, and do not use the SharePoint OOTB lookup capability, there is no active link between the two lists. This means that when the value I selected from the lookup list is changed in the lookup list it is not automatically changed in the current list. I would need to de-select and re-select the lookup value in the current list pulldown to refresh it.

    I would like the value selected from the dropdown in the current list to change to the updated value, i.e., automatically reflect changes in the lookup list (basically operate as the OOTB SharePoint lookup functionality)

    Thanks for your help.

  • #22179

    Alexander Bautz
    Keymaster

    I see, unfortunately this is not possible to do because there is (as you already mentioned) no link between the text values in your current list that identifies the item in the lookup list. This means the when the lookup list is changed, there is no way to identify the elements in the other list to update their value.

    You might be able to use SPServices – https://sympmarc.github.io/SPServices/value-added/SPCascadeDropdowns.html

    Alexander

  • #22197

    Mike
    Participant

    My lookup list exceeds the SharePoint Threshold Limit of 15,000 records (in-house limit) which made your DFFS Cascading dropdown REST API solution so valuable as it works with almost any amount (46,000 records at this point!).

    Unfortunately, SPServices (which we used previously) is constrained by the same Threshold Limit. I thought you might have a custom Javascript solution similar to the vlookup solution you posted above.

    Mike

  • #22205

    Alexander Bautz
    Keymaster

    I see. Unfortunately I don’t have a good solution to this. I guess it would be possible to write the ID of the list item selected by the cascading dropdown to a hidden text field, but you would need a workflow to trigger on change of the lookup list item to identify all the items linking to it and loop over then to update the value. I don’t think this will be a very elegant solution, but it might work.

    Alexander

You must be logged in to reply to this topic.