- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2020 05:01 PM
Hello,
I have following Run script in Workflow which doesn't execute properly. I have confirmed that the scratchpad variable is assigned to sysid2 variable properly, but GlideRecord query fails and doesn't update the record.
Now the same code works just fine on script background. Not sure what is going on. Where can I look for possible issues?
Please advise.
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2020 05:43 PM
Can you try with this.
workflow.info("Scratchpad Value is = " + workflow.scratchpad.sysId.toString());
var sysid2 = workflow.scratchpad.sysId.toString();
Observe these logs in Workflow ==> Executing Activities whether it is able to display the above log.
Example
Please mark it as correct answer if it helps.
Thanks,
Narsing

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2020 06:23 PM
Its a weird issue as I observe especially with a sysid when you store it in a scratchpad. toString() will make sure it takes properly.
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2020 06:33 PM
Narsing,
It again started showing the same issue. For some reason it worked one time and then now it is not going in the if(rec.next()) statement. Most probably it's not able to find the record.
Any other suggestion?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2020 06:41 PM
Hi,
Can you add this script into your previous activity if possible so that you really don't need to depend on the scratchpad value.
Or
Can you create a new workflow and add all the activities.
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2020 04:31 PM
hi Narsing,
I created brand new WF with everything, but issue still persists. The thing is I have 2 such workflows. 1) For Server and 2) For NW devices. The one for Server works fine, but for NW devices doesn't.
1)I am using cmdb_ci_server as base table in WF for Server (Works Ok)
2) I am using cmdb_ci_netgear as base table in WF for Network devices (This one has issue) I also tried cmdb_ci_hardware as base table in WF, but no luck
The way I am executing is as below.
1) Pass on CI name and sysid from Scheduled job to WF as below.
var w = new Workflow();
var WFId= w.getWorkflowFromName('NWDevice_Decom');
w.startFlow(WFId,null,'update',{u_devicename:'lcy3rc1',u_sysid:'d1560049db46bec4386879531f961969'});
2) These variable I save in scratchpad and pass it to Powershell activity, which executes Ping Test using MID server script file. If CI pings ok then fine, if not then set CI status to Retired.
Again both WF used to work just fine all these time, just recently one of them broke.
Please advise.
Thanks.