Default work note

inatherese
Kilo Expert

Hi,

I want the "work notes" - field to be the default view when viewing a ticket (instead of the "Additional Comments"- field showing), so it will look like this:

find_real_file.png

I found a record in the dictionary called "Work notes" on the task table, and tried setting this to default value "true". Then I get the desired result when viewing a ticket, but not when creating a new one. It then shows both the "Additional Comments" and the "Work notes"-field, and it says "true" in the "Work Notes"-field. I belive the original behavior is both of the fields showing like this, but of course not showing the "true" statement in the "Work notes"-field.

find_real_file.png

Anyone got an idea as to how I can default show the "work notes" (work notes = ticked) instead of the additional comments? It would be OK for both fields showing on a new ticket as well, but I would not want to see "true" in the work notes - field.

Thanks in advance!

1 ACCEPTED SOLUTION

Hi Ina,



Look what I found... Two user preferences that do what you want... you can make these a single field or expand them to show both. You can default to work notes too!



find_real_file.png



I just changed mine on incident and noted the changes in sys_user_preferences. If you want make those the default for people, just remove the user name and change the System field to true (checked) and insert&save the new record. It doesn't prevent people from changing it to the way they want (collapsed and comments first), but it gives you a default for noobs.



Let me know if you need more help or if that answers your question.


View solution in original post

39 REPLIES 39

Care to share your solution?



I am wrestling with the same problem and due the fact that 'glide.ui.incident.stream_input' is created every time a user changes this value, I have not been able to find a solution working with ACLs (" Note that a create ACL with a condition that a field contain a specific value always evaluates as false, as fields on new records are considered empty until saved.").



Best regards,


Andreas Larsson


So, here is what I have learned. You can deny creation of additional preferences, so the default upon opening a record matches the system preferences you have defined. For conversation sake, let's say you have set the default to show work_notes. When you enter a new record (one that you haven't been in before) work_notes will display first 100% of the time. However, if you switch to comments and update that record, when you re-enter it the comments will be displayed. I haven't figured out what is causing that. I can confirm that there have been no additional user preferences written.



Screen Shot 2017-01-03 at 10.40.11 AM.pngScreen Shot 2017-01-03 at 10.40.39 AM.png


gs.getUserId() is not a function.



gs.getUserID() is - it returns a sys_id, which means myUser.hasRole('admin') is not going to work (even if you got the right function.)



I think what you are after is:



var myUser = gs.getUser();



if (!myUser.hasRole('admin'))



or combined in one



if (!gs.getUser().hasRole('admin'))


Any insight as to why there seems to still be a preference even though there is no record written on the sys_user_preference table? I did fix the code as you suggested...



(function executeRule(current, previous /*null when async*/) {




  // Add your code here


  var myUser = gs.getUser();


if (!myUser.hasRole('admin')){


  current.setAbortAction(true);


}


})(current, previous);


Is it using a system/global preference?