Blank current object when passing from Workflow to Script Include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 12:06 PM
I have a script include that uses a GlideRecord object as an input. The Script Include works as it should when I fetch a record and call it from background scripts. For example:
var caseRecord = new GlideRecord('table');
caseRecord.get([sys id of a record i choose]);
new x_dnf_application.class()._method(caseRecord);
The above works perfectly.
When I try and call this script include and pass it the "current" object from a workflow, different story.
This is the code inside the "Run Script" activity
new x_dnf_application.class()._method(current);
I have some gs.info writes in the Script Include and the "current" argument is empty when the workflow is executing it. How could this be? If I hard-code a string as the argument from the workflow, the string prints out in log successfully, so its an issue with "current", I just don't know what the issue is.
I've also tried sending current.sys_id to see if there's just a problem passing an object versus a single value. Still passed an empty value.
What am I missing?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 12:32 PM
is your workflow in same scope as script include?
make sure..script include has accessible to "all application" scope set.
(please mark helpful/like/correct if it helps)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 01:57 PM
Thanks! They are in different scopes - but the Script Include is available to all scopes. I know its going into the Script since its printing my gs.log entries, but the current object is just empty. I also just copied the Script Include over to the same scope as the Workflow and updated the api call, but same result. Any other ideas as to what I could be missing? I'm open to anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 02:51 PM
Did you try printing the current.sys_id in run script activity?
Which table your workflow is on?
Thanks.
PS: Hit like, Helpful, Correct, if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2017 03:02 PM