Insert records into the Flow Settings table

Conan Lloyd1
Tera Contributor

I have been tasked with automating turning flow logging back on for flows.  The Washington release changed flow logging to only the first and last iteration of any loop logics.  We want to automate turning that back on and off.  I have the script to insert records, but there is a Document ID type field that I can't figure out how to populate.

 

Table: sys_flow_execution_setting

Field name: source
Field Label: Flow/SubFlow/Action

Field Type: Document ID

 

and here's the code I use:

var newEntry = new GlideRecord('sys_flow_execution_setting');
newEntry.initialize();
newEntry.source = '76011fb01bf82d10677dca20604bcbae';
newEntry.reporting = 'FULL';
newEntry.report_all_iterations = 'true';
newEntry.insert();

 

It successfully creates a record, but the Flow/SubFlow/Action field is empty.

 

Thoughts?

3 REPLIES 3

James Chun
Kilo Patron

Hi @Conan Lloyd1,

 

Are you trying to activate flow reporting for a specific Flow/Subflow/Action only?

Which table is that sys_id from? Is it from a Flow [sys_hub_flow], Subflow[sys_hub_flow], or Action[sys_hub_action_type_definition] table?

 

Cheers

Hello @James Chun 

 

I actually need to enable logging for all active flows and have been asked to make sure that logging is enabled for any new flow created automatically.  I'm just trying to figure out how to populate the document id type of field that is source.

 

~Conan

Hi @Conan Lloyd1,

 

Document ID would be the sys_id of the Flow/subflow or the Action.

Do note that enabling the logging for all iterations can impact performance - https://docs.servicenow.com/bundle/xanadu-build-workflows/page/administer/flow-designer/concept/flow...

 

Cheers