- 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-01-2015 07:09 PM
Hi Tony,
About Business Rule.
1) I understand you want to fill u_update_type field with string value 'Special Caller'. Also this field is located on u_special.
If this is the case, you should run the onAfter Insert / Update BR on Call table.
Also, your call table should be reference in the u_special table so that you can do GlideRecord queries.
Posting some screenshots of your form of call and u_special table would be of great help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 04:22 AM
Hi Deepak
I tried the BR rule as 'After', insert, Update and no difference.
The call table is the same as the u_special table.
Just need BR to put 'Special Caller' value in to make it work (higlighted in yellow in below pic). Also when the Assigned to updates the call the 'Special Caller' value to be removed which i hope will remove the Number highlighting too.
Form example below:
List example below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 05:36 AM
Hi Tony,
Now based on understanding what you want to do:
You want if call on u_special table is updated by caller then update type field should have string value as special caller.
Write onBefor Business rule with insert and update both checked
Condition: current.caller == current.updated_by
Script section:
current.u_update_type = "Special Caller"; // I assume update type is custom field.
Sorry for typos if any. Sent from my mobile device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2015 06:00 AM
Hi Deepak
Thanks for script.
It works, but when the call is updated by the 'Assign to' person i need to automatically remove the 'Special Caller' value. Can you help with that?