- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 08:15 AM
Hi there!
I have two fields: assigned_to, and u_previously_assigned_to.
Should I make a business rule, or a client script?
What I need to happen, is when the Incident state changes to "Retired", then copy the field values from the field "assigned_to", and put it in the new field "u_previously_assigned_to", due to the assigned_to field may change upon the state change.
Anyone have anything that already does something like this? I wrote up something quick in a business rule running as "before", but it isn't changing the new field. It is just blank.
Thanks for your help!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 12:41 PM
I got it! Strangely I needed to add the current.update(); that you said I didn't need to use... put it in my script and bam, it worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 12:19 PM
I changed the order to become first, and then I used current, but it still isnt working.
Before business rule, order of 40.
Insert and Update clicked.
condition: current.install_status.changesTo(7)
current.assigned = current.alm_hardware.u_previously_assigned;
current.assigned_to = current.u_previously_assigned_to;
current.department = current.u_p_a_department;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 12:25 PM
I thought that you wanted to copy the "assigned to" to your custom field? So wouldn't you want to have:
current.u_previously_assigned_to = current.assigned_to;
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 12:41 PM
I got it! Strangely I needed to add the current.update(); that you said I didn't need to use... put it in my script and bam, it worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2014 12:47 PM
I guess that makes sense if later on you empty out the value because that would take precedence then.
Glad you have it worked out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2014 01:17 AM
one thing to be aware of when adding current.update() to a business rule is you are effectively updating the record twice which can cause adverse effects to other BRs or workflows and sometimes the activity log.
It's best to try and keep any field updates in BEFORE Business rules where you don't need to add current.update() as it's before the DB commit, After BRs are best left to update related records etc, or even better ASYNCH which if it's not time critical which means the user doesn't have to wait for the BR to finish doing whatever it's doing.
Hope that helps you avoid any unintentional issues.
Marc