Input parameters to a Script Include question

harinalamalapu
Giga Expert

I am trying to pass an input parameter to a Script Include which is being called from a default value field of a change_request table. Provided below the code used in the default value field, but I noticed that 'current.type' is being passed as empty to Script Include even though the value of the type field is 'Normal' on the form. Why?

javascript:new ABCClientUtils().testFunction(current.type);

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Can you paste the whole code here and the steps to reproduce.


harinalamalapu
Giga Expert

Hi Pradeep,



I created a String field called 'u_test_field' on change_request table and trying to pre-fill with a default value (Ex: in this I am trying to prefill with value of the type field on the Change Request). For that, I created a Script Includes testFunction(type) in ABCClientUtils.



The sample code i tried here is   here:


testFunction : function(type) {


    return type;


  },



The code used in the default value is this: javascript:new ABCClientUtils().testFunction(current.type);


harinalamalapu
Giga Expert

Hi Pradeep,



To add more details, I launch a change request from a record producer where I select a change type as 'Normal', fill various other basic details and submit the change request from record producer.


Now the a change record is created and launched it in the platform. At this point, I am trying to see the default value that I configured for the u_test_field. but the default value is coming as blank.


Hi Hari,



Does the change request created has the field set to type "Normal"?