You first need to lookup those values from somewhere and judging by the __c
, those come from Salesforce, so you either need to point from which object in Salesforce or which Synchronized DE they should come from.
Using the iif function for this use case would be too complicated, so it's better to use an AMPscript block wit an if/else statement:
%%[
SET @rows = RetrieveSalesforceObjects(
"ObjectName",
"Variable_Scholarship_Name__c,Variable_Scholarship_Amount__c",
"Id" = "SubscriberID")
SET @row = row(@rows,1)
SET @Variable_Scholarship_Name__c = field(@row,"Variable_Scholarship_Name__c")
SET @Variable_Scholarship_Amount__c = field(@row,"Variable_Scholarship_Amount__c")
IF NOT EMPTY(@Variable_Scholarship_Name__c) THEN
]%%
Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
Scholarship Amount: $%%=v(@Variable_Scholarship_Amount__c)=%%
%%[ENDIF]%%
Above will pull data directly from Salesforce, so only use it on CloudPages. You will need to replace "ObjectName" and "SubscriberID" in the above to point it to the right object and enable to identify the record correctly.
If you need this for an email, it's better to use Synchronized Data Extensions:
%%[
SET @rows = LookupRows("NameOfSynchedDE","Id", "Id")
SET @row = row(@rows,1)
SET @Variable_Scholarship_Name__c = field(@row,"Variable_Scholarship_Name__c")
SET @Variable_Scholarship_Amount__c = field(@row,"Variable_Scholarship_Amount__c")
IF NOT EMPTY(@Variable_Scholarship_Name__c) THEN
]%%
Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
Scholarship Amount: $%%=v(@Variable_Scholarship_Amount__c)=%%
%%[ENDIF]%%
Here you will need to replace "NameOfSynchedDE" with the name of your Data Extension, first "Id" with the Id column in that DE and the second "Id" with the Id to identify the correct record.
So, if for example, this data comes from the Contact_Salesforce
synchronized data extension, the final code would look something like this:
%%[
SET @rows = LookupRows("Contact_Salesforce","Id", _subscriberkey)
SET @row = row(@rows,1)
SET @Variable_Scholarship_Name__c = field(@row,"Variable_Scholarship_Name__c")
SET @Variable_Scholarship_Amount__c = field(@row,"Variable_Scholarship_Amount__c")
IF NOT EMPTY(@Variable_Scholarship_Name__c) THEN
]%%
Scholarship Title: %%=v(@Variable_Scholarship_Name__c)=%%
Scholarship Amount: $%%=v(@Variable_Scholarship_Amount__c)=%%
%%[ENDIF]%%