Trouble setting active=true

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2009 03:59 PM
I have been laboring over a stupid script for an hour with no success. I have a table extended from task that goes through a workflow. At the end, the state is setup to "Closed Completed", and active is set to false. We have "Active" defined as "This is an active customer account" and I want to keep the Active flag set to "true". In my script is a bit of code that looks like this:
gs.addInfoMessage('Changing active back to true...');
current.active = true;
gs.addInfoMessage('Active='+current.active);
The message always displays "Active=false". What the heck?!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2009 08:34 PM
You've probably got this figured out by now, but it looks like the problem is that you need to call an update to the current record in order for the change to take place.
current.active = true;
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2009 06:02 AM
Mark,
Thanks. I've got a current.update() in my script, but it still says "active=false" when I do gs.addInfoMessage(), and view the record after the update has taken. Hence my confusion why the first line may be suspect to setting the value appropriately.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2009 06:16 AM
I'd check the business rules on that table and make sure that you don't have anything else that sets the active field. Your syntax is correct as long as you are calling the update in the workflow script. I'm not sure that you want to use the active field like you describe though anyway. It's probably not a good idea to change that behavior too much since there's a lot dependent on that field. If it were me, I'd probably just track it in a separate field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2009 06:20 AM
Thanks again Mark (for the sage advice about the active field). I changed it to a "before" rule and removed the current.update() and it seems to be working. Will test more.