Need to display link on change form

Shreya Sinha1
Tera Contributor

Hi Team,

My requirement is to display a link on form so that user can click on that and it will redirect to another page.

I tried with "url "field type and i have provided the link in default value which i need to show on form.but field is coming but not the link.

Another way I thought to use annotation in slush bucket, but that is not visible.

find_real_file.pngCould you please help me on this.

Regards,

Shreya Sinha

find_real_file.png

 

 

6 REPLIES 6

chrisperry
Giga Sage

What is the default value you provided for the field?

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Hi Christ,

I have provided thelink which needs to be display.

Hi Shreya, Go through below thread it may helps you https://community.servicenow.com/community?id=community_question&sys_id=2b60b851db8e2300fa192183ca9619df

Chetan Mahajan
Kilo Sage
Kilo Sage

Hi Neha,

                       I would say add 1 checkbox, when user click on that checkbox it will redirect to particular link, you need to create onChnage() client script. Ref below script 

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

    var Type = g_form.getValue('type'); // you can remove if block
    if (Type == 'true') {
        var gURL = this.location.href;
        var pathname = new URL(gURL).pathname;
        var redirectURL = pathname + '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=6f76071edb5320507cc7a334ca9619bd';
        top.window.location = redirectURL;
        return 'yes';
    } else {
        return 'no';
    }
}
//Type appropriate comment here, and begin script below

// This script is you if you are using instance url so it will take autmatically current
// instace. means if you move this code from other environment you need not worry to chnage url every time OR you can directly set some URL in Redirect URL

 

Let me know if you face any issue here

Kindly mark correct and helpful if applicable