I have a data extension that contains customers along with a category. In my html content, I want to add the category for the customer IF the customer_id can be found within that data extension. If it can't be found in the data extension then to handle this with default category. To do this I'm using LookupRows. My code and the links work within SF preview and test function but when the email is sent to my inbox and I click on the link in my inbox, it leads to a page with the below error. I've also tried personalisation string, to use redirect only but it doesn't work.
Error:
An error has occurred and has been logged by our system. Thank you.
Here is my FINAL working code:
%%[
VAR @category_name_look_up, @category_link_look_up, @category_url_tracked, @rows, @row, @rowCount, @customer_id
SET @category_name_look_up = Lookup("Customer Data Extension", "category", "customer_id", customer_id)
SET @category_link_look_up = Lookup("Customer Data Extension", "category_link", "customer_id", customer_id)
SET @category_url_tracked = CONCAT(@category_link_look_up,"?utm_source=salesforce&utm_campaign=&utm_term=marhead|default|01")
SET @rows = LookupRows("Customer Data Extension","customer_id", @customer_id)
SET @rowCount = rowcount(@rows)
SET @customer_id = AttributeValue("customer_id")
if @rowCount > 0 then
]%%
<td align="center">
<a href="%%=RedirectTo(@category_url_tracked)=%%">%%=v(@category_name_look_up)=%%</a>
</td>
%%[ELSE]%%
<td align="center">
<a href="https://www.website.com/shop/this_category?utm_source=salesforce&utm_campaign=&utm_term=marhead|default|01">This Category</a>
</td>
%%[ENDIF]%%
%%=RedirectTo(@category_link_look_up)=%%
?