snow-flow 10.0.1-dev.408 → 10.0.1-dev.409
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
|
@@ -123,9 +123,10 @@ async function createFlowViaScheduledJob(
|
|
|
123
123
|
" }",
|
|
124
124
|
" } catch(t1e) { r.steps.tier1 = { success: false, error: t1e.getMessage ? t1e.getMessage() : t1e + '' }; }",
|
|
125
125
|
"",
|
|
126
|
-
// ── TIER 2: GlideRecord
|
|
127
|
-
//
|
|
128
|
-
//
|
|
126
|
+
// ── TIER 2: GlideRecord ──
|
|
127
|
+
// Set flow_definition + latest_snapshot on flow record.
|
|
128
|
+
// Set flow_definition on version record.
|
|
129
|
+
// Force-set latest_version with setWorkflow(false) to bypass BRs.
|
|
129
130
|
" if (!flowSysId) {",
|
|
130
131
|
" try {",
|
|
131
132
|
" var f = new GlideRecord('sys_hub_flow');",
|
|
@@ -135,30 +136,39 @@ async function createFlowViaScheduledJob(
|
|
|
135
136
|
" f.setValue('run_as', runAs); f.setValue('active', false);",
|
|
136
137
|
" f.setValue('status', 'draft'); f.setValue('validated', true);",
|
|
137
138
|
" f.setValue('type', isSubflow ? 'subflow' : 'flow');",
|
|
139
|
+
" if (flowDefStr) { f.setValue('flow_definition', flowDefStr); f.setValue('latest_snapshot', flowDefStr); }",
|
|
138
140
|
" flowSysId = f.insert();",
|
|
139
|
-
" r.steps.flow_insert = { success: !!flowSysId, sys_id: flowSysId + '' };",
|
|
141
|
+
" r.steps.flow_insert = { success: !!flowSysId, sys_id: flowSysId + '', flow_def_set: !!flowDefStr };",
|
|
140
142
|
" if (flowSysId) {",
|
|
141
|
-
// Step 1: INSERT version as minimal draft
|
|
142
143
|
" var v = new GlideRecord('sys_hub_flow_version');",
|
|
143
144
|
" v.initialize();",
|
|
144
145
|
" v.setValue('flow', flowSysId); v.setValue('name', '1.0');",
|
|
145
146
|
" v.setValue('version', '1.0'); v.setValue('state', 'draft');",
|
|
146
|
-
" v.setValue('active',
|
|
147
|
-
" v.setValue('is_current',
|
|
147
|
+
" v.setValue('active', true); v.setValue('compile_state', 'draft');",
|
|
148
|
+
" v.setValue('is_current', true);",
|
|
149
|
+
" v.setValue('internal_name', intName + '_v1_0');",
|
|
150
|
+
" if (flowDefStr) { v.setValue('flow_definition', flowDefStr); }",
|
|
148
151
|
" verSysId = v.insert();",
|
|
149
|
-
" r.steps.version_insert = { success: !!verSysId, sys_id: verSysId + '' };",
|
|
150
|
-
|
|
152
|
+
" r.steps.version_insert = { success: !!verSysId, sys_id: verSysId + '', has_flow_def: !!flowDefStr };",
|
|
153
|
+
"",
|
|
154
|
+
// Force-set latest_version — bypass BRs with setWorkflow(false)
|
|
151
155
|
" if (verSysId) {",
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
|
|
156
|
+
" try {",
|
|
157
|
+
" var flowUpd = new GlideRecord('sys_hub_flow');",
|
|
158
|
+
" flowUpd.setWorkflow(false);",
|
|
159
|
+
" flowUpd.autoSysFields(false);",
|
|
160
|
+
" if (flowUpd.get(flowSysId)) {",
|
|
161
|
+
" flowUpd.setValue('latest_version', verSysId);",
|
|
162
|
+
" flowUpd.update();",
|
|
163
|
+
" r.steps.latest_version_force = 'attempted';",
|
|
164
|
+
" }",
|
|
165
|
+
" } catch(lvE) { r.steps.latest_version_force = 'error:' + (lvE.getMessage ? lvE.getMessage() : lvE + ''); }",
|
|
166
|
+
// Verify latest_version was set
|
|
159
167
|
" var lvCheck = new GlideRecord('sys_hub_flow');",
|
|
160
168
|
" if (lvCheck.get(flowSysId)) {",
|
|
161
|
-
"
|
|
169
|
+
" var lvVal = lvCheck.getValue('latest_version');",
|
|
170
|
+
" r.steps.latest_version_after_force = lvVal + '';",
|
|
171
|
+
" r.steps.latest_version_success = (lvVal === verSysId + '');",
|
|
162
172
|
" }",
|
|
163
173
|
" }",
|
|
164
174
|
" r.tier_used = 'gliderecord_scheduled'; r.success = true;",
|