I am opening a from using SP.UI.ModalDialog.showModalDialog method.
I need to link the item that is created to an item in another list when the form is saved.
I found the following code in other forum posts about setting the RedirectUrl to null, making the api call and than resetting the RedirectUrl. This isn't working for me when the form is opened in the dialog. How can I get this to work?
I added a custom button but the form still closes when I save the form. I need to save the form and get the item id. What is causing the form to close after saving?
fd.save() closes the dialog or redirects to a previous page.
If you need item ID, the only option for you is to open the dialog after the new item is saved. You can try using the dialogReturnValueCallback as described in this post:
Also, may I know why are you using dialog instead of the panel? Panels are more native to modern UI.