- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 02:51 PM
Hi
How can I auto populate the actual end date field on the change form upon selecting the cancel change button
In other words, I did like for that to auto populate with current date when I select cancel change to cancel the change request
And I want to make this button only visible in the implement state and only visible to change implementers
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 07:43 PM
This worked for me
current.work_end = gs.nowDateTime();
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 12:52 AM - edited 09-26-2023 12:52 AM
Hello @Ponda ,
You can modify your Cancel Change UI action
in the condition field you can write as
current.state == -1 && gs.hasRole('you_change_implementer_role'); // your change implementer role here
// state -1 will represents Implement state
to set the actual end date, you can implement the below code in your UI action server-side script
var todayDate = new GlideDateTime();
current.work_end = todayDate; // work_end is the backend name of actual end date
Please mark my answer correct & helpful, if it helps you
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 06:54 AM
to set the actual end date, you can implement the below code in your UI action server-side script does now work, what am I doing wrong
Please see screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 07:13 AM
in line number 14, you need to give space between new and GlideDateTime()
it should be like
var todayDate = new GlideDateTime();
Please mark my answer correct & helpful, if it helps you
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 07:21 PM
I corrected that slight error but still not successful, looks like the code does nothing