Set Rich Text Value in client script

Peter Xiang
Tera Expert

Hi Everyone,

I want to use client script to modify the rich text value in the Rich Text lanel type. Does anyone know how to implement it?

find_real_file.png

19 REPLIES 19

Hi,

then in that case you should be having Catalog Client Script.

can you share the complete script you are trying and what you want to achieve

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

DirkRedeker
Mega Sage

Hi

As your field seems to be a CatalogVariable, please refer to the solved Community Article below an how to access Catalog Variables from Client Scripts:

https://community.servicenow.com/community?id=community_question&sys_id=f2438fe1dbd8dbc01dcaf3231f96...

g_form.setReadOnly('variables.VARIABLENAME', true);

Let me know if that answers your question and mark my answer as correct and helpful.

BR

Dirk

Hi,

Yes, this is CatalogVariable, type is rich text label, name is banner, but i used g_form.setValue("banner"), g_form.setValue("bnnder.rich_text") and g_form.setValue("rich_texk"), none of these approaches will work. I used g_form.getValue("banner") and g_form.getValue("banner"), they both equal to empty string.

Hi

WHat about 

g_form.setValue('variables.banner','Some Value');

Let me know if that answers your question and mark my answer as correct and helpful.

Enjoy & BR

Dirk

Hi,

Unfortunately, I just failed using this function.