Hello!
I'm hoping I can pick people's brains with this problem I'm having! ?
A little bit of background on the problem itself:
We have fairly recently added SuitePeople to our Netsuite environment, so employees now submit time-off requests through Netsuite. Once a time-off request is approved, that entry then shows on the employee's timesheet.
Since the entries are being generated automatically, we did not want employees to be able to modify these entries, nor be able to enter time-off entries into their timesheet manually. They are required to use the time-off request form to do so.
Because of this, we added a custom ClientScript that prevents users from editing existing time-off entries and/or create new time-off entries on their timesheets directly.
In summary:
If the time-off task is one of the task IDs in the array TaskID (which has been initialized earlier in the code) and the user is not an administrator, then cancel it and throw an error message to the user.
The code works as intended, however, here is where the problem comes in:
- When you create a new timesheet row under one that is considered time-off (vacation, sick day, etc), as identified by the TaskID array of task IDs -- everything is good, no alert popup.
- If you keep adding rows -- no issue, popup does not show up
- If you start removing lines -- no issue, popup does not show up
- If you remove the last line, right before the time-off one, the alert then pops up after you press remove. You then press ok on the alert, the row you wanted removed gets removed and everything is ok.
My assumption is that after you remove that last row, the system jumps to the previous row, which is now the last, and because of that, it triggers the conditions in my script which then pop up the error, even though you're not selecting that row manually, it just kinda jumps to it after you remove the line underneath.
I was hoping I could pick people's brains in case anyone can think of a way to not trigger this unless you actually click on that line? ?
Any suggestions are appreciated!!