Automatically attach a file to an existing record when State has changed

Jeff Wentworth
ServiceNow Employee
ServiceNow Employee

Currently, I have created an after Business Rule (BR) on insert w/advanced script to automatically attach a file to a record based off of the State field changing from New to Work In Progress.

 

It is working but not w/the perfect user experience. The user clicks on a UI Action (i.e., Work In Progress) that changes the State from New to Work In Progress. The page reloads w/no errors and the State field changes to Work In Progress as expected. Unfortunately the form has be reloaded by the user one more time to attach the file to the record. It's like the script copies the attachment but doesn't successfully attach it until the second page refresh.

 

I spoke to a colleague who stated there may be an ASYNC issue behind this. I'm believe him to be correct, since the BR trigger occurs when the State > Changes to > Work In Progress.

 

Attached are screenshots of my BR:

 

 

4 REPLIES 4

Brian Lancaster
Tera Sage

Change it to a before business rule. That way it should insert the attachments before the form reloads.

Jeff Wentworth
ServiceNow Employee
ServiceNow Employee

Thank you, @Brian. I'll give that a shot!

Jeff Wentworth
ServiceNow Employee
ServiceNow Employee

@Brian, unfortunately changing the BR to before did not change the behavior of how the file is attached. The user still needs to click refresh to attach the file.

My only other thought would be to try changing the order on the BR. Set the number to something lower like 10 so it is one of the first BR to run.