States on Custom Tables (this is embarrassing)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2015 10:24 AM
So I have a custom task type with several states, 3 of which are considered "Closed".
Since all my workers and customers work off of Task lists, I opted to modify choices for Task.State rather than make a custom table based state.
Ok, so I created all my state choices and the three "Closed" ones have values of 50,60,70 respectively. I did a dictionary override for my custom table and listed them in the close_states attributes (per this wiki page)
My problem is no matter which of the ending states I pick, the system interrupts and sets the State value to 3.
Suspecting the "Task Active State Management" business rule was to blame, I deactivated it, and sure enough, I could pick whatever closure state I wanted unmolested.
My problem is, I can't figure out how or why Task Active State Management is determining that I want a default State of 3 on inactivation.
Anyone run into this kind of thing before?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2015 12:29 PM
Thinking about it, I don't think going after task closer will work because task closer is going to set the state and you lose your custom value to check against.
What you need is to set a variable that follows through with the execution environment, and override what task closer is doing if your variable is set.
You can get around the fact that scoped apps don't let you create global variables by just appending the submitted state to current early on:
if (current.state == '75')
current.my_custom_var_no_one_will_ever_access_but_me = '75'
Then in your later rule, which runs after task closer, check the custom var and fix up the state.
You should still be able to fix the active flag right after Task Active State Management runs though. Can even do it in the same rule that is appending your custom field to current.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2015 12:41 PM
I'm currently working under the following...
I did not define a dictionary override for my custom table on task.state to define close_states attribute.
That should prevent Task Active States Management from running (or rather, force it to give a return), which in turn prevents Task Closer from waking up due to the Active field change.
I then have the rule on my custom table ordered at 1000 to change the active flag based on the state values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2015 09:46 AM
Hey Robert,
Did you get this working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2015 06:09 AM
Cory Seering - Thanks for checking in.
Took a bit, but I have something workable, if a little heavy to maintain. I also discovered that if I"m going to manually control state/active with custom rules, I've got to do the same for workflow ticklers.
It was a sore lesson, but integrating custom apps into existing workflows is way harder than it ought to be.