The {{Mobile Fax Info}} field gets its data from a JavaScript function in Zapier that checks if mobile phone and fax numbers were provided (both are optional). Here’s my current script:
When both mobile and fax fields are empty, I want the template to render cleanly without the placeholder. Instead of showing a clean result, the placeholder text {{Mobile Fax Info}} appears in the final output. What’s the best way to make this field completely disappear when there’s no data to display?
You’re hitting a classic Google Slides quirk - it doesn’t actually remove placeholders when they get null values, just leaves them sitting there. I dealt with this exact thing building a certificate system last year. Your JavaScript looks fine, but try returning an empty string instead of null when there’s no data. Change that final else to contactInfo = ''; instead of contactInfo = null;. The placeholder should disappear completely during the merge. If that doesn’t work, you might need to handle it on the Google Slides side - either set up conditional formatting rules or use Apps Script to clean up any leftover placeholder text afterward. The empty string fix worked for me most of the time though.
Had this exact problem a few months back with document automation. Google Slides handles null values inconsistently during template replacement. Instead of returning null in your else condition, return a single space: contactInfo = ' ';. This forces Google Slides to see there’s content to replace, but the space won’t show in the final output. Works way better than empty strings - some Google Slides versions still show the placeholder brackets when values are completely empty. Also check your Zapier step config. Make sure field mapping passes the actual output value instead of falling back to literal placeholder text when the result’s null.
Same issue here with invoice automation. Zapier sometimes sends undefined instead of null, and Google Slides handles them differently. Add contactInfo = contactInfo || ''; right before your output line - it’ll catch undefined values and convert them to empty strings. Also double-check that your Google Slides placeholder matches exactly (case-sensitive).