- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2015 06:07 PM
Hi All
Im trying to highlight all newly updated calls (non itil role) in light blue, so that they are easy to spot by our users that have the itil role. Then once updated by a itli role user the call should immediately remove the blue background.
I've seen something quite close to what I want in a blog by MB Incident updates - colouring in the number, but I need the update to be triggered from a caller sending return update via email.
The table name I'm going to use as an e.g. is u_special.
I'd appreciate some help with the BR script. I want it simply to run after an update to the call and write a string into a field.
The business rule
name will be brHighlight
Active, Advanced, insert, update, query are all ticked
When: After
Condition: none
Script:
\\ i want to highlight new calls and calls updated by a caller and script should set string value "Special Caller" into a field called 'Update Type' on the u_special table that will be hidden. The Assign to should not trigger as their updates never need to be highlighted.
if (current.operation() == 'insert' && current.comments.changes() != 'current.assigned_to') {
setDisplayValue('Special Caller', current.u_update_type);
}
Style Module
Value: javascript:current.u_update_type == "Special Caller"
Style: background-color:lightblue
Field Name: Updated
Table Name: u_special
Table
Table Name: u_special
Field Column Name: u_update_type
Field Label Name: Update Type
Thanks TC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 05:51 PM
Hi Tony,
All right, lthat clarifies things.
This form is for the table "u_special" and u_special extends Task. Incident (literally the table named incident) has no part in this.
You want the value of u_update_type on the u_special table to change as stuff happens.
The Caller is stored in the u_caller field, the Assigned to person is in the assigned_to field.
To clarify some of my earlier comments: sys_updated_by exists on the record, whether you show it on the form or not. It's a base system field, and is on every table. We can ignore that though, and use the gs.getUserName() call if this will be updated interactively (not via an import or integration, but by a person actually filling in a form and clicking a button to submit it).
Similarly, assigned_to is on the Task table, which is why your u_special inherits it. The caller_id field I mentioned in an earlier post is on the Incident table, which is why you don't have that on your u_special table- you don't inherit it, because you extend Task, not Incident.
Given your answers, you need a condition like this:
current.u_caller.hasValue()
All that condition does is make sure the Business Rule runs only if the Caller is actually populated. This should be a Before Insert/Update rule on the u_special table.
To make your script work, we use the more complicated version I posted before, adjust for the understanding that this not on the Incident table (or an extension of it) but instead is for this totally different u_special table which extends Task.
//who is making this update right now
var updater = gs.getUserName();
//reset the update type - this makes the value blank unless the
//updater is the Assigned to user or the Caller
current.u_update_type = "";
//do the assigned_to logic
if(current.assigned_to.hasValue() && current.assigned_to.user_name == updater)
current.u_update_type = "Commented";
//do the Special Caller logic
if(current.u_caller.hasValue() && current.u_caller.user_name == updater)
current.u_update_type = "Special Caller";
If you leave this as-is, then the u_update_type will have 3 possible values:
- Empty because the person doing the update or insert is neither the Caller nor the Assigned to user
- Commented because the person doing the update is the Assigned to user
- Special Caller because the person doing the update is the Caller
If you want there to be only two possible values- Commented and Special Caller, then remove line 06 and Line 09. Then it will always be either Commented or Special Caller, so long as the Caller field is actually populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 05:51 PM
Hi Tony,
All right, lthat clarifies things.
This form is for the table "u_special" and u_special extends Task. Incident (literally the table named incident) has no part in this.
You want the value of u_update_type on the u_special table to change as stuff happens.
The Caller is stored in the u_caller field, the Assigned to person is in the assigned_to field.
To clarify some of my earlier comments: sys_updated_by exists on the record, whether you show it on the form or not. It's a base system field, and is on every table. We can ignore that though, and use the gs.getUserName() call if this will be updated interactively (not via an import or integration, but by a person actually filling in a form and clicking a button to submit it).
Similarly, assigned_to is on the Task table, which is why your u_special inherits it. The caller_id field I mentioned in an earlier post is on the Incident table, which is why you don't have that on your u_special table- you don't inherit it, because you extend Task, not Incident.
Given your answers, you need a condition like this:
current.u_caller.hasValue()
All that condition does is make sure the Business Rule runs only if the Caller is actually populated. This should be a Before Insert/Update rule on the u_special table.
To make your script work, we use the more complicated version I posted before, adjust for the understanding that this not on the Incident table (or an extension of it) but instead is for this totally different u_special table which extends Task.
//who is making this update right now
var updater = gs.getUserName();
//reset the update type - this makes the value blank unless the
//updater is the Assigned to user or the Caller
current.u_update_type = "";
//do the assigned_to logic
if(current.assigned_to.hasValue() && current.assigned_to.user_name == updater)
current.u_update_type = "Commented";
//do the Special Caller logic
if(current.u_caller.hasValue() && current.u_caller.user_name == updater)
current.u_update_type = "Special Caller";
If you leave this as-is, then the u_update_type will have 3 possible values:
- Empty because the person doing the update or insert is neither the Caller nor the Assigned to user
- Commented because the person doing the update is the Assigned to user
- Special Caller because the person doing the update is the Caller
If you want there to be only two possible values- Commented and Special Caller, then remove line 06 and Line 09. Then it will always be either Commented or Special Caller, so long as the Caller field is actually populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 06:51 PM
Cory that is spot on!
Only thing i change is swap the 'Commented' around with the 'blank'.
Thanks for bearing with me too.
I intent to hide the u_update_type field incase they don't want to see the function.
Thanks Again!
and thanks to Deepak too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 07:08 PM
One slight snag, but not a biggie.
When Caller and Assigned to are the same person the Assigned to should win and return a empty value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 07:54 PM
Hi Tony,
If the caller is the same as the assigned_to and they are the same as the person making the update, you can catch that with another if.
//who is making this update right now
var updater = gs.getUserName();
//reset the update type - this makes the value blank unless the
//updater is the Assigned to user or the Caller
current.u_update_type = "";
//do the assigned_to logic
if (current.assigned_to.hasValue() && current.assigned_to.user_name == updater)
current.u_update_type = "Commented";
//do the Special Caller logic
if (current.u_caller.user_name == updater)
if (current.getValue("assigned_to") == current.getValue("u_caller"))
current.u_update_type = "";
else
current.u_update_type = "Special Caller";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2015 05:03 PM
Thanks Cory
Sorry for delay in response.
The script works very well with the extra if statement, thank you. The only scenario i had not considered before, is if the analyst (1st person) logs a call on behalf of a caller (2nd person) and assigns to a different colleague (3rd person). At present this brand new call would highlight in orange which equals the 'Commented' value. Although i can live with this, ideally i'd like the value 'New Request' added to the update type field, but this would only happen when a new call is 'opened by' (u_opened_by) a 3rd person. Without conflicting with the existing updated by if statement that creates the 'Commented' value at present. This is what iv'e got now and works perfectly thanks to you.
//who is making this update right now
var updater = gs.getUserName();
//If updater is not the Caller
current.u_update_type = "Commented";
//do the assigned_to logic
if (current.assigned_to.hasValue() && current.assigned_to.user_name == updater)
current.u_update_type = "";
//do the Special Caller logic
if (current.u_caller.user_name == updater)
if (current.getValue("assigned_to") == current.getValue("u_caller"))
current.u_update_type = "";
else
current.u_update_type = "Special Caller";