Viewing the "Values" field of sys_hub_action_instance_v2

Biz-JoshM
Tera Contributor

We've done some automation where we are evaluating Flows, where we perform an action if any "action" and "inputs" are present.

 

To summarize we used to do this with a mixture of querying the "sys_hub_action_instance" and "sys_variable_value" tables.

 

However, when looking at "sys_hub_action_instance_v2" there is only one field, and it is the "Values" field, which contains what seems to be an encrypted string.

 

What is the best way to programmatically see what actions and values are assigned to a Flow / Subflow taking into consideration Xanadu seems to have introduced a V2 action that uses a different methodology?

1 ACCEPTED SOLUTION

-_MS_-
Tera Expert

Found the answer in the DiffAudit script include.

 

 

 

_decompress: function(value) {
        var encoded = value.substring(this.compressed_header.length, value.length);
        var cs = GlideStringUtil.base64DecodeAsBytes(encoded);
        return String(GlideCompressionUtil.expandToString(cs));
    },

 

View solution in original post

11 REPLIES 11

You definitely don't want this line

var encoded = value.substring(this.compressed_header.length, value.length);

and the rest can be condensed into a single line like this

String(GlideCompressionUtil.expandToString(GlideStringUtil.base64DecodeAsBytes(compressedValue)));

or alternatively like this

String(GlideCompressionUtil.expandToString(GlideStringUtil.base64DecodeAsBytes(gr.values)));

where gr is the sys_hub_action_instance_v2 record you want to decode.

James Fricker
Tera Guru

For anyone that would like to decode/decompress client-side you can put this into a browser bookmarklet. Click on it when you have the sys_hub_action_instance_v2 record open. This also works as a custom SN Utils slash command. (btw the JSON viewer in Firefox is 10x better than the one in Chrome). To make this code a bookmarklet (or an SN Utils command) you need to prefix it with "javascript" and ":"
Which I can not type in the box below as this editor messes with the combination of "javascript" and ":" just like this "javascript:"
So use ":" and not ":"

(async () => window.open(URL.createObjectURL(new Blob([await new Response(new Blob([Uint8Array.from(atob((window.gsft_main ? gsft_main.g_form : g_form).getValue("values")), c => c.charCodeAt(0)).buffer]).stream().pipeThrough(new DecompressionStream("gzip"))).blob()], {type:"application/json"}))))();