Populate Short Description Field On Incident Form

snow7
Kilo Contributor

Hi Guys,

I want to populate some text filled in Short Description Field on Incident Form for a particular user.Let me know how to achieve this through client script

14 REPLIES 14

What you can do is -- Create a client callable Script Include and call it in Client script through GlideAjax.



Its not recommended to use GlideRecord in Client script so we can take this approach.


http://wiki.servicenow.com/index.php%3Ftitle%3DGlideAjax&sa=U&ved=0ahUKEwjP4Kjh_KbVAhXHw7wK…


Yeah i agree with it but i want to know where can I use GlideRecord in ServiceNow for insert,update,delete..


Dave Smith1
ServiceNow Employee
ServiceNow Employee

Gourav Das wrote:



Let me know how to achieve this through client script


Does it need to be a client script?



UI Policies could help, as could templates here.   But you may want to build it as a business rule.


saisowmya
Giga Expert

Hi Gourav,



1. If your question is to populate short description for only particular roled user then you can use below code.



Lets say you want the short description to be "Test" only for ITIL users then create an onload client script and use below code.



function onLoad(){


    var userRole = g_user.hasRole('itil');


    if (userRole)


{


g_form.setValue('short_description','Test');


}


 


}




2. Or if your question is to change the short description for the old incidents and for particular roles users, then you need to use a background script which checks for the user and updates multiple incident records.


snow7
Kilo Contributor

Script please can you provide here so that it will be helpful for me further.