need to change rich text label value on change of script

priyanka chodip
Tera Contributor

Hi There,

i have a rich text field and it should populate only when variable erg is selected.
also that rich text should have the selected erg value in it and then populate but its working. i have tried on change client scripts but the result is nill.

priyankachodip_1-1759224891371.png

 



priyankachodip_0-1759224675043.png
please let me know if anyone has any idea how to crack it.

Thankyou
Priyanka.

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@priyanka chodip 

share the client script, seems something wrong in it.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,
below is the client script.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }
   var htmltext = '<div style="font-size:14px; line-height:1.5;"><p>Thank you for joining the <b>' + newValue + '</b>Employee Resource Group!</p><p>We\'re asking our members to provide us with information that will help us plan future events by location, your interests, and ability to support our volunteer initiatives. </p><p>This form will automatically capture your name and email address as it appears on Equitable\'s systems.</p > </div>';

    alert(htmltext);
    g_form.setLabelOf('erg', htmltext);
}


@priyanka chodip 

it's onChange catalog client script right?

try this and share what came in alert

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }

    alert(newValue);
    var htmltext = '<div style="font-size:14px; line-height:1.5;"><p>Thank you for joining the <b>' + newValue + '</b>Employee Resource Group!</p><p>We\'re asking our members to provide us with information that will help us plan future events by location, your interests, and ability to support our volunteer initiatives. </p><p>This form will automatically capture your name and email address as it appears on Equitable\'s systems.</p > </div>';

    alert(htmltext);
    g_form.setValue('erg', htmltext);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

attached the screenshots

priyankachodip_0-1759227277726.png

priyankachodip_1-1759227313365.png

and no change on the form

priyankachodip_2-1759227348381.png