Need to unlock URL field on catalog form

Ashwini_ Godala
Tera Contributor

I have a requirement to unlock the URL field on form load in portal. I tried using https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0815270. But click function is throwing Javascript console error. I need this requirement only for one catalog item. Is there a way to unlock URL field in portal?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Ashwini_ Godala 

this worked for me in portal; I hope you can enhance it further as per your requirement

Ensure you keep Isolate Script= False for your onLoad catalog client script and set UI Type= Portal

function onLoad() {

    setTimeout(function() {

		var variableName = "my_url"; // give your variable name here

        var inputTag = this.document.getElementById("sp_formfield_" + variableName + "_unlock");
        inputTag.click();
    }, 3000);

}

Output:

url unlock.gif

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Ashwini_ Godala 

this worked for me in portal; I hope you can enhance it further as per your requirement

Ensure you keep Isolate Script= False for your onLoad catalog client script and set UI Type= Portal

function onLoad() {

    setTimeout(function() {

		var variableName = "my_url"; // give your variable name here

        var inputTag = this.document.getElementById("sp_formfield_" + variableName + "_unlock");
        inputTag.click();
    }, 3000);

}

Output:

url unlock.gif

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