Is it possible when saving a new form in dialog to redirect to the edit form in dialog? I used to be able to do this with the Dialog.open command but somewhere along the line it started giving me a map error when trying to save and the page locks up, even if I hit close the page is locked. Using the result.RedirectUrl does not do anything and does not pass an error in the console log so I assume this is due to the dialog.
Here is my code:
> fd.spSaved(function(result) {
> //var listId = fd.spFormCtx.ListAttributes.Id;
> var itemId = result.Id;
> var scrWidth = Number(screen.width) * .75
> var scrHeight = Number(screen.height) * .75
> //replace "https://domain.sharepoint.com/sites/sitename/subsite" with path to your site
> //PageType=6 means Edit Form
> Dialog.open("https://hrmech.sharepoint.com/sites/pwa/SitePages/PlumsailForms/Drawing%20Log/Item/EditForm.aspx?item=" + itemId, { }, { }, { width: scrWidth, height: scrHeight });
> });
@Margo Hi Can you please help me - i have exactly the same case, I followed the steps -> new forms saves and -> redirects to edit in dialogue (perfect!) but after that, I cannot save or even close the Edit form in dialogue, I have this error on the dialogue screen:
Adding your code does not do anything good or bad. What is missing here? I copied the script above, just put my link.
Try adding the setTimeout() function to essure that the New form dialog is closed before opening the dialog with Edit form.
Update the control name and URL in the code before testing:
fd.control('SPDataTable1').$on('change', function(changeData) {
if (changeData.type === 'add') {
var newItemID = changeData.itemId;
setTimeout(function(){
Dialog.open('https://domain.sharepoint.com/sites/sitename/subsite/SitePages/PlumsailForms/ListName/ContentType/EditForm.aspx?item=' + newItemID,
{ args: 'something' }, function(hasSaved) {
if(hasSaved){
alert('Form in dialog has saved and closed.');
}
else{
alert('Dialog form was closed without saving!');
}
}, { width: 600, height: 600 });
}, 3000);
}
});
Sorry @Margo , still doing nothing, but i see that alerts are not coming as well so there must be something not right. Should I change { args: 'something' } to anything?
@Margo awesome! that helps! there is only one tiny thing - is it possible instead of dimensions for opening the form ({ width: 600, height: 600 }) specify to open it in full screen? Something like in the initial code ( var scrWidth = Number(screen.width) * .75) not *.75 -> 1 ?