FlowDesigner set updated date of incident back to date before "update" :)

chrisw_
Tera Contributor

Hi together, 

I try to achieve a Workflow(s) with the Flow Designer which does the following:

Check out all Incidents in State : On Hold and Reason: Awaiting Caller where the Updated Date is older then 7 Days. 

Then take all of these Incidents and make a additional comment : You didn`t reply since 7 Days ....... 

The problem is for sure by default the Updated date of the Incident will be reset to the current date. 

I don`t want this because i have a second Workflow which checks for Incidents older than 14 Days which should close them den and make a final notice to the Caller. 

So for the second workflow i need that the first workflow does not change the updated date. 

I tried to set the update date back to it`s initial date via FlowDesigner by saying: 

Update the Incident to the Updated date from the Incident:

 

find_real_file.png

It seems to work because the Date of the runtime value is older then the date when the flow was running. (For test purposes i said incidents not updated since 2 minutes :))

But it seems that the system afterwards makes an update again 😞

Any idea?

thank you

brgds

4 REPLIES 4

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

To do this you need to create your own action, containing a script action (Requires a subscription for integration.)

The action would be like:

find_real_file.png

The trick is to set autoSysFields to false, to prevent updating the updated DateTime.

Script:

(function execute(inputs, outputs) {
	
  var cnt = 0;
  var gr_incidents = inputs.gr_incidents;
  while (gr_incidents.next()) {

      gr_incidents.work_notes = inputs.message;
      gr_incidents.autoSysFields(false);
      gr_incidents.update();
      cnt++;

  }
  outputs.recordsUpdated = cnt;
  
})(inputs, outputs);

 

The flow it self would then be something like:

find_real_file.png

 

find_real_file.png

 

Good Luck

 

Hi Arnoud

I'm trying to follow your approach.

I created an action. I call this action from a flow.

Inputs are:

  • ritm reference sc_req_item table
  • user reference sys_user table

 

The goal is to populate sc_req_item.requested_for field with inputs.user.

My flow and action has finished without errors, but the record (ritm) isn't updated.

 

I don't know what I'm doing wrong here.

 

The flow:

arielgritti_0-1666964041510.png

 

The action:

arielgritti_1-1666964066739.png

 

arielgritti_2-1666964097646.png

Can you guide me?

Thanks,

Ariel

 

I tried it again (this version of the action is the current one) and I obtained this error:

arielgritti_3-1666964281504.png

 

Thomas Michels1
Kilo Contributor

This was perfect. Thx a lot!!! 🙂