[Vtigercrm-developers] Lookup table in Workflow?

socialboostdk socialboostdk at gmail.com
Fri Aug 5 12:20:34 GMT 2022


Thank you Rubén & Tom for your quick responses!

I ended up making a looooong if/else if/end expression as Tom suggested,
and it actually works :-)

I have a bonus question: Do you have any idea on how to clean a field for
spaces? Ie. if I have a field with contents like " state " (ie. a space on
each side) - do you have any suggestion on how to remove spaces from a
string?

I tried the Preg_replace (preg_replace_str_only('/[ \t]/','',cf_1472)) but
that will not accept me replacing a space with an empty string :-/

Thanks!!


On Fri, 5 Aug 2022 at 00:07, Tom Brown <support at vtexperts.com> wrote:

> Chris,
>
> What about a workflow with an "Update Field" task. I've attached a video
> (watch with sound).
>
> Expression:
> if tt_source == 'US'  then 'United States' else
> if tt_source == 'USA' then 'United States' else
> if tt_source == 'CA'  then 'Canada' else
> if tt_source == 'IT'  then 'Italy' else
> if tt_source == 'ITA' then 'Italy'
> else 'NA' end
>
> Is that what you are looking for?
>
> Thanks
>
>
>
> On Thu, Aug 4, 2022 at 4:32 PM Rubén A. Estrada Orozco <rulotec1 at gmail.com>
> wrote:
>
>> you could use time interval workflows with field update tasks.
>> you could also create an installable module and execute some queries upon
>> installation.
>>
>> Saludos
>>
>> Rubén
>>
>>
>> On Thu, Aug 4, 2022 at 4:01 PM socialboostdk <socialboostdk at gmail.com>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> Hope you're enjoying some summer days ;)
>>>
>>> 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.
>>>
>>> Any ideas on how to do this in a smart way?
>>>
>>> I can't change it in the source unfortunately.
>>>
>>> The only idea I've come up with so far is to make a.. *massive*..
>>> if-else structure in a workflow, which of course sounds terrible :-)
>>>
>>> Thank you in advance for any pointers :)
>>>
>>> Cheers,
>>> Chris
>>> _______________________________________________
>>> http://www.vtiger.com/
>>
>> _______________________________________________
>> http://www.vtiger.com/
>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220805/507f6f23/attachment.html>


More information about the vtigercrm-developers mailing list