Update RITM when variable is updated on SCTASK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:39 AM
Hi everyone,
I have a wait for condition in my workflow, that isn't moving forward. There is a variable that is on the sctask that the user must select yes or no to. The wait for condition is waiting for that variable to be updated. The issue is that when it's updated on the sctask, it's not seeing the RITM process an update. When I post a work note to the RITM, it see's that as an update. I wrote an onChange catalog client script that runs on that variable because we are trying to stay away from business rules. The script is below but for some reason it is not moving forward still. Any advice here would be greatly GREATLY appreciated. I've also tried adding a dummy variable and updating that. That didn't work either.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert(g_form.getValue('parent'));
forceUpdate();
function forceUpdate() {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request_item', g_form.getValue('parent'));
gr.query();
while (gr.next()) {
alert(newValue + gr.sys_id);
gr.dummy_variable = 'Yes';
gr.setValue('dummy_variable', 'Yes');
gr.setValue('description', 'test');
gr.description = 'Yes';
gr.update;
}
alert('RITM - ' + gr.number.getDisplayValue() + 'value - ' + newValue + ' variable value ' + gr.upload_agreement_or_contract + ' gr.variables ' + gr.variables.upload_agreement_or_contract);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:51 AM
Just thinking out loud, does your Wait For activity have an answer = true statement in the condition script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 07:53 AM
My wait for condition is as below -
var gr = new GlideRecord('sc_req_item');
gr.get(current.sys_id);
gr.query();
while(gr.next()) {
if(gr.variables.upload_agreement_or_contract == 'Yes'){
answer=true;
workflow.info("Answer is - " + gr.variables.upload_agreement_or_contract);
}
else{
answer=false;
workflow.info("Answer is - " + gr.variables.upload_agreement_or_contract);
}
}