Using MVG aggregate functions

April 5, 2007 at 12:40 pm 4 comments

Karan asked a question the other day: how to prevent the Status of a Service Request changing until all child Activities have been completed? This type of business rule is exactly what State Models are designed for: set up a model on Service Request Status and restrict transitions to the target status unless a condition has been satisfied. The difficulty in this example is how to write a rule based on child records?

State Model Rule Expressions use the same format as calculated field values, so the same MVG aggregate functions are available. The functions Count, Sum and EXISTS all derive a single value from a Multi Value Group and are an underused way to reduce scripting.

In the example given, Service Request has an MVG Action linked to the child Activities, so we can add a Multi Value Field to point to Action.Status. A rule expression Not EXISTS([Action Status]<>'Done') in the State Model transition gives the desired restriction.

There’s a good example of the EXISTS function in use in the vanilla Siebel 7 repository: see BC Contact field Exists New OutBound Email Activities.

Advertisements

Entry filed under: Configuration, Siebel.

Searching Calculated Fields and performance Workflow Process Business Objects

4 Comments

  • 1. Nathan  |  April 10, 2007 at 8:10 pm

    the only thing i would add is isnt the error message from a state model is not ideal? You get a fairly generic error message that doesnt exactly tell you what you havent filled in.

    i can stand to be corrected on this however.

  • 2. stuandgravy  |  April 11, 2007 at 8:44 am

    You missed the “First post!” ๐Ÿ˜‰

    That’s a fair point – State Model errors are pretty indecipherable. Repeating back the rule expression ain’t much help to a normal user.

    You could do the same sort of thing with Data Validation Manager in later versions of 7 – that allows a custom error. Otherwise I think you’re coding it, which has its own drawbacks…

    Other options?

  • 3. karan bhambhani  |  May 24, 2007 at 4:00 pm

    Agree with Nathan re: the error message generated when user tries to change the status of the SR – not very helpful for the end user. (although could be passed as a training issue to avoid users raising a support ticket for it!)

    I tried and tested this in my current Project, and the only little hiccup,is that the parent BC needs to be refreshed.

    So, from the above example, I have child activities for a Service Request, and once status of all child activities is changed to “Done” , and then try and change the status of the Agreement from the form applet, you still get that message. Ofcourse, the message goes away when you refresh the Form Applet ( the one with Service Request) , and hence lets you change the status of the SR. Good solution overall! I like it ๐Ÿ™‚

  • 4. stuandgravy  |  May 24, 2007 at 4:45 pm

    Glad that works for you Karan ๐Ÿ™‚

    I think you might be able to avoid the refresh by having the child records present in an MVG on the parent, if the MVG uses the same link as the business object… but it’s been a while, so I might not be remembering that right. Hence why I’ve started writing this stuff down!!

    Be interested to hear if you do come up with any improvements…


Feeds


%d bloggers like this: