snow-flow 10.0.1-dev.432 → 10.0.1-dev.433
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
|
@@ -95,16 +95,32 @@ async function addTriggerViaGraphQL(
|
|
|
95
95
|
try {
|
|
96
96
|
const resp = await client.get('/api/now/table/' + defTable, {
|
|
97
97
|
params: {
|
|
98
|
-
sysparm_query: '
|
|
99
|
-
sysparm_fields: 'sys_id,internal_name', sysparm_limit: 10
|
|
98
|
+
sysparm_query: 'internal_nameLIKEsn_fd.trigger.' + config.type,
|
|
99
|
+
sysparm_fields: 'sys_id,internal_name,name', sysparm_limit: 10
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
for (const r of (resp.data.result || [])) {
|
|
103
|
-
|
|
103
|
+
const iname = r.internal_name || '';
|
|
104
|
+
if (iname.indexOf('trigger') > -1 && iname.indexOf(config.type) > -1) { trigDefId = r.sys_id; break; }
|
|
104
105
|
}
|
|
105
106
|
} catch (_) {}
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
if (!trigDefId) {
|
|
110
|
+
try {
|
|
111
|
+
const resp = await client.get('/api/now/table/sys_hub_action_type_definition', {
|
|
112
|
+
params: {
|
|
113
|
+
sysparm_query: 'internal_nameLIKEtrigger^internal_nameLIKE' + config.type,
|
|
114
|
+
sysparm_fields: 'sys_id,internal_name,name', sysparm_limit: 10
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
steps.fallback_candidates = (resp.data.result || []).map((r: any) => ({ sys_id: r.sys_id, internal_name: r.internal_name, name: r.name }));
|
|
118
|
+
for (const r of (resp.data.result || [])) {
|
|
119
|
+
const iname = r.internal_name || '';
|
|
120
|
+
if (iname.indexOf(config.type) > -1) { trigDefId = r.sys_id; break; }
|
|
121
|
+
}
|
|
122
|
+
} catch (_) {}
|
|
123
|
+
}
|
|
108
124
|
if (!trigDefId) return { success: false, error: 'Trigger definition not found for: ' + triggerType, steps };
|
|
109
125
|
steps.def_lookup = { id: trigDefId };
|
|
110
126
|
|