Home › Forums › vLooup for SharePoint › vLookup Child Redirect to parent edit form
- This topic has 12 replies, 2 voices, and was last updated 3 years, 6 months ago by Alexander Bautz.
-
AuthorPosts
-
-
June 21, 2021 at 23:49 #33820
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?
- This topic was modified 3 years, 6 months ago by Jonathan Stamper.
-
June 22, 2021 at 15:38 #33829
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
-
June 23, 2021 at 13:06 #33834
Ah that’s right! That works. Much appreciated.
-
June 23, 2021 at 13:29 #33836
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.
-
June 24, 2021 at 10:49 #33844
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
-
June 24, 2021 at 23:49 #33869
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.
-
June 25, 2021 at 13:19 #33881
Yes, you configure this in the vLookup config under Add new item > Prefill values in child.
Alexander
-
June 25, 2021 at 14:32 #33883
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?
-
June 25, 2021 at 14:45 #33885
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!
-
June 25, 2021 at 15:05 #33887
Ah wait, the GetUrlKeyValue(“vLookupEdit”); returns “” on new form. Is there a different key value for new form?
-
-
June 25, 2021 at 16:25 #33891
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
-
June 25, 2021 at 16:52 #33893
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.
- This reply was modified 3 years, 6 months ago by Jonathan Stamper.
-
June 25, 2021 at 18:35 #33902
I’m glad you figured it out – have a nice weekend!
Alexander
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.