Skip to content

Instantly share code, notes, and snippets.

%%[
IF RequestParameter("submitted") == true THEN
/* check if lead already exists */
SET @subscriberRows = RetrieveSalesforceObjects(
"Lead",
"Id,Email",
"Email", "=", RequestParameter("email")
)
<table style="padding: 20px;"><tr><td>
<h2>Please fill in the form:</h2>
<form action="%%=RequestParameter('PAGEURL')=%%" method="post">
<label>First name: </label><input type="text" name="firstname" required=""><br>
<label>Last name: </label><input type="text" name="lastname" required=""><br>
<label>Company: </label><input type="text" name="company" required=""><br>
<label>Email: </label><input type="text" name="email" required=""><br>
<input name="submitted" type="hidden" value="true"><br>
<input type="submit" value="Submit">
</form>
%%[
IF RequestParameter("submitted") == true THEN
/* create a new lead */
SET @leadId = CreateSalesforceObject(
"Lead", 4,
"FirstName", RequestParameter("firstname"),
"LastName", RequestParameter("lastname"),
"Company", RequestParameter("company"),
"Email", RequestParameter("email")
%%[
IF RequestParameter("submitted") == true THEN
/* check if lead already exists */
SET @subscriberRows = RetrieveSalesforceObjects(
"Lead",
"Id,Email",
"Email", "=", RequestParameter("email")
)
%%[
IF RequestParameter("submitted") == true THEN
/* check if lead already exists */
SET @subscriberRows = RetrieveSalesforceObjects(
"Lead",
"Id,Email",
"Email", "=", RequestParameter("email")
)
SELECT DISTINCT
s.SubscriberKey,
j.EmailName
FROM _Sent s
LEFT JOIN _Job j
ON s.JobID = j.JobID
LEFT JOIN _Open o
ON s.JobID = o.JobID AND s.ListID = o.ListID AND s.BatchID = o.BatchID AND s.SubscriberID = o.SubscriberID AND o.IsUnique = 1
LEFT JOIN _Click c
ON s.JobID = c.JobID AND s.ListID = c.ListID AND s.BatchID = c.BatchID AND s.SubscriberID = c.SubscriberID AND c.IsUnique = 1
SELECT
o.SubscriberKey,
ea.Gender
FROM _Open o
INNER JOIN ENT._EnterpriseAttribute ea ON o.SubscriberID = ea._SubscriberID
WHERE ea.Gender = 'Female'
AND o.EventDate > dateadd(d,-7,getdate())
%%[
var @email, @skey
set @skey = AttributeValue("_subscriberkey")
set @email = Lookup("_Subscribers","EmailAddress","SubscriberKey", @skey)
]%%
Email Address: %%=v(@email)=%%
%%[
VAR @subscriberkey, @email, @firstname, @lastname
SET @subscriberkey = _subscriberkey
IF NOT EMPTY(@subscriberkey) THEN
SET @rs= RetrieveSalesforceObjects("Contact", "Id, FirstName,LastName,Email", "Id", "=", @subscriberkey)
SET @rowCount = rowcount(@rs)
IF @rowCount > 0 THEN
SET @row = row(@rs,1)
SET @email = field(@row,"Email")
SET @firstname = field(@row,"FirstName")
%%[
VAR @subscriberkey, @email, @firstname, @lastname
SET @subscriberkey = _subscriberkey
IF NOT EMPTY(@subscriberkey) THEN
IF Substring(@subscriberkey, 1,3) == "00Q" THEN
/* Lead */
SET @rs= RetrieveSalesforceObjects("Lead", "Id, FirstName,LastName,Email", "Id", "=", @subscriberkey)
SET @rowCount = rowcount(@rs)
IF @rowCount > 0 THEN
SET @row = row(@rs,1)