Error: com.glide.script.fencing.ScopedGlideRecord cannot be cast to com.glide.script.fencing.ScopedGlideElement

ragavendranr
Tera Contributor

When i try to update a record from flow designer, am getting below error.

Error: com.glide.script.fencing.ScopedGlideRecord cannot be cast to com.glide.script.fencing.ScopedGlideElement

I am using flow designer in scoped app, and also updating the record which is in same scoped app

10 REPLIES 10

Hello @Community Alums , 

For my case, my action was taking a parameter with a reference type, when it's used in the script I got the error mentioned but when I changed the type of the parameter to a string (which will contain the sys id of my record) it worked fine. 

Community Alums
Not applicable

My action is taking parameter of type string.

Fred Jean
Tera Expert

Hello I had the same error on a Script step of scoped flow Action.

Here's an extract of the script that raised this error :

        var taskVarGr = new GlideRecord("sc_item_variables_task");
        taskVarGr.initialize();
        taskVarGr.task= inputs.ctask;

Here the ctask parameter type is Reference (to table Catalog task)

To resolve this I had to change the last line to explicitly use the sys_id :

        taskVarGr.task= inputs.ctask.sys_id;

I hope this can help, I think this is a difference between the scoped and global version of the GlideRecord API.

Community Alums
Not applicable

Thanks, it helped.

Girish Galla
Tera Contributor

Review the table access properties, such as permissions for reading, writing, and updating. If the table is limited by a specific scope, then the script include utilized in the flow must be set to global.