Business rule to change state when an attachment is uploaded by any user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 06:10 PM
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 07:34 PM - edited 03-30-2023 07:35 PM
Hi,
Are you saying for the condition you're using something like this?
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 07:43 PM
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.