- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 12:46 AM
I have created flow for submit the catalog request for perticular schedule and i am using update record for request start date field same as opened field in request table using script nut i am getting the error like below
Error: Cannot read property "opened_at" from null,Detail: Cannot read property "opened_at" from null
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 01:15 AM
if you want to perform some addition then use this
Use the correct step which has "Submit Catalog Item Request"
Something like this will work for you
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 12:53 AM
You are getting the opened_at from the trigger, while your screenshot shows the trigger to be a schedule. Shouldn't you try to get the opened_at from step 1 instead of from the trigger?
And why not just set the start date to the opened date of the record itself instead of scripting to something else?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 01:02 AM
Hi @Mark Manders Actually I need to display start date is 24 hours Date after opened Date Thats why I need to script can u help me how to retrive the that opened date value through script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 01:17 AM
Create a flow variable and script that.
Use your step one field as base and add the 24 hours and return the outcome.
Then you can set the start date to that variable.
var start = '';
var openedAt = new GlideDateTime(dotwalk to your input of the field in step 1 -> fd.data.etc);
openedAt.addDaysLocalTime(1);
start = openedAt.getValue();
return start;
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2025 01:14 AM
you cannot use current object as your flow is not running on any record but it's triggered based on some schedule
2 ways to handle this
1) Use the current date/time as the time when REQ is submitted is the nowTime, with this approach there might be some 1/2 seconds difference. use this in the inline script
return new GlideDateTime();
OR
2) Use the output from "Submit Catalog Item Request"-> Requested Item-> Opened and use Data pill to set the date
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader