snow-flow 10.0.1-dev.417 → 10.0.1-dev.418
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -297,6 +297,50 @@ async function createFlowViaScheduledJob(
|
|
|
297
297
|
" }",
|
|
298
298
|
" r.steps.variables = { success: true, created: varsCreated };",
|
|
299
299
|
"",
|
|
300
|
+
// ── Duplicate trigger/action instances to snapshot ──
|
|
301
|
+
// Reference flow analysis: snapshot has its OWN action instances (flow=snapshot_id).
|
|
302
|
+
// Flow Designer loads the snapshot and queries instances where flow=snapshot_id.
|
|
303
|
+
" if (snapId) {",
|
|
304
|
+
" var snapTrigCreated = 0; var snapActCreated = 0;",
|
|
305
|
+
// Duplicate trigger instances
|
|
306
|
+
" var trigQ = new GlideRecord('sys_hub_trigger_instance');",
|
|
307
|
+
" trigQ.addQuery('flow', flowSysId); trigQ.query();",
|
|
308
|
+
" while (trigQ.next()) {",
|
|
309
|
+
" try {",
|
|
310
|
+
" var st = new GlideRecord('sys_hub_trigger_instance');",
|
|
311
|
+
" st.initialize();",
|
|
312
|
+
" st.setValue('flow', snapId);",
|
|
313
|
+
" st.setValue('name', trigQ.getValue('name'));",
|
|
314
|
+
" st.setValue('order', trigQ.getValue('order'));",
|
|
315
|
+
" st.setValue('active', trigQ.getValue('active'));",
|
|
316
|
+
" var atVal = trigQ.getValue('action_type');",
|
|
317
|
+
" if (atVal) st.setValue('action_type', atVal);",
|
|
318
|
+
" var tblVal = trigQ.getValue('table');",
|
|
319
|
+
" if (tblVal) st.setValue('table', tblVal);",
|
|
320
|
+
" var condVal = trigQ.getValue('condition');",
|
|
321
|
+
" if (condVal) st.setValue('condition', condVal);",
|
|
322
|
+
" if (st.insert()) snapTrigCreated++;",
|
|
323
|
+
" } catch(e) {}",
|
|
324
|
+
" }",
|
|
325
|
+
// Duplicate action instances
|
|
326
|
+
" var actQ = new GlideRecord('sys_hub_action_instance');",
|
|
327
|
+
" actQ.addQuery('flow', flowSysId); actQ.query();",
|
|
328
|
+
" while (actQ.next()) {",
|
|
329
|
+
" try {",
|
|
330
|
+
" var sa = new GlideRecord('sys_hub_action_instance');",
|
|
331
|
+
" sa.initialize();",
|
|
332
|
+
" sa.setValue('flow', snapId);",
|
|
333
|
+
" sa.setValue('name', actQ.getValue('name'));",
|
|
334
|
+
" sa.setValue('order', actQ.getValue('order'));",
|
|
335
|
+
" sa.setValue('active', actQ.getValue('active'));",
|
|
336
|
+
" var aatVal = actQ.getValue('action_type');",
|
|
337
|
+
" if (aatVal) sa.setValue('action_type', aatVal);",
|
|
338
|
+
" if (sa.insert()) snapActCreated++;",
|
|
339
|
+
" } catch(e) {}",
|
|
340
|
+
" }",
|
|
341
|
+
" r.steps.snapshot_instances = { triggers: snapTrigCreated, actions: snapActCreated };",
|
|
342
|
+
" }",
|
|
343
|
+
"",
|
|
300
344
|
// ── Reference: deep-inspect a published flow to find what latest_snapshot points to ──
|
|
301
345
|
" r.steps.reference_flow = null;",
|
|
302
346
|
" try {",
|