Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Adding an image to table.

coolgirl
Mega Expert

Hello,

              I would like to add an image to a field in the table. I have chosen the field type as Image (the image icon is available in System UI -> Images) and set the business rule, but the image is not getting displayed in the table. Can someone help me how to go about it?

function onDisplay(current, g_scratchpad) {

  var gr = new GlideRecord('u_inventory');

  gr.addQuery('u_product_name',current.u_product_name);

  gr.query();

  while(gr.next()){

  if(gr.u_product_quantity == 0){

                    current.u_availability = "images/star.png";

  }

                            if(gr.u_product_quantity > 0){

                    current.u_availability = "images/pic2.jpg";

  }

  }

}

Thanks,

Sam

6 REPLIES 6

for the list view, you'll need to use field styles (check out the field style on the incident table caller_id field for the Vip flag).


For the vip flag, the script used is current.caller_id.vip == true,may i know where is the .vip method defined. Since in my case I need to compare the value of a field with another table's field.



Thanks,


Sam