I'm trying to send out emails related to opportunities but the emails don't include the Opportunity's currency, only the amount.
I'm trying to send out emails related to opportunities but the emails don't include the Opportunity's currency, only the amount.
Hi Avi,
If you are doing this via Process Email Templates with Sugar BPM you might be hitting the Defect #75523
If that's the case I believe it can be worked around by creating a calculated field to show the record currency symbol with the following formula:
ifElse(equal($currency_id, "-99"),"$", related($currencies, "symbol"))
Unfortunately, we can't add it in Studio because SugarLogic will not allow saving the field "currency_id".
So this has to be accomplished via module loader adding to the vardef directly, on this example for the Opportunities module:
/Custom/Extension/modules/Opportunities/Ext/Vardefs/sugarfield_currency_symbol_c.php
<?php $dictionary['Opportunity']['fields']['currency_symbol_c']['labelValue']='Currency Symbol'; $dictionary['Opportunity']['fields']['currency_symbol_c']['full_text_search']=array ( 'enabled' => '0', 'boost' => '1', 'searchable' => false, ); $dictionary['Opportunity']['fields']['currency_symbol_c']['calculated']='1'; $dictionary['Opportunity']['fields']['currency_symbol_c']['formula']='ifElse(equal($currency_id, "-99"),"$", related($currencies, "symbol"))'; $dictionary['Opportunity']['fields']['currency_symbol_c']['enforced']=''; $dictionary['Opportunity']['fields']['currency_symbol_c']['dependency']=''; $dictionary['Opportunity']['fields']['currency_symbol_c']['required_formula']=''; $dictionary['Opportunity']['fields']['currency_symbol_c']['readonly_formula']=''; ?>
After adding it, we can use the new field in the Process Email Templates adding it next to the value fields.
I've attached an example package that adds this field to the Opportunities module.
Can you test if this works for your scenario?
Hi Andre,
That's really helpful and almost does the trick. How would the code need to be changed to show the currency name. This would be ideal when you have multiple countries that use the same currency symbol.
Thank you.
Hi Andre,
That's really helpful and almost does the trick. How would the code need to be changed to show the currency name. This would be ideal when you have multiple countries that use the same currency symbol.
Thank you.
Hi Avi,
Just change the name of the field that you are retrieving from the Currencies module and you should be able to do it.
If you want to get the iso4217 you can do it with this formula:
ifElse(equal($currency_id, "-99"),"USD", related($currencies, "iso4217"))
But again, this change needs to be done directly in the vardef.