APIs & Integrations

JMair
Participant | Gold Partner
Participant | Gold Partner

File Property doesn't return a "splitable" string

Hey everyone,

 

we are facing a rather comical issue ...

We have a contact property "trialkey" which is setup as a file-property. In this property we want to upload key-files for a trial.

This key we want to link from within an e-mail.

Pretty easy use-case: use HUBL to read the value of the property. Use a split function and retrieve the friendly URL.
As it happens when we try to do a "|split(";")" on the contact.trialkey it creates only a single object. Running a type(contact.trialkey) returns "str".

So we are facing the probem that it seems that the split function doesn't work on a file-property object which by type-check returns string ... 😕

 

Code:

Trialkey: {{ contact.trialkey }} <br/>
Trialkey type: {{ type(contact.trialkey) }} <br/>
Trialkey split: {{ contact.trialkey|split(";") }} <br/>

 

Output:

Trialkey: 218776940784;218832948439
Trialkey type: str
Trialkey split: [218776940784;218832948439]

 

Is this a bug or are we missing something here?

0 Upvotes
2 Replies 2
JMair
Participant | Gold Partner
Participant | Gold Partner

File Property doesn't return a "splitable" string

Hi,

thanks for your reply!


I tried it with a form upload. Now we dont get returned a semicolon seperated string. Now we only have an URL in the field. When trying to retrieve the ID from the URL by doing a split on "?" we have the same result as above.

 

Code: 

Trialkey: {{ contact.trialkey }} <br/>
Trialkey type: {{ type(contact.trialkey) }} <br/>
Trialkey split: {{ contact.trialkey|split("?") }} <br/>

 

Output:
Trialkey: https://api-eu1.hubspot.com/form-integrations/v1/uploaded-files/signed-url-redirect/219498572018?por...
Trialkey type: str
Trialkey split: [https://api-eu1.hubspot.com/form-integrations/v1/uploaded-files/signed-url-redirect/219498572018?por...]

 

I am kinda lost here as it doesn't make sense that the split function just isn't doing what it is supposed to do. If it was a type-mismatch .... okay but Hubl returns the type "str" for the field and by that - from my understanding - the split function should be applicable.

0 Upvotes
FarioConsulting
Top Contributor

File Property doesn't return a "splitable" string

Hi,

 

This issue might stem from how the file property is handled when it doesn't contain an uploaded file via a form.
FYI In such cases, it defaults to a single-line text property. This may be the reason as to why the type() function returns "str" and the split() function doesn't behave as expected

 

Cheers,
Harsh
Fario Consulting