@BérangèreL thank you for tagging me on this.
Hey @ryanjoconnor & @JKenler ,
happy to help you out here. This should be effortlessly possible with a short custom code workflow action. Since you mentioned Ops Hub you should be able to create one.
I’ve created a short Python script for you. Please let me know if you need help implementing that.
from urllib.parse import urlparse
def main(event):
url = event.get("inputFields").get("url")
parsed_url = urlparse(url)
domain = parsed_url.netloc.split(".")[
-2:
] # Extract the last two parts of the domain
return {
"outputFields": {
"domain": ".".join(domain),
}
}
No matter how the URL looks like, the method urlsparse provides the opportunity to just leave with the domain name and TLD (so. example.com)
Make sure you load the URL you want to adjust as an input field with the name url and provide an output field called domain. After that, you can use the Copy Property Value action to copy the output into another property.
Hope that helps. If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I’d really appreciate it.
Cheers,
Chriso