to set the value of "source code" of rich text label type variable in catalog item background script

Sachin Gavhane
Giga Guru

I want to insert image in rich text label type variable of the catalog item from sys_attachment table dynamically.

I want to set the value of the source code of that variable using background script.

can someone help me with the script

note i want to set the value of the source code of the rich text label variable

 

SachinGavhane_0-1701340451106.png

 

1 REPLY 1

Muhammad Hamza
Kilo Sage

Hey @Sachin Gavhane,

 

Go to System UI > Images

Create an image here with a unique name to it:

MuhammadHamza_1-1701354789035.png

Copy the HTML block.

The following code can be used to add an image to the Rich Text field.

var gr = new GlideRecord("sc_cat_item_producer");  // Your Table name
gr.get("68ba064e472031107e2d0178c26d439a"); // Specific Record
gr.description += "<img src='image_1.png' width='400' height='400'/>";
gr.update();

This approach can be used to attach the image in the Rich text field.

 

Kindly appreciate the efforts of community contributors by marking appropriate response as the correct solution and helpful, this may help other community users to follow the right solution in the future.

Thanks,

Hamza