
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2025 04:12 PM
Change Management: Requirement is planned start and end dates can't be in the past. I'm enforcing this with onChange Client Scripts on the 'start_date' and 'end_date' fields and displaying a field error. To prevent saving with the bad dates, I also wrote an onSubmit script that stops the save. All of this works fine in the legacy view.
In Service Operations Workspace, the onSubmit script doesn't work because it uses a GlideAjax call, that's synchronous. If it's asynchronous the Submit completes before the answer comes back that it shouldn't save. So - I created a business rule, that essentially does the same thing as the onSubmit, and scripted it to only run on the SOW, so users in legacy don't get two error messages. Here's where it get weird: in the 'Schedule' card in the contextual side panel (accessed by clicking 'Schedule') if you set dates in the past and click the 'Schedule' button, it simply fails to save - no error. If you then click the 'edit' icon in the Schedule card, you get the error message. So, it appears the BR is running when a user clicks the 'Schedule' button on that card (it's aborting) but the timing is off, so it doesn't tell the user why it's not saving.
Any idea what's going on here?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2025 08:17 AM
Thank you very much for your help on this. I've fixed it!
In an OOB dev instance, the client script 'Form Submitted Failure' is linked to the data resource 'Form Controller' for the event 'Form Submit Completed'. In my customer's instance, it was not, so I linked it. Also, the Form message property of 'Form 1' in my customer's instance was populated by 'record_1>form>message' and OOB it's a Client State parameter called 'formMessages'. I created this client state parameter in the instance, and linked it to the Form Message property.
Only issue now is that there is a scroll bar in the 'Invalid value on Update' message for some reason, but that's just cosmetic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2025 10:59 PM - edited ‎02-10-2025 11:18 PM
Hi @Ron Legters ,
Could it be that the message is there upon clicking schedule but simply not shown? Are you adding a gs.addErrorMessage or something?
What if you write something to the log, do you see it appear immediately after the first click (that doesn't execute the save)?
edit: Wouldn't it be possible to add your client side validation in the Workspace client script block of the schedule UI Action and prevent submission from there?
Best regards,
Joni

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2025 12:01 PM
Thanks for the reply!
Here is the relevant part of the script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2025 10:30 PM
Hi @Ron Legters ,
The button can be found inside the page Schedule (Change Conflict Calendar Default).
It executes a client script onClick 'On schedule button click' and then runs a serverside save, maybe it's possible to add your date logic in there.
You'll also find that there is already a DatesErrorMessage Client stage param, you can probably use that one to add your error message to.
Another alternative might be looking at the form controller on the page. There is allready an event handler from 'Form submitted failure'. If you are setting the abortaction, maybe this is already getting captured in the workspace.
Best regards,
Joni

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2025 10:16 AM
Hi -
I've learned there's an baseline BR that checks if the planned end date is before the start date. It aborts the save and displays an error. In my customer's instance, this BR behaves exactly like mine, but in a new developer instance, it displays the error message in the Schedule card. It seems now I need to figure out how my customer broke this functionality. 🙂 (or how I did, earlier in this engagement)
I'll compare the things you mentioned in your reply in my base instance to my customer's. Hopefully something obvious turns up.