- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 04:57 AM
Hi,
what am I missing in this flow? The workflow is not triggering the related SCTASK because of the "cannot convert null to an object" error
see below -
Regards
CarolMa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 05:44 AM
@CarolMa6 Use below scripts. Don't use getDisplayValue() for date type of field. It is giving undefined value . I tried below script in PDI and it worked.
var date = fd_data._1__get_catalog_variables.termination_date;
var gdt = new GlideDateTime(date + " 00:00:00");
gdt.addSeconds(54000);
return gdt;
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2025 04:41 AM
This was helpful @OlaN not sure what I missed here
The script below works well but for some reason it clears the RITM due date field, what did I miss? Help
var date = fd_data.trigger_get_catalog_variables.termination_date.getValue();
var gdt;
if (!date) {
gdt = new GlideDateTime();
} else
gdt = new GlideDateTime(date + " 00:00:00");
}
gdt.addSeconds(54000);
return gdt.getValue();
Regards
CarolMa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2025 11:16 PM
Hello Carol,
Understand the error that should give you reference how to solve your problem.
It say cannot convert null to object. So it could not get the field termination_date at runtime.
Your script:
// Set Due date to the selected Termination date.
var date = fd_data.trigger.request_item.variables.termination_date.getDisplayValue();
var gdt = new GlideDateTime(date + " 00:00:00"); 3
gdt.addSeconds (54000);
return gdt;
Thus, this returns empty object it clears the due date too.
Chances are your flow wasnt saved properly, or the flow is corrupted. Thus, you need clear the logs, reload and save again to test the same.
Chances also are fd_data.trigger.request_item.variables.termination_date.getDisplayValue(); doesnt directly support the api getdisplayvalue() . Not sure how much testing has already been done on it.
Thus, try to get gs.info(fd_data.trigger.request_item.variables.termination_date) first and then gs.info (fd_data.trigger.request_item.variables.termination_date.getDisplayValue()) in another line and observe the logs. If both are correct then only it would work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2025 05:10 AM
Hi,
Sorry for the slow response.
I've reviewed your updated code, and it looks fine, so at this point I would add a info log statement in the script to see what the value of "gdt.getValue()" actually contains, and if it's empty or something which would have the due date to be cleared.
Then work your way backwards from there to see why the date is empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 05:44 AM
@CarolMa6 Use below scripts. Don't use getDisplayValue() for date type of field. It is giving undefined value . I tried below script in PDI and it worked.
var date = fd_data._1__get_catalog_variables.termination_date;
var gdt = new GlideDateTime(date + " 00:00:00");
gdt.addSeconds(54000);
return gdt;
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2025 10:31 AM
@CarolMa6 Did you try my solution ?