- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 06:08 PM
Hi there
not sure if something is wrong with the below, the catalog item its not calling the below flow, i have it as scripted task on the catalog item.
when it test it manually using the flow, the REST part of the flow works perfectly well.
on the catalog item, i have another workflow, and then on the task on the catalog item i have the code snippet as per below
Thanks
Levino
(function() {
try {
var inputs = {};
inputs['table_name'] = 'Requested Item';
inputs['current']; // GlideRecord of table: sc_req_item
// Start Asynchronously: Uncomment to run in background.
sn_fd.FlowAPI.getRunner().flow('global.uff_integration').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
//sn_fd.FlowAPI.getRunner().flow('global.uff_integration').inForeground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 06:23 PM - edited 03-16-2024 06:23 PM
Hi @levino ,
Please try below code:
(function() {
try {
var sctaskGR = new GlideRecord('sc_req_item');
if (sctaskGR.get('sys_id_of_a_specific_sc_task_record')){
var inputs = {};
inputs['current'] = sctaskGR; // GlideRecord of table:
inputs['table_name'] = 'sc_req_item';
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.xyz').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.uff_integration').inForeground().withInputs(inputs).run();
}
else{
gs.warn('Not a valid record of SCTASK');
}
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 06:23 PM - edited 03-16-2024 06:23 PM
Hi @levino ,
Please try below code:
(function() {
try {
var sctaskGR = new GlideRecord('sc_req_item');
if (sctaskGR.get('sys_id_of_a_specific_sc_task_record')){
var inputs = {};
inputs['current'] = sctaskGR; // GlideRecord of table:
inputs['table_name'] = 'sc_req_item';
// Start Asynchronously: Uncomment to run in background.
// sn_fd.FlowAPI.getRunner().flow('global.xyz').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground.
sn_fd.FlowAPI.getRunner().flow('global.uff_integration').inForeground().withInputs(inputs).run();
}
else{
gs.warn('Not a valid record of SCTASK');
}
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 09:23 PM
Hi Sumanth
the workflow on the cat item has this for the scripted fulfilment task and i am putting your code in the scripted task.
i tried with your code , no luck
Thanks
Levino
evaluateScriptedTask();
function evaluateScriptedTask() {
var vars = {
'RITM': workflow.scratchpad.req_id
};
var apr_rec = new GlideRecord('u_catalog_task_assignment');
apr_rec.get(workflow.scratchpad.taskID);
var evaluator = new GlideScopedEvaluator();
var result = evaluator.evaluateScript(apr_rec, 'u_script', vars);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 09:45 PM