Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
How can I automacially fill in multiple date fields when an item type is in a given state?
Ex:
When State="Sent"
Field Date01=date when state changed to sent + 0
Field Date02=date when state changed to sent + 1
Field Date03=date when state changed to sent + 2
Field Date04=date when state changed to sent + 3
Field Date05=date when state changed to sent + 4
So if State is "Sent" and the date is 7/31/2014 then field Date01 would be 8/01/2014, Date02 would be 8/02/2014 and so on.
We are using MKS Integrity 2009 SP5.
Thank you!
Hello Daniel!
Could you use an assignment trigger, triggering on the condition State [new value] = Sent, or am I missing something?
Regards,
Kael
Why does it have to be a state transition? Is that the only way? What if I have 37 steps in a work flow, would I have to have 37 states? I have a 37 step checklist and as a give user completes a step they would click on the Picklist (Yes/No) associated with that step.
Ah! Good point, and an invalid assumption on my part.
You could set a trigger so that those date fields were set every time the item was currently in that state instead, if you are okay with whatever values were previously in those datefields being overwritten. If you only wanted those datefields set when you first get into that state, you could base your rule on State[new value] = Sent AND State != Sent.
Maybe there is something about the situation I am not understanding. You have a workflow with 37 steps. At some point in the workflow, while the item is in the state Sent, the user flips a picklist (Yes/No, let's call this booleanPick) from No to Yes and you want the dates to get populated. Does that sound like your scenario? In that case, when they set booleanPick to Yes, the state is already in Sent, and they hit Apply, you would like the date fields to get set? In that case, I would expect the trigger rule to be State[new value] = Sent AND booleanPick[new value] == Yes. If you wanted it to fire only when after the pick was set in the new state, you could use this rule instead: State[new value] = Sent AND booleanPick[new value] == Yes AND booleanPick == No. In that case, you would need to make sure booleanPick was set to No upon entering the Sent state, or you would need to make sure the user understood that they needed to set booleanPick to No, then apply the change, then change it back to Yes.
Does that sound like what you are aiming for, or am I still missing something?
Regards,
Kael
Kael,
I'm not sure what trigger I would use to do that.
What I did was created a date field and called it "Day 0". I created additional date fields with a computed definitions. Date 01, Date 02, Date 03, etc.
Ex.
Field "Date 01" with Computation Definition ("Day 0") + 5
When the inital date is set (Field "Day 0") the field Date 01 would be filled after the item is saved. If Day 0 was Aug 4, 2014 then Date 01 would be Aug 9, 2014.
However, this is not the way I wanted to do it. What I tried is a workaround, although not difficult. I'm not sure what trigger I would use to elminate the need for a user to select and chose a Day 0 date.
Hi Daniel,
as you "Date0" seems to be related to state transition, maybe you could use the "dateFirstEntered(state-name)" computation.
HTH Matthias
How would a BooleanPick set the Date?
You set a trigger rule that fires when a field is changed (old value != new value). You can combine it with other trigger rule conditions to restrict it to only firing in a certain state, or when the user is the assigned user.
Michael,
But how is the Date set? Additionally, would I have to use the "Assigned User" field as well? Currently for this "Type" we are not using the "Assigned User" field. The "Day 0" is set manually by the user, but I would like that to be set in a given state.
Dan
In general, if I wanted to set values on an item, I would try to figure out what circumstances I would want to have in effect in order to fire the trigger. Sometimes, a field needs to be added to be the final "activation" trigger, but when possible, I try to avoid that, because overreliance on that sort of approach leads to a cluttered item display.
The other side of this coin is what should happen when the trigger is fired: For simple assignments, the Assignment tab of the trigger definition allows you to set fields to particular values. For more complex assignments, such a custom trigger needs to be run to fulfill what you are trying to do (e.g. in pseudocode set Date 01 := field.value("Day 0") + 5 ). This side is more complicated, because the scripts are written in javascript/ecmascript, and use the trigger API that by default is referenced from your server's home page.
Given that the trigger API documentation is a little arcane if you haven't done Java development before, some sample scripts are provided out-of-the box, to give you an idea of how these things work. The following articles might be of use in getting you started.
If this sort of thing is outside of your scope of knowledge, responsibilities, or available time, you can contact your Account Manager to arrange for a consultation by Global Services. Unfortunately, Integrity Support can only provide assistance on questions as to whether particular functionality works as expected, and cannot provide guidance on writing trigger scripts.
If you would like to learn Javascript/Ecmascript, there are a number of good guides and tutorials available on the World Wide Web, based on varying levels of programming familiarity.
Regards,
Kael
An assignment trigger would not work. It would if you knew the date, but the date is only known when the item is saved and a given state is changed.
Hello Daniel,
In my opinion, it is impossible to understand the original requirement behind your first question and therefore to answer it in a meaningful way. Now that question has evolved into many more questions and the thread is difficult to unravel.
For example, reading this whole post, my guess is that you want to automatically calculate a suite of date fields based on a user selection before saving the item. I may be totally wrong, that's why I call it a guess and I wouldn't try to answer it.
I think you need to discuss your requirement and its solution with a consultant or Support, but as a real live discussion, not via posts.