⚙ Operations Hub

ryanjoconnor
Participant

Formatting Domains using Ops Hub

SOLVE

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 Accepted solution
ChrisoKlepke
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Formatting Domains using Ops Hub

SOLVE

@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

View solution in original post

4 Replies 4
JKenler
Participant

Formatting Domains using Ops Hub

SOLVE

@ryanjoconnor did you ever resolve this? 

BérangèreL
Community Manager
Community Manager

Formatting Domains using Ops Hub

SOLVE

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


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!


ChrisoKlepke
Solution
Key Advisor | Elite Partner
Key Advisor | Elite Partner

Formatting Domains using Ops Hub

SOLVE

@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
Community Manager
Community Manager

Formatting Domains using Ops Hub

SOLVE

Hi @ryanjoconnor 

 

Thank you for reaching out.

 

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

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !