'Resolved' & Resolved by' fields not updating when call is resolved multiple times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2013 06:56 AM
Hi guys, Has anyone noticed that the 'Resolved' & Resolved by' fields are not updating when a call is resolved multiple times.
For example, If I resolve an incident at 14.55 it says:
Resolved: 14.55
Resolved by: me
However, if jobloggs reopens and then resolved again at 17.00 it still shows as:
Resolved: 14.55
Resolved by: me
But it should show as:
Resolved: 17:00
Resolved by: jobloggs
It should always show the last person who resolved it and also the last time it was resolved, not the first.
I have checked the business rule for this and think the following script is doing it:
function setResolutionFields() {
if (current.resolved_by.nil())
current.resolved_by = gs.getUserID();
if (current.resolved_at.nil())
current.resolved_at = gs.nowDateTime();
Is there a way to modify this script so that the last person to resolve is shown, not the first?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2013 07:03 AM
The code above is saying to only populate those fields if they haven't been populated yet. If you want them to populate every time, just comment out the 2 'if' statement lines like this...
function setResolutionFields() {
//if (current.resolved_by.nil())
current.resolved_by = gs.getUserID();
//if (current.resolved_at.nil())
current.resolved_at = gs.nowDateTime();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2013 09:14 AM
Thanks very much - really appreciate that. It worked a treat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2013 10:02 AM
I'm glad that fixed it. One other thing to be aware of is that this script may also run on closure. If the fields are already populated on resolution, they will be overwritten on closure of the record. This is probably not something you want, so you might want to have 2 sections...one for when the ticket is set to closed (which only populates the values if they're empty) and one for when the ticket is set to resolved (which populates them new each time).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2013 10:05 AM
Something like this for your condition...
current.state.changesTo(6) || current.state.changesTo(7)
And something like this for the top of the script portion...
if(current.state == 6){
//Re-populate resolution fields every time
current.resolved_by = gs.getUserID();
current.resolved_at = gs.nowDateTime();
}
else{
if (current.resolved_by.nil())
current.resolved_by = gs.getUserID();
if (current.resolved_at.nil())
current.resolved_at = gs.nowDateTime();
}