Skip to content

Check contact attributes is the empty string

0

Trying to check if the contact attribute returned by Lambda is empty or not. I tried Equals "" and Equals '' but it didn't work. Is it possible w/o invoking any additional lambda? Thanks in advance

asked a year ago638 views

4 Answers
0

Checking for empty contact attributes in Amazon Connect requires special handling since an empty attribute has a value of an empty string ("") in the contact flow which cannot be directly checked against. Currently, there is no direct way to check if an attribute is empty or non-existent using the Check Contact Attributes block without invoking a Lambda function.

The recommended workaround is to use a Lambda function to check for the attributes. When using Lambda functions with contact attributes, it's important to note that any attribute returned from an AWS Lambda function is overwritten when invoking any other Lambda function. To preserve these attributes for later use in the flow, they should be stored as user-defined attributes.

To reference attributes later in a flow, you can:

  1. Select External for the Type and enter the key name returned from the Lambda function in the Attribute field
  2. Select User Defined for the Type and enter the name specified as the Destination key in the Set contact attributes block

Reference

[1] Store a value from a Lambda functions as a contact attribute in Amazon Connect

AWS
EXPERT

answered a year ago

0

thank you. I use lambda for this

answered a year ago

0

I recently learned this trick. To check if an attribute is null. Do an attribute check against an attribute that doesn't exist. user defined.myrealattribute Equals $.Attributes.DoesNotExist.

david

answered a year ago

-1

In Amazon Connect, checking if a contact attribute is empty or NULL directly through the "Check contact attributes" flow block has limitations. According to the documentation, to check for a NULL value, you need to use a Lambda function.

The "Check contact attributes" flow block allows you to check conditions like $.Attributes.verificationCode against specific values, but it doesn't have built-in functionality to check if an attribute is empty or NULL without using Lambda.

If you're trying to check if a contact attribute returned by a Lambda is empty, and the direct comparison with empty strings ("" or '') isn't working, you would need to use another Lambda function to perform this check. There isn't a native way in the "Check contact attributes" block to determine if a value is NULL or empty without using Lambda.

As a workaround, you might consider having your original Lambda function set a specific flag or value when the attribute would be empty, which you could then check for using the standard comparison operators in the "Check contact attributes" block.
Sources
Flow block in Amazon Connect: Check contact attributes - Amazon Connect
Looking for Guidance on Amazon Connect Attributes | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.