If short description is changed, how do I take the original short description content and move it to the activity log?

rev
Kilo Contributor

As the title states, I would like to know how to put the original short description contents into the activity log is changed, after the short description is changed on an Incident form. I'm new to Service Now and   have a few ideas about how to go about this so far, but I feel lost.

Here's what I'm considering so far.

1. Create a Client Script that contains an onChange() function. The problem is that I'm not quite sure how to specifically target Short Description with the Client Script. I'd like to compare oldValue to newValue, and then if theyre not equal, add oldValue to Activity Log. However, the UI of Service Now and its options confuse me alot, but how would Service Now know I only want this to apply to Short Description so that oldValue always equals the orginal version of Short Description? So as a result, I'm afraid Service Now would write the original contents of all changed fields to the activity log.

2. UI Policy

Figured I could create a condition to check if Short Description is changed, and if so put the original contents into activity log. The problem here though is that there is no implementation of oldValue(), so how would I retrieve it?

3.Business Rule

Same deal as UI Policy, however I'm even more unfamiliar with Business Rules.

Any links to articles or suggestions that could point me in the right direction would be greatly appreciated.

Thanks!

1 ACCEPTED SOLUTION

arpitt
Tera Expert

Hi Rev,



The best way is to personalize the activities.



configu.jpg


and bring the short description field into the Selected values:



con.jpg



Regards,


Arpit


View solution in original post

8 REPLIES 8

bernyalvarado
Mega Sage

Hi Rev, the best way of doing this is through a business rule, although the client script is also a good option. i will write for you the script in few minutes.



Thanks,


Berny


Hi, try this on your business rule:




Condition:


Short Description changes



Type


OnBefore and Update type of business rule



Script: (Make sure you have checked Advanced to see the Script section)


function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.


      current.comments = 'Short description has changed. Previous value was:' + previous.short_description;


   


}



Thanks,


Berny


Thanks for helping out with this Berny. I looked over the script and the options you listed and it all makes sense now.



Thanks abunch


Deepak Ingale1
Mega Sage

I guess this can also be done with activity formatters


http://wiki.servicenow.com/index.php?title=Activity_Formatter#gsc.tab=0



You will need to add short description field in activity formatter property.