The calculation itself is pretty simple
#Dependecy on raise user#
static def GetAttributeValue(Incident):
Value = ''
Value = Incident.RaiseUser._CustomerFlag1._CustomerFlag
if Value == 'VIP': MessageBox.Show("Incident comes from VIP", "VIP Alert",MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
My attribute is on the incident object with this calculation is called Alert. Note my use of manual dependencies here. YMMV on the type of list or checkbox you have on raise user to detect if someone is such a person. I return this value so it can be painted on the screen as well.
On the incident window itself, set the property for the attribute (Alert in my case) to have 'Is calculate on change' set to be true.
I'd exit/go back in/iis reset and if all else fails reach for the TPS trace diagnostics!
Just to say that got an error message when trying to compile DMS's calculation until I spotted that the "import System.Windows.Forms" in the example which is not in the standard basic calc. Then I was able to save the calculation.
I was not however able to get it to work to generate a popup box - but I was trying to do it on a window to add a new collection item.
And I'd think long and hard before exploring this more unless the popup actually works in WebDesk as well :-)
We used the example Dave gave and it worked on our VIP Type Field, just to test the concept.
We then tried this on the category field, so if a certain category is selected the analyst gets a popup window on their screen asking them something.
Here is the code we used:
We are looking into how we can use this on other categories and other fields.
One thing we had to do though was to add the Calculation Handler (OnValueChanged) for the category field.
I have attached another example.
After stealing your code and a lot of faffing about finally have managed to get this to work. It's brilliant , however am I doing something wrong as the OK on the popup box has to be clicked 3 times before it goes away??? No doubt it's me having done something completely stupid.
Nothing springs to mind I'm afraid Helen. I do have at least one client using this method, although they are migrating quite rapidly to WebDesk and hence have accepted this will not work any more. About all I can think of is that for some reason the calculation is being fired off several times. Perhaps a window copy rule into the same attribute with always execute set? I'd turn on calcualtion diagnostics in the framework and see if that gives any clues.
I had a copy rule set to always execute. I've removed the always execute and now it's down to twice. On my user window I have a boolean attribute (True/False) which is used to indicate whether the user is a VIP or not and then a copy rule to copy this info to a string attribute - think it was set up this way for the Incident matrix. Anyhoo when I was setting up the calculation for the pop-up I tried to get it to query the VIP boolean attribute but it wouldn't work. As soon as I got it to look at the string it worked but I have to ok the pop-up twice.
For your customer is it a boolean attribute you're checking in the calculation? Should I be able to use a boolean??
As always thanks for the help