Error handling for value not found

Hey all, I was trying to figure out the best way to handle values that are not found. I have a tracking snippet that has one value that does not span across all situations. So I want to set that value to "none" if the value is not declared.

Here’s what I have so far.
{if: SupplementalTracking==""}{addon=(none)}{else}{addon=(SupplementalTracking)}{endif}

1 Like

Hi Peter,

Not sure I fully understand the issue. You can do an {if} statement like you have (the iserror() function is also helpful in these cases).

Are you running into an issue with your approach above?

1 Like

In my example above, my form is resulting with: "[Error - Unknown name "addon"]"

I have one snippet where {SupplementalTracking="tracking tag"} and when that snippet runs I get the correct output. But all the other snippets that use this form that don’t declare {SupplementalTracking} I get the error in my sheet.

1 Like

@Peter_Monterubio, maybe use the catch function? you can set it to give an alternative output in cases where it finds an error. You can learn more about it here: Text Blaze | Formula Reference

Happy to help you integrate it too if you can share the whole snippet with me. As it is, I'm having a hard time understanding exactly how you need it to work.

Thank you! I’ll look into using the catch function. To give a little more background.

we have a form snippet that imports into all of our snippets that sends values that are placed in all of our snippets. Then using the form results we can track specific usage data.

In our form however we have one field that has a value that is only declared in one snippet. So when that snippet runs everything reports fine. However in every other snippet, we get the error that the value is not found. I could go into every snippet and declare {SupplementalTracking=="null"}. But if there were a way to tell the form snippet if {SupplementalTracking} is not found, then write "null".

2 Likes

I love this! I hadn't thought of doing this before, but it's great! Thanks @Peter_Monterubio :slight_smile:

1 Like

It’s really helped us a lot. Normally in Salesforce we can only track and report on our case escalations by type which is pretty limiting. By sending "tags" to a form automatically in TextBlaze we’ve been able to generate granular issue reports and even tie in case numbers and support rep email, so we are able to act on trends real quickly.

2 Likes

I see a lot of valuable uses for this. Thanks again!

1 Like

@Peter_Monterubio

Something like this should work:

{=catch(SupplementalTracking, "")}

If the variable SupplementalTracking hasn't been defined, that command will simply return empty.

1 Like