Frustrating issue

Working on a button on the edit form of a plumsail helpdesk sharepoint online. We want to pass in the field Ticket ID list item as a URL parameter. What we have in the click part of the button is window.location.href = 'https//www.someurl.com?TicketID=' + fd.field('TicketID').value ;

It doesn't work. When the button is clicked nothing happens. When I take the field off the end it works.

What am I missing?

Hello @IT.Joe,

What do you mean with this? Could you please provide more details or the screenshot.

Is that the complete code you are using for the button?

window.location.href = 'https//www.someurl.com?TicketID=' + fd.field('TicketID').value ; (This doesn't work)

window.location.href = 'https//www.someurl.com'; (This works)

TicketID is a sharepoiunt list item in the Plumsail helpdesk.

I didn't put any JavaScript in the edit form because there is a bunch in there from the Plumsail helpdesk and when we attempeted ot put some in it broke the edit form so the code is just in the "Click" portion of the button.

@IT.Joe,

Are you getting any errors in the browser console(F12) when using this code:

window.location.href = 'https//www.someurl.com?TicketID=' + fd.field('TicketID').value

Please share the screenshot.

There is no screenshot because there is no error...the button clicks and nothing happens at all. If the + fd.field('TicketID').value is taken out it works.

As a test I put the button on the Display Form with window.location.href = 'https//www.someurl.com?TicketID=' + fd.field('TicketID').value; in the click and it worked...but does not work on the Edit Form.

Upon further review the issue is the button was placed in the Add a comment section of the edit form and something was causing it to not work from there. I moved it outside that section of the form and it worked.

What ended up after testing scenarios is the field had to be present on the form to get the value passed in so I added it and hid it in JavaScript. Is there a way to get the value of a list item without doing this?

Hello @IT.Joe,

You can get the current SharePoint list item ID using this code:

fd.itemId