⚙ Operations Hub

ryanjoconnor
参加者

Formatting Domains using Ops Hub

解決

I've upgraded to Ops Hub and want to understand the best way to clean up / format domains when they're submitted via form.

 

For context, we have several custom objects created via forms, and the domain seems to be the best feild to associate them all (pls correct if I'm mistaken here). That said, folks will submit domains that slightly differ than what HS has on file at the Company level, (ex: including or excluding http://) so I need to make everything uniform arross the board. 

 

What is the best way to do this using the Format function in Ops Hub? 

1件の承認済みベストアンサー
ChrisoKlepke
解決策
キーアドバイザー | Elite Partner
キーアドバイザー | Elite Partner

Formatting Domains using Ops Hub

解決

@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

元の投稿で解決策を見る

4件の返信
JKenler
参加者

Formatting Domains using Ops Hub

解決

@ryanjoconnor did you ever resolve this? 

BérangèreL
コミュニティーマネージャー
コミュニティーマネージャー

Formatting Domains using Ops Hub

解決

Hi @JKenler, I hope that you are well!

First, I'd like to share these articles that might be of interest to you:

Format your data with workflows
Custom Formula Functions

I'd like to ask our top experts about some tips they may have: Hi @Teun@louischausse and @ChrisoKlepke can you share information to help @JKenler, please?

Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂

Thank you 🌟 and have a lovely day!

Best,
Bérangère


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres! !
ChrisoKlepke
解決策
キーアドバイザー | Elite Partner
キーアドバイザー | Elite Partner

Formatting Domains using Ops Hub

解決

@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

TitiCuisset
コミュニティーマネージャー
コミュニティーマネージャー

Formatting Domains using Ops Hub

解決

Hi @ryanjoconnor 

 

Thank you for reaching out.

 

I want to tag some of our experts here - @LMeert @Jonno_Price @crispyGTM do you have any thoughts for @ryanjoconnor on this?

 

Thank you!

Best

Tiphaine


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.