vLookup Child Redirect to parent edit form

Home Forums vLooup for SharePoint vLookup Child Redirect to parent edit form

Viewing 4 reply threads
  • Author
    Posts
    • #33820
      Jonathan Stamper
      Participant

        I have a main request list and 2 vlookup fields (1 list; 1 doc lib). I want to give the user the ability to Edit their results either within the main request list (via vLookup) OR directly in one of the vLookup lists (not ever navigating to the request list) and when they hit save it redirects them to their parent in Edit form.

        When I use spjs.dffs.redirect it works if updating directly from the child lists. But if I update via the main request list it still triggers the redirect which I don’t want.

        Is there anyway to toggle the redirect logic on save, dependent on how the user is accessing the data – directly from the child list vs from the vLookup edit?

      • #33829
        Alexander Bautz
        Keymaster

          Yes, you will find an URL query string parameter “vLookupEdit=1” in the URL when you edit from the vLookup edit button.

          You can use code like this in your vLookup EditForm to set the redirect based on this parameter:

          if(GetUrlKeyValue("vLookupEdit") === "1"){
            // Is from vLookup edit button - set the appropriate redirect here
          }else{
            // Not from vLookup button - set the appropriate redirect here
          }

          Alexander

        • #33834
          Jonathan Stamper
          Participant

            Ah that’s right! That works. Much appreciated.

          • #33836
            Jonathan Stamper
            Participant

              One more question, if the main request form is in dialog, is there a way to redirect back to the main request view page, open the form in dialog and then incorporate some sort of alert to prevent the user from clicking cancel?

              That may be too far fetched but the goal is to try and maintain as much of the workflow emailing within the main request form.

              • #33844
                Alexander Bautz
                Keymaster

                  Sorry, but there is no easy way to link to a view and then have a form open in a dialog. To do that you would have to use custom code in the view and then pass variables in the url that this custom code would pick up and then open a dialog.

                  While this is possible, it is a lot of work to set up so I really don’t recommend it.

                  Alexander

                • #33869
                  Jonathan Stamper
                  Participant

                    Yeah I figured it was probably not worth the effort. Thanks for the input and info.

                    Apologies, I’m hoping this is my last question, and I may be overlooking/overthinking it but is there a way to pass field values on the parent form (edit form) to a new/edit child form? Reason being that I have a child list containing an autocomplete that needs to filter from the autogenerated ID of the parent.

                  • #33881
                    Alexander Bautz
                    Keymaster

                      Yes, you configure this in the vLookup config under Add new item > Prefill values in child.

                      Alexander

                    • #33883
                      Jonathan Stamper
                      Participant

                        Ok, so I’m doing that but for some reason when it hits the autocomplete logic on the child form it doesn’t recognize the getFieldValue(“Field I’m Passing from Parent”); within the rest filter. I did a console.log and it shows “”, but after load it appears to show.

                        Maybe I need to wait for the form to load before passing?

                      • #33885
                        Jonathan Stamper
                        Participant

                          Yep! That was it. It needed to load first to catch the prefill then it went through the autocomplete successfully.

                          Awesome! Thank you so much!

                        • #33887
                          Jonathan Stamper
                          Participant

                            Ah wait, the GetUrlKeyValue(“vLookupEdit”); returns “” on new form. Is there a different key value for new form?

                        • #33891
                          Alexander Bautz
                          Keymaster

                            I don’t have an attribute like vLookupEdit and vLookupView for NewForm, but you can use one of other vLookup parameters like “parentListGuid” or “parentForm”.

                            Just a tip: if you open the form in a dialog you can right click and select “View frame source” (in Chrome) to open a new tab where you can see the URL of the dialog and identify all parameters.

                            Alexander

                            • #33893
                              Jonathan Stamper
                              Participant

                                Yes!!! Debugging made me realize how that function works so I’m using “parentListGuid” for the New Form check and vLookup. I just need to rework my conditionals to fix it.

                                Thank you for all the help! I really appreciate it.

                              • #33902
                                Alexander Bautz
                                Keymaster

                                  I’m glad you figured it out – have a nice weekend!

                                  Alexander

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