Hey I want to copy the value of "First touch converting campaign"(which is the field created by HubSpot) property but NOT its internal value. (ex. Linkedin instead of 092acc99-cdf1-4ad5-a0bb-7b57cf3d9a2a) Is there a way to do this with Set Property action, Custom Code or smth else? Thanks
Hey @akrus, I can advise it via custom code, with the most similar example.
See the example of function in JavaScript that extracts the visible value for the "country" property:
function getVisibleCountry(internalValue) { switch (internalValue) { case "us": return "United States"; case "ca": return "Canada"; case "mx": return "Mexico"; default: return internalValue; } }
And in this example, the function takes in the internal value for the "country" property and returns the corresponding visible value. If the internal value is not found in the lookup table, the function returns the internal value as is.
You can then use this function to extract the visible value for each record in your HubSpot account. Here's an example of how you might use this function to retrieve the visible country value for a set of contacts:
// Get the contacts from HubSpot const contacts = await hubspot.contacts.get();
// Loop through the contacts and extract the visible country value const visibleCountries = contacts.map(contact => { const internalValue = contact.properties.country.internalValue; const visibleValue = getVisibleCountry(internalValue); return visibleValue; });
console.log(visibleCountries);
Hope this help! Try with this same and let me know if this dosen't work.
Hey @akrus, I can advise it via custom code, with the most similar example.
See the example of function in JavaScript that extracts the visible value for the "country" property:
function getVisibleCountry(internalValue) { switch (internalValue) { case "us": return "United States"; case "ca": return "Canada"; case "mx": return "Mexico"; default: return internalValue; } }
And in this example, the function takes in the internal value for the "country" property and returns the corresponding visible value. If the internal value is not found in the lookup table, the function returns the internal value as is.
You can then use this function to extract the visible value for each record in your HubSpot account. Here's an example of how you might use this function to retrieve the visible country value for a set of contacts:
// Get the contacts from HubSpot const contacts = await hubspot.contacts.get();
// Loop through the contacts and extract the visible country value const visibleCountries = contacts.map(contact => { const internalValue = contact.properties.country.internalValue; const visibleValue = getVisibleCountry(internalValue); return visibleValue; });
console.log(visibleCountries);
Hope this help! Try with this same and let me know if this dosen't work.
Oh, okay, and this is the only way to do it, right? Whenever we get a new value for the record, we should go here and add it to our code, yeah? Is there no possibility of doing it once for whatever value? Thanks
Yes, it is possible to set "First touch converting campaign" instead of its internal value using the "Set Property" action in HubSpot workflows.
I would suggest, You can achieve this by using the "Copy Property Value" action in the workflow, which allows you to copy the visible value of a property to another property by following some below steps:
In the workflow, add a "Set Property" action and choose the property you want to copy the value to.
In the "Value" field of the "Set Property" action, click the "Insert a Property" button and select the "Copy Property Value" option.
In the "Copy Property Value" dialog box, select the property you want to copy the value from (in this case, "First touch converting campaign") and click "Insert".
Save the workflow.
When you will trigger the workflow, the value of the selected property will be copied to the new property, but the visible value will be used instead of the internal value.
And keep remember one this, this method will only work if the visible value is unique and consistent across all records. If the visible value is different for different records, you may need to use a custom code solution to extract the visible value from the internal value.
Hey @Syeda_Fatima I am thankful for the provided solution, but it seems that we do have a different value for different records, so it doesn't work. Could you advise how I can extract the visible value from the internal value with custom code? Thanks in advance