Can custom JS emulate SP "Reverse Lookup"?

Forums Dynamic Forms for SharePoint Can custom JS emulate SP "Reverse Lookup"?

This topic contains 6 replies, has 2 voices, and was last updated by  Alexander Bautz 1 day ago.

  • Author
    Posts
  • #26427

    Mike
    Participant

    Alexander,

    The OOTB Reverse Lookup in SharePoint is very useful for several use cases. Using DFFS cascading dropdowns means that capability is lost. Is there any way to emulate reverse lookup when using DFFS cascading dropdowns with large lists (over 5K), perhaps with some custom JavaScript? Something that works with a single choice or multiple choice?

    Thanks for your help,
    Mike

    • This topic was modified 3 weeks, 4 days ago by  Mike.
  • #26457

    Alexander Bautz
    Keymaster

    Yes, this is possible. If you can tell me which field in “list A” to use when searching for a match in “list B” I can create a little code snippet you can use as a starting point.

    Alexander

  • #26634

    Mike
    Participant

    I have described the DFFS reverse lookup use cases in the attached diagram so the requirements and use cases could be as clear as possible. Let me know if any questions. Thanks for your help.

    Mike

  • #26667

    Alexander Bautz
    Keymaster

    Thanks for the specifications. I’ll see if I can get this looked at during the weekend.

    Alexander

  • #26704

    Alexander Bautz
    Keymaster

    Look here for a possible solution: https://spjsblog.com/2019/08/16/dffs-reverse-lookup/

    Alexander

  • #26784

    Mike
    Participant

    Picking up the conversation here from the blog post so I can add attachments and formatted code.

    The script is returning what is shown in the attachment regardless of the parameters entered in the function call.

    Setup
    Referring back to the diagram: The Ticket list is my Child list and the Part Number list is my Parent list. The Child list lookup field to the Parent (Part Number) list is “DFFS_PN_Lookup” and is configured in the DFFS Cascading dropdowns Edit panel for this list. I then assign the same Part Number to various Tickets via this lookup field.

    I have configured the Part Number Parent list DFFS Display form with the Custom JS, CSS, and a Tab ID “ReverseLookup.” I have configured a Rule that calls the function (init_getRelatedItems) when the Display form tab is loaded.

    When I click the Parent list Reverse Lookup tab I get no matches, even though there should be several.

    • This reply was modified 2 days, 18 hours ago by  Mike. Reason: added attachment
    • #26793

      Alexander Bautz
      Keymaster

      Hi,
      I misunderstood and thought your DFFS_PN_Lookup was an actual lookup column. I’ll look at this later tonight and write a new function that can be used with text field connections instead of a lookup column connection.

      Alexander

You must be logged in to reply to this topic.