Incrementing a Number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2010 02:31 PM
Hello,
I am wanting to increment a field by one in a UI action that I am using. I think I need to write this in my UI action something similar to:
current.u_number = getNextObjNumber();
However, I don't want the next object number as this will just give me the next incident number. When my button is pressed (UI Action) I just want the field to be updated with 1 and then next time with 2, the next time with 3 and so on....
Think its just a piece of javascript that i'm missing.
Can anyone help?
Thanks
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2010 03:19 PM
If you do this as a client side UI Action you can do something like this
OnClick: plus1();
function plus1(){
var num = g_form.getValue('u_number');
num++;
g_form.setValue('u_number', num);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2010 03:26 PM
It's the 'communicate_workaround' UI Action that I am working on which isn't a client side script - any other ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2010 03:29 PM
To increment a field just add this line then. Just change to your field.
current.u_number = current.u_number++;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2010 03:39 PM
I just looked at that UI Action, it depends on where you want that ++ to take place. If on the problem itself add the script of something similar to the beginning. If you want it to happen on the incident add after the while (incident.next()) {
Post back if you need help with that.