0

Hope you're well and having a great day!

I'm working through a communication to our contacts that are experiencing shipping delays due to supply chain issues with our supplier. Though we're pulling our contact data from two Sales Cloud objects; Opportunity and WorkOrder. I've had to resolve an issue where the Opportunity (Classic sign-ups) contains a product code and name but not one we can surface to the customer (Product_Commercial_Name) which is present on the Work Order (our Lightning-based sign-ups). To get around this, I've created a reference Data Extension with the required SKU information which I was hoping to look up and print in the email i.e. your %%=v(@incentiveName)%% is delayed...

Here's my AMPscript:

%%[
var @classicIncentive, @productName, @incentiveName, @lightningSignUp

SET @lightningSignUp = WorkOrder_Id

IF EMPTY(@lightningSignUp) THEN
  SET @classicIncentive = '1'
ENDIF

IF @classicIncentive == '1' THEN
  SET @productName = Product_Commercial_Name__c
  SET @incentiveName = Lookup("Classic Incentive SKU Table","Product_Code","Product_Name",@productName)
ELSE 
  SET @incentiveName = Product_Commercial_Name__c
ENDIF]%%

The reference data extension contains three columns:

  • Product_Name
  • Product_Code
  • Product_Commercial_Name

I was hoping to pul the Product_Commercial_Name value for Classic sign-ups. BUT I'm having trouble getting my lookup function to work (it's probably just me being a newb). I've reviewed the following resources to try to get it sorted but no luck just yet:

Any help would be greatly appreciated.

2
  • Can you share the error you are recieving? Jun 11 '21 at 10:45
  • Hey @Gortonington, no validation errors, I was just unable to print the desired information into the email. Using Adam's script, I've been able to find and sort the error of my ways. Jun 11 '21 at 21:53
2

I'd suggest adding some debugging output -- in addition to wrapping your personalization strings in AttributeValue.

%%[ 

SET @WorkOrder_Id = AttributeValue("WorkOrder_Id")

output(concat("<br>WorkOrder_Id: ", @WorkOrder_Id))

IF EMPTY(@WorkOrder_Id) THEN
  SET @classicIncentive = '1'
ENDIF

output(concat("<br>classicIncentive: ", @classicIncentive))

IF @classicIncentive == '1' THEN

  SET @productName = AttributeValue("Product_Commercial_Name__c")
  output(concat("<br>productName: ", @productName))

  SET @incentiveName = Lookup("Classic Incentive SKU Table","Product_Code","Product_Name", @productName)
ELSE 
  SET @incentiveName = AttributeValue("Product_Commercial_Name__c")
ENDIF

output(concat("<br>incentiveName: ", @incentiveName))

]%%

What output do you get if you add those statements?

1
  • Hey Adam, thank you for the above. Successfully returned the Product_Code using your script above. To get the desired field, I updated the look up to: SET @incentiveName = Lookup("Classic Incentive SKU Table","Product_Commercial_Name","Product_Name", @productName) All working as expected now. Thank you very much for your help here. Jun 11 '21 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.