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 

that link seems for native and not for portal.

did you try setting the property to true?

'Unlock empty URL fields on form load' (glide.ui.unlock_empty_url)

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

Ashwini_ Godala
Tera Contributor

Hi @Ankur Bawiskar ,

Thank you for the response. 

Yes I tried by activating that property its working fine, but I don't want to apply this changes for all the other catalogs.

Can you help me with this?

 

Thanks,

Ashwini.

@Ashwini_ Godala 

I shared solution below; check that

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Ashwini_ Godala 

seems that property only works for classic and not for portal

you might have to use DOM manipulation there

 

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