<div dir="ltr">Ok - thank you both for good input!<br><div><br></div><div>:-)</div><img src="https://mail-info-ext.com/pixel/uagTabvG01T1sZikDvta?rid=uagTabvG01T1sZikDvta" width="1" height="1" border="0"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 8 Aug 2022 at 09:34, Martin Allen <<a href="mailto:martin.allen@exe-squared.co.uk">martin.allen@exe-squared.co.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-GB" style="overflow-wrap: break-word;">
<div class="gmail-m_2930382929772422939WordSection1">
<p class="MsoNormal"><span>I’d do as either a custom workflow function (if there are variable conditions to trigger it, that may need to change at a later date ) or an vtiger.entity.aftersave event handler – then would have
 an array mapping the country values e.g.<br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal" style="background:rgb(35,36,37)"><span style="font-size:10pt;font-family:"Courier New";color:rgb(152,118,170);background:rgb(35,37,37)">$mapping
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(207,210,213);background:rgb(35,37,37)">=
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(204,120,50);background:rgb(35,37,37)">array</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">(<br>
   </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(142,167,101);background:rgb(35,37,37)">'US'</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(207,210,213);background:rgb(35,37,37)">=></span><span style="font-size:10pt;font-family:"Courier New";color:rgb(142,167,101);background:rgb(35,37,37)">'United
 States'</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(204,120,50);background:rgb(35,37,37)">,<br>
   </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(142,167,101);background:rgb(35,37,37)">'UK'</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(207,210,213);background:rgb(35,37,37)">=></span><span style="font-size:10pt;font-family:"Courier New";color:rgb(142,167,101);background:rgb(35,37,37)">'United
 Kingdom'<br>
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">)</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(204,120,50);background:rgb(35,37,37)">;<br>
<br>
function </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(114,115,122);background:rgb(35,37,37)">getCountryMapping</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">(</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(152,118,170);background:rgb(35,37,37)">$country</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">){<br>
   </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(204,120,50);background:rgb(35,37,37)">return
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(152,118,170);background:rgb(35,37,37)">$mapping</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">[</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(152,118,170);background:rgb(35,37,37)">$country</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">]
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(207,210,213);background:rgb(35,37,37)">??
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(152,118,170);background:rgb(35,37,37)">$country</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(204,120,50);background:rgb(35,37,37)">;<br>
</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(232,186,54);background:rgb(35,37,37)">}</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(207,210,213)"><u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Then simply populate the array with your expected country mappings. To add a new one later, all you do is add a new entry in your array. We’ve done something similar before were we weren’t able to
 be given an exact list of possible values that an external API would send us, so in this case we extended the getCountryMapping function to record and notify Admins whenever a new value was seen, so they could work out the correct mapping and update the array
 and add the correct mapping.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> <a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a> <<a href="mailto:vtigercrm-developers-bounces@lists.vtigercrm.com" target="_blank">vtigercrm-developers-bounces@lists.vtigercrm.com</a>>
<b>On Behalf Of </b>socialboostdk<br>
<b>Sent:</b> 04 August 2022 21:57<br>
<b>To:</b> <a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a><br>
<b>Subject:</b> [Vtigercrm-developers] Lookup table in Workflow?<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi everyone, <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Hope you're enjoying some summer days ;)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I have a lot (approx 300) of variables that need to be changed (like "US" to "United States", and many others) in a text field across many records as they get added from an external source. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Any ideas on how to do this in a smart way? <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
I can't change it in the source unfortunately.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The only idea I've come up with so far is to make a.. <i>massive</i>.. if-else structure in a workflow, which of course sounds terrible :-)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you in advance for any pointers :)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Cheers,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Chris<u></u><u></u></p>
</div>
<p class="MsoNormal"><img width="1" height="1" style="width: 0.0104in; height: 0.0104in;" id="gmail-m_2930382929772422939_x0000_i1025" src="https://info-mailtracker.com/pixel/phcKRrmWYLeferI3cnjz?rid=phcKRrmWYLeferI3cnjz"><u></u><u></u></p>
</div>
</div>
</div>

_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>