<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get a dropdown property label instead of value in a workflow in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/1091209#M79322</link>
    <description>&lt;P&gt;Hey!&amp;nbsp;&lt;BR /&gt;Did you find a working Solution to this?&lt;BR /&gt;I am trying to do the same&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2025 13:56:14 GMT</pubDate>
    <dc:creator>FSiddiqui8</dc:creator>
    <dc:date>2025-01-08T13:56:14Z</dc:date>
    <item>
      <title>Get a dropdown property label instead of value in a workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/807733#M64915</link>
      <description>&lt;P class=""&gt;Hi,&lt;BR /&gt;I have a workflow with a custom code action, and I'm using the following line to add a contact's property to the custom code — &amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;user_type = event.get('inputFields').get(‘user_’type)&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;The user type property is a dropdown-type property, with a label and a value (For example a Lead label with a value of 0).&lt;/P&gt;&lt;P class=""&gt;The code line above returns the property value (0), is there any way to get the property’s label (Lead) instead, or do I need to convert all the property's values in the code manually?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 09:23:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/807733#M64915</guid>
      <dc:creator>NVersano</dc:creator>
      <dc:date>2023-06-15T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get a dropdown property label instead of value in a workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/807755#M64922</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/580577"&gt;@NVersano&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Way to get the property's label instead of the value in a workflow custom code action. By this code&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;user_type = event.get('inputFields').get('user_type').label
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;It will&amp;nbsp;return the label of the user_type property, which in your example is "Lead".&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;use this code in a workflow custom code action.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function myCustomCodeAction(event, context) {
  // Get the user_type property label
  var user_type = event.get('inputFields').get('user_type').label;

  // Do something with the user_type label
  // For example, you could send an email to the contact with their user_type label
  var emailSubject = "Your user type is " + user_type;
  var emailBody = "You are currently a " + user_type + " in our system.";
  context.createEmail(emailSubject, emailBody);
}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 09:57:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/807755#M64922</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2023-06-15T09:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get a dropdown property label instead of value in a workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/808021#M64935</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/20405"&gt;@himanshurauthan&lt;/a&gt;, thanks for replying.&lt;BR /&gt;I use phyton in the custom code action,&amp;nbsp; when adding the code you suggested I get an error -&amp;nbsp;&lt;BR /&gt;[ERROR] AttributeError: 'str' object has no attribute 'label'&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "/var/task/hubspotHandler.py", line 4, in hubspot_handler&lt;BR /&gt;return file.main(event)&lt;BR /&gt;File "/var/task/file.py", line 13, in main&lt;BR /&gt;user_type = event.get('inputFields').get('usertype').label&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 17:50:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/808021#M64935</guid>
      <dc:creator>NVersano</dc:creator>
      <dc:date>2023-06-15T17:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get a dropdown property label instead of value in a workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/808822#M65001</link>
      <description>&lt;P&gt;Sorry, I accidently replied to the post instead of your comment.&lt;BR /&gt;&lt;SPAN&gt;I use phyton in the custom code action,&amp;nbsp; when adding the code you suggested I get an error -&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ERROR] AttributeError: 'str' object has no attribute 'label'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;File "/var/task/hubspotHandler.py", line 4, in hubspot_handler&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return file.main(event)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;File "/var/task/file.py", line 13, in main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;user_type = event.get('inputFields').get('usertype').label&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jun 2023 15:53:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/808822#M65001</guid>
      <dc:creator>NVersano</dc:creator>
      <dc:date>2023-06-18T15:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get a dropdown property label instead of value in a workflow</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/1091209#M79322</link>
      <description>&lt;P&gt;Hey!&amp;nbsp;&lt;BR /&gt;Did you find a working Solution to this?&lt;BR /&gt;I am trying to do the same&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 13:56:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-a-dropdown-property-label-instead-of-value-in-a-workflow/m-p/1091209#M79322</guid>
      <dc:creator>FSiddiqui8</dc:creator>
      <dc:date>2025-01-08T13:56:14Z</dc:date>
    </item>
  </channel>
</rss>

