Redirect to another item in list without saving

Good day
When user open new form,then press button,which have a caml to find some existing items in this list. and if items exists i want to redirect to this item in edit form. and only to close this new one without save. if no - to allow to save the new form.
Code in the button

var camlf = "ID_x0020_Client eq '" + fd.field('ID_x0020_Client').value +"'";
sp.web.lists.getByTitle("Clienti Proiecte Salariale").items.select('ID').filter(camlf).get().then(function(items) {
alert(items.length)
    if (items.length==0) {
	//alert(items.length)
        //este client nou si trebuie de facut save
        return fd.save();
    } else {
		alert('else'+items.length)
		
		var itemId = items[0].ID;
        result.RedirectUrl =
            "http://portal/sites/help/SitePages/PlumsailForms/Cerere%20de%20suport/Element/acc1aafa-5e8d-404b-b03b-ec7e319b10e9/EditForm.aspx?item=" + itemId + "&ct=0x01003658688C981CC844AE0ACFC69C180822&rf=%2Fsites%2Fhelp%2FLists%2FCerere%20de%20suport&source=http%3A%2F%2Fintranet%2Fsites%2Fhelp%2FLists%2FCerere%2520de%2520suport%2FAllItems.aspx%3Fweb%3D1";
               

But at the end need save.. and in this case have an error with result undifined

Dear @ixxxl,
Are you opening form in a panel or not? If not in a panel, you can just use window.location.href and set it to desired URL and it will redirect user to another page, for example, the form that you want.

Like this:

window.location.href = 'https://www.plumsail.com/'
1 Like

@Nikita_Kurguzov
yes,it's not a panel. It works thank you !