The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Variable Sync from task to ritm

InnamuriH
Tera Contributor

Lets say, I have a variable called "TEST 1" in RITM and hidden but the same variable is also present in task and visible on the form.

Now I am trying to update the TEST 1 variable with dropdown as "yes" and saved the form. I am going back to the request item with out refreshing I am just clicking on save button directly

Later, I am refreshing my task record and I can see the changes for variable Test 1 is getting reverted, why the variable sync from task to ritm is not happening if the variables are hidden in ritm, I also observed this for all the catalog items

How can we fix the issue, can any one also help me how the variables are getting synced from ritm to task?

 

Thanks.

5 REPLIES 5

Shashank_Jain
Kilo Sage

@InnamuriH ,

 

  • Variables are owned by RITM.

  • Hidden variables on RITM break the sync, because the save overwrites task values with old ones.

  • To fix → either keep them visible on RITM, or add logic (BR/Flow) to force updates from task → RITM.

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

Hi Shashank, 

I am trying with before update business rule, 

(function executeRule(current, previous /*null when async*/) {
    gs.info("inhar**bleep**ha current"+current.variables.definizione_agenda);
    gs.info("inhar**bleep**ha previous"+previous.variables.definizione_agenda);
      if (current.variables.definizione_agenda !== previous.variables.definizione_agenda) {
        gs.info("inhar**bleep**ha current1"+current.variables.definizione_agenda);
    gs.info("inhar**bleep**ha previous1"+previous.variables.definizione_agenda);

        gs.info("inhar**bleep**ha BR");
       
        var ritm = new GlideRecord('sc_req_item');
        ritm.get(current.request_item);

        // Update the RITM variable
        ritm.variables.definizione_agenda = current.variables.definizione_agenda;
        ritm.update();
    }
})(current, previous);

Ankur Bawiskar
Tera Patron
Tera Patron

@InnamuriH 

you need to reload the RITM form after you saved the task with that variable, then only the value will be refreshed on RITM form.

But if you save the RITM the variable value set from task form will be overriden because on RITM form you haven't refreshed yet and it's still None/Empty.

As per your comment this variable is not shown on RITM form then how are you hiding it?

Any UI policy? if yes then is that UI policy clearing the value when it runs with reverse condition?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I am using ui policy to hide few fields setting visibility false, how does this will impact?