Drop Down Value Shows the Key and not Display Value

Hey Guys,

We are trying to have a drop down value on a lead be transferred to a text field on an account during lead conversion. Our code is written below. Naics_sector is the account field and industry_sector is the drop down field on the lead. The conversion works, but only the drop down key is being brought into the text field and not the actually display value. How can we get the display value of the drop down brought into the text field? Thanks!

'fieldMapping' =>
array (

'naics_sector_c' => 'industry_sector_c',

  • Hi Dan Petersen 

    Lead Conversion will copy the field value as it is, so you would need to create another field in Accounts (dropdown whose dropdown list is the same as in Leads) and copy from industry_sector_c in Leads to that custom field.

    At last you can implement the SugarLogic formula "getDropdownValue" in the field naics_sector_c at Accounts which set the value according to value defined in the custom field.

    Eventually this dropdwn custom field in Accounts should not be available in layouts.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks Andre,

    The problem is that the industry_sector on the lead is a best guess, after a lead is converted to an account AND business is written then an actual NAICS code will be populated overwriting the industry sector. Guess we will have to find another way.

  • I'm afraid I didn't did myself clear.

    As per my suggestion the metadata in Leads conversion would be something like that:

    'fieldMapping' => 
    array (

    'industry_sector_c' => 'industry_sector_c',

    Where industry_sector_c is another custom dropdown field in Accounts whose list follow the same own in Leads.

    The text field naics_sector_c in Accounts would get a SugarLogic formula like that:

    getDropdownValue("dropdown_list", $industry_sector_c)

    You can do that through Studio.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • The text field still needs to be editable so we can import text into it that is not contained in the drop down field. So if we use getDropdownValue then the field is calculated and not editable then correct?

  • You can setup a field as calculated and editable at the same time. You just need to edit the custom/Extension/modules/<Module>/Ext/Vardefs/sugarfield_<field>.php and update the attribute 'enforced' to false.

    Additionally you will need to modify the SugarLogic Formula in order to only calculate it if the field is empty:

    ifElse(

       not(isInList(getDropdownValueSet("dropdown_list"), $naics_sector_c)),

       $naics_sector_c,

       getDropdownValue("dropdown_list", $industry_sector_c)

    )

    Run QRR after saving the file.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • This worked perfect, only question I have is why do we have to update the SugarLogic Formula. It currently only calculates only when the field is blank with only getDropdownValue("dropdown_list",$industry_sector_c)

  • I have considered updating the SugarLogic formula because I have no the big picture of such feature, so I tried to provide an explanation as complete as possible.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks, this is working perfectly now!

  • Just wanted to add my experience and solution in case it helps, just to add to the excellent info above:

    This was to get a dropdown value from a field on a related module:

    From this solution

    And our specific formula in the new text field:

    getDropdownValue("status_list",related($r_rma_l_loan_1,"status"))