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 03:18 PM
Can you try changing table to some OOB table like incident and run the same workflow? I just tried to print current.sys_id and it printed correctly.
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-25-2017 12:21 AM
also HR related tables have some funky restrictions..specially if it is scopped one(istanbul+). make sure user has HR related roles. atlease hr core basic role
(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 04:04 PM
Hi Kurt,
Whether it be global scope or our custom scope current is part of the scope. For e.g. whenever we create a custom application in that new scope current is a property of that scope. So in your case current should be having the gliderecord object and current.sys_id the sys id value. If that is not coming through check the properties of Workflow and if you still dont get it I believe it needs a deeper look from a HI professional.
I have verified that current gives the glideRecord Object in a custom app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2017 09:34 AM
Just to close the thread on this - it had something to do with the workflow. I rebuilt a scaled-down version of it and the "current" pass worked out just fine. The original workflow has a lot of branches and joins and I suspect this had something to do with it. I'm just going to try and find a way to make the workflow work how we want it without all of that. Thanks everyone for your help!