Search code examples
zapier

Conditional value in Zapier


I am using Zapier to write an email based on a field.

I have a field that has two values "ig" and "fb". I'd like to replace them respectively by "Instagram" and "Facebook".

Screenshot of Zapier interface


Solution

  • David here, from the Zapier Platform team.

    There are two main ways to do that:

    1. You can write a simple code block that, given ig or fb as input, return the full value you want to use
    2. If you're not comfortable writing code, you can instead use a "Lookup Table" in "Formatter by Zapier", which produces a similar result. There's a step-by-step for that here: https://zapier.com/apps/formatter/help#using-the-lookup-table

    Lookup table basic example. This is the same basic functionality as a lookup table

    // inputData is set up in the UI
    
    const table = {
      ig: 'Instagram',
      fb: 'Facebook'
    }
    
    return {result: table[inputData.someFieldName] || 'Default Value'}