Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to visit url programmatically?

ican
Tera Contributor

I want to visit a website programmatically and get the URL.

Sample:

Visit this website: www.samplesite/12345

Upon visiting website it is possible that the URL will change to this: www.samplesite/12367

 

I want to get the changed website: www.samplesite/12367

 

Thanks in Advance!

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ican 

 

1st , do you want to do this in ServiceNow?

2. If yes, then what is the use case for this?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Use case:

Table

IDNameURL
001Samplewww.sampleurl.com/001

 

In Transform Map, I need to visit that URL and check if the URL did not change.

If the URL changes, I need to get the new URL.

Changed URL: www.sampleurl.com/003

 

Then I need to update the ID to 003 for that record in Transform Map.

 

Thanks!

Samaksh Wani
Giga Sage

Hello @ican 

 

if (window.location.href === "https://www.samplesite/12345") {
    // Redirect the user to the new URL
    window.location.href = "https://www.samplesite/12367";
}

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh