Flow designer showing Error?

siva44
Tera Contributor

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

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@siva44 

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

 

AnkurBawiskar_2-1737450926413.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Mark Manders
Mega Patron

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

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

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

Ankur Bawiskar
Tera Patron
Tera Patron

@siva44 

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

AnkurBawiskar_0-1737450807651.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader