- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2019 02:32 PM
Good evening,
I have been asked to develop a UI button to allow the service desk to update a call to show its been chased.
What they would like is a field that starts at 0 and everytime the button is clicked it increases by 1.
So I have a field names u_chase and so fare I have managed to get the button to appear all fine. I have also managed to set the field to a random value everytime the button is clicked.
The issue I have is that if the value is set to 1 and I click the button the new value becomes 11 and then 111. So its almost as though my script is seeing it as a string rather than integer?
Any idea what script I can use.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2019 03:45 PM
Hi Darren,
You'd need to use something like this:
current.u_chase = parseInt(current.u_chase)+1;
current.update();
Hope this helps.
Thanks
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2019 02:59 PM
Hi, Not sure if relevent but I recently found similar behaviour with myValue += newValue;
and resolved it with myValue = myValue + newValue;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2019 03:02 PM
You will need to capture old value before increment and store it within the table record.
var a = table.newfield; - default to 0
var b = 1;
var c = a+b
table.newfield = c
Onclick(c)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2019 03:45 PM
Hi Darren,
You'd need to use something like this:
current.u_chase = parseInt(current.u_chase)+1;
current.update();
Hope this helps.
Thanks
Steve