Business rule to change state when an attachment is uploaded by any user

Ash33
Tera Expert

Hi all

 

I have a requirement on the procurement form where;

If the state is "On Hold", and any user uploads an attachment; the state must change to "In Progress".

 

I tried the below BR but it does not work:

Table: attachment

When to run: After, Insert

condition: sn_case table

 

Script:

var psm = new GlideRecord('sn_case');

psm.get(current.table_sys_id);

psm.state=2;

psm.update();

2 REPLIES 2

Allen Andreas
Administrator
Administrator

Hi,

Are you saying for the condition you're using something like this?

AllenAndreas_0-1680230044806.png

Additionally, in your script, you'd want to verify the table name and exact spelling (is it really "sn_case"). You're also not evaluating the current state to see if it's on-hold or not? So you'd need to check that first and then if so, update the state to 'x' and then update the record.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen

Yes, the conditions are right. The table name has been verified. I need to evaluate the current state, I guess that was missing.