- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2014 04:54 PM
Hi all, several of my technicians have requested a feature that would allow them to set a signature that would appear automatically when they update Incidents. We had this functionality in our old ticketing system and our people like to have a friendly and human touch when talking with our customers.
Anyway, to set this up, I just created two new fields on the user table, one to hold a signature and one to toggle it on or off. I am now trying to use a Business Rule to insert the signature after comments. Sounds easy enough, right?
Anyway, for some reason the comment itself is repeating after the signature is inserted. For example, say my signature is '- Ben, Field Tech' and I make a comment on an Incident that says "All done - I fixed the computer. Have a great day!". What shows up in the activity feed is:
All done - I fixed the computer. Have a great day!
- Ben, Field Tech
All done - I fixed the computer. Have a great day!
The code the business rule runs is just:
current.comments += "\n\n" + userSignature
Any ideas why it's doing this or how I can fix?
Thanks!
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2015 10:39 AM
I ended up solving this by creating a Business Rule to run on Display and pass the UserSignature values to the session in the g_scratchpad object.
I could then use a client script (instead of a Business Rule) to insert the Signature on Insert of the Incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 08:30 AM
Everytime you set a journal field equal to a value, it will add a separate entry for that value. So you don't want to be using "+=" as if it were just a string field.
Prepare your comments in a separate string variable, and then copy that string to the comments field along with the signature only once in the business rule. e.g.:
var comments = 'Here are some comments.';
current.comments = comments + signature;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 10:35 AM
Hi all, I don't think the problem is with the concatenation. The signature + comment is showing up fine. The problem is that the comment is showing up again. I've tried using separate variables for comments and signatures, like so:
But still get the same result:
I'm wondering if there is a separate rule/function that grabs the original comment from the input and puts it in the feed that I need to find and conditionally disable?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 10:56 AM
Hi Ben,
Can you try below code and check still the problem persists.
Var mySig;
Var theComment;
Var theWholeComment;
mySig = '- Ben field technician ';
theComment = Current.comments;
Current.comments ='';
theWholeComment = theComment +'\n\n'+mysig;
Current.comments = theWholeComment ;
Regards,
Harish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 11:25 AM
Harish, I updated the code to try your suggestion (clearing out the current.comments) but I get the same result with this code:
Also, I noticed if i set it with a space like this:
current.comments = " ";
There is an additional empty line in the out put, so it outputs:
Comment
Signature
blank line
Comment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 12:47 PM
Another couple of methods came to mind.
Easy:
You could add a string field to your form with the label "comments". Then make the real comments journal field read only. In your before update business rule you can concatenate the contents of the new string field and your signature and put them in the real comments field.
Hard:
Brute force: In an after business rule, you could open the journal record of the most recent comment and add the signature to it.