IZiko lokuKhetha ukuThengiswa kweLifu lokuThengisa: I-AMPScript kunye noMzekelo wekhasi lamafu

I-AMPscript yokuThengisa-eHlanganisiweyo yeNtengiso yeKhowudi yokuKhangela kwiLifu

Ibali lokwenyani… ikhondo lam lomsebenzi liqale ngokwenene kwiminyaka elishumi eyadlulayo xa ndandiqala isikhundla sokuba nguMcebisi woMdibaniso we-ExactTarget (ngoku eyiNtengiso yeNtengiso ye-Salesforce). Umsebenzi wam undithathe kwihlabathi liphela ndincedisa iinkampani ekuphuhliseni indibaniselwano enzulu kunye neqonga kwaye ndakha ulwazi oluninzi lweziko leqonga kangangokuba ndonyuselwa ndaba nguMphathi weMveliso.

Imiceli mngeni yoMphathi weMveliso yombutho owawukade ungumnini wonjiniyela ekugqibeleni wakhokelela ekubeni ndiqhubeke Yayingumbutho omkhulu, kodwa andizange nyani ngumnini imveliso. Ke, ngelixa oontanga bam bexhasa, ukuthengisa, kunye nentengiso yemveliso bejonge kum ukuba benze utshintsho lokwenyani… inyani kukuba iqela lophuhliso lihlala liphumeza isisombululo esahlukileyo kwaye ndiza kufumanisa kwiintsuku ngaphambi kokukhutshwa.

Enye yeeprojekthi zam zokugqibela yayisebenza kwiqonga lokubhala langaphakathi elinokuthi lenze abathengi bethu ukuba bongeze iscript kwi-imeyile zabo. Ndisebenze nomnye uManejala weMveliso kwaye senza itoni yophando… ekugqibeleni ndithathe isigqibo sokuphuhlisa indlela yesimbo seJQuery ngemisebenzi yethu, kodwa kubandakanya ukubanakho ukupasa nokusebenzisa uluhlu, ukusebenzisa iJSON, njl. Njl. isisombululo… ide ifike kuphuhliso. Kwangoko kumjikelo wemveliso, ilayibrari yam yachithwa kwaye umphuhlisi omkhulu wayitshintsha AMPscript.

Kwiminyaka kamva, i Iqabane lomthengisi Inkampani endiliqabane kuyo ngoku yenza ubumbano, ukudityaniswa kwamashishini, kwaye ndizifumana ndidiniwe kwi-AMPscript mihla le-nokuba kukonyusa umxholo we-imeyile okanye ukukhupha iphepha lamafu. Ewe, ukukhathazeka kokusebenza kwemihla ngemihla kunye ne-AMPscript kuyandiqinisekisa ukuba isigqibo esingalunganga senziwe kwakhona ngezo ntsuku… isisombululo sam besinokuba sihle kakhulu. Ndiziva ngathi ndibuyile kwinkqubo ye-TRS-80 kwi-BASIC.

Umhleli owusebenzisayo kumaphepha e-Cloud akaxoleli. Ayibambi imiba elula njengokuchaza izinto eziguquguqukayo okanye iimpazamo zes syntax ngekhowudi yakho. Ngapha koko, unokushicilela iphepha eliza kuthi livelise impazamo kwiseva engama-500. Kukwakho neendawo ezimbini zokubeka amagama amaphepha akho… ungandibuzi ukuba kutheni.

Pro-tip: Ukuba amaphepha eLifu akaze abuyise idatha yesampulu xa sele uza kupapasha kwaye kujongeka ngathi iyaqhubekeka ngonaphakade… uza kuyiphosa impazamo. Ukuba upapasha nangayiphi na indlela, kuya kufuneka ucime iLifu Ikhasi ngokupheleleyo kwaye uqalise ngaphezulu. Uqikelelo lwam kukuba iziseko ezakhiweyo phezu kwazo azikrelekrele ngokwaneleyo ukuba zichonge utshintsho lwekhowudi kwaye zigcina ngokuqhubekeka kwekhowudi egciniweyo.

Ngaphandle kwalonto, uyakonwabela ukwazi uninzi lweesampulu zekhowudi ezibhaliweyo ezineempazamo zazo zesintakisi. Yay! Ngamava amabi… kodwa usengayisebenzisa kwaye uyisebenzise kuba ibonelela ngokuguquguquka okumangalisayo.

Inqaku eliphambili: Kukho iphepha elitsha leLifu amava… Apho kujongeka ngathi baphinde bahlinza iphepha kwaye aliboneleli ngolwazi olongezelelekileyo. Ndiyayithanda inguqulelo yakudala ebhetele kulandelelwano olunamanqanaba amaninzi.

Ngelixa inkampani yam Highbridge yakha izisombululo ezintsonkothileyo ezinikwe iAjax ezidibanisa iinkqubo ezininzi kunye nokubandakanya izandiso zedatha kunye neAMPscript, SSJS, Cloud Pages, kunye ne-imeyile… bendifuna ukwabelana ngomzekelo olula wendlela ongaqala ngayo ngokulula usebenzisa i-AMPscript ukubuza umzekelo wakho we-Salesforce kunye nokutsala idatha yangasemva. Kule meko, intsimi elula ye-boolean egcina inkosi ikhupha irhafu kwiflegi. Ngokuqinisekileyo unokwandisa le khowudi ukwakha iphepha lokukhetha okanye iprofayile onokuyisebenzisa.

Yenza ikhonkco lephepha lamafu kunye nedatha yababhalisi

Ukuba ujonga iinkcukacha zakho zePhepha leLifu, unokufumana i-ID eyahlukileyo kwiphepha onokulubandakanya kwii-imeyile zakho.

iphepha le-id

Is syntax imi ngolu hlobo lulandelayo:

<a href="%%=RedirectTo(CloudPagesURL(361))=%%">View My Preferences</a>

I-AMPscript yeDatha yokuThengisa ngePhepha laMafu ngokudityaniswa kweDatha

Inyathelo lokuqala kukwakha i-AMPscript yakho ukubhengeza izinto eziguquguqukayo kunye nokufumana idatha kwi-Salesforce oza kuyisebenzisa kwiphepha lakho. Kulo mzekelo, indawo yam ye-Salesforce ye-boolean ebambe eyinyani okanye ubuxoki ibizwa ngegama IkhethiweOut:

%%[

/* Declare EVERY variable */
VAR @contactKey,@agent,@referrer,@unsub
VAR @rs,@updateRecord,@checked
 
/* Request your ContactKey from the querystring */
Set @contactKey = Iif(Empty([_subscriberKey]),RequestParameter("contactKey"),[_subscriberKey])

/* Set unsub to false unless it is passed in the querystring */
SET @unsub = Iif(Not Empty(RequestParameter('unsub')),RequestParameter('unsub'),'false')
 
/* If unsub, then update the Salesforce field OptedOut */ 
IF NOT Empty(@unsub) THEN
  SET @updateRecord = UpdateSingleSalesforceObject('contact',@contactKey,'OptedOut', @unsub)
ENDIF

/* Retrieve the Salesforce Contact record */
Set @rs = RetrieveSalesforceObjects('contact', 'FirstName,LastName,OptedOut', 'Id', '=', @contactKey);
 
/* Get the fields from the record */
 IF RowCount(@rs) == 1 then
  var @record, @firstName, @lastName, @optout
  set @record = Row(@rs, 1)
  set @firstName = Field(@record, "FirstName")
  set @lastName = Field(@record, "LastName")
  set @optout = Field(@record, "OptedOut")
ENDIF

/* Build a string for your checkbox to be checked or not
 set @checked = '';
 IF (@optout == 'true') THEN
  set @checked = 'checked'
 ENDIF
 
]%%

Ngoku ungakha i-HTML yakho kunye nefom eyenza isicelo:

<!DOCTYPE html>
<html>
   <title>Profile Center</title>
   <body>
      <h2>Your Profile:</h2>
      %%[ if RowCount(@rs) == 1 then ]%%
      <ul>
         <li><strong>First Name:</strong> %%=v(@firstName)=%%</li>
         <li><strong>Last Name:</strong> %%=v(@lastName)=%%</li>
         <li><strong>Unsubcribed:</strong> %%=v(@optout)=%%</li>
      </ul>
      <form method="get">
       <div>
         <input type="hidden" id="contactKey" name="contactKey" value="%%=v(@contactKey)=%%">
         <input type="checkbox" id="unsub" name="masterUnsub" value="true" %%=v(@checked)=%%>
         <label for="masterUnsub">Unsubscribe From All</label>
        </div>
       <div>
         <button type="submit">Update</button>
        </div>
     </form>
      %%[ else ]%%
      <p>You don't have a record.</p>
      %%[ endif ]%%
   </body>
</html>

Yiyo leyo… yidibanise yonke kwaye unephepha lokhetho elihlaziyiweyo kunye nerekhodi lababhalisi kwaye udlulisa isicelo sokuhlaziya intsimi ye-boolean (yinyani / bubuxoki) kwi-Salesforce. Ngoku ungakha imibuzo yesiqhelo kuloo ndawo ukuze uqiniseke ukuba abafowunelwa abakhethwe ngaphandle abathunyelwa nayiphi na i-imeyile!

UngaliPhucula njani iphepha lakho lokukhetha okanye iZiko leProfayile

Ewe kunjalo, oku kukukrola nje kwinto enokwenzeka ngephepha lokhetho. Izincedisi onokunqwenela ukucinga ngazo:

  • Yenza isicatshulwa esivela kolunye ulwazi lwedatha ukuze iqela lakho lentengiso lihlaziye umxholo wephepha nanini na xa lingathanda ngaphandle kokuchukumisa ikhowudi.
  • Yenza uluhlu loshicilelo lolwandiso lwedatha kunye nokungena kupapasho ukuze ukhethe ukungena okanye ukhethe ukuphuma kukhetho ukongeza kwinto yokubhalisa.
  • Yenza isizathu sokwandiswa kwedatha ukuze ubambe ukuba kutheni ababhalisile bakho bengabhalisi.
  • Yenza ezinye iinkcukacha zeprofayili kwiRekhodi ye-Salesforce ukubonelela ngolwazi olongezelelweyo lweenkcukacha.
  • Yenza iphepha nge-Ajax ukuze uligcwalise ngaphandle komthungo.
  • Nika indlela yobhaliso ukuze umsebenzisi wakho akwazi ukufikelela kwiziko lakhe lenkqubo nangaliphi na ixesha.

Izixhobo ezongezelelweyo ze-AMPscript

Ukuba ufuna uncedo olongezelelekileyo lokufunda kunye nokuhambisa i-AMPscript, nazi izibonelelo ezilungileyo:

  • Isikhokelo se-AMPscripte -lungelelaniswe ngabasebenzi beSalesforce, esi sisiseko sedatha esipheleleyo se-AMPscript syntax, nangona imizekelo ilula ngokwenene. Ukuba ibomelele ngakumbi, kunokuba kufanelekile ukuba kutyalwe imali.
  • I-Trailhead AMPscript -I-Trailhead's Trailhead sisixhobo sokufunda simahla kwaye sinokuhamba ngeziseko zolwimi kunye ne-AMPscript, i-SSJS, kunye nendlela abanokuthi basebenzisane ngayo.
  • Ukutshintshwa kweStack for Salesforce -Indawo enkulu eku-intanethi yokucela uncedo ngetoni yeesampulu zekhowudi ye-AMPscript.

Kukho itoni yethuba lokudibanisa amaphepha akho eLifu kunye ne-Salesforce ukubonelela ngamava aphezulu omsebenzisi. Kwaye ukuba inkampani yakho iyasokola, ungahlala unxibelelana nathi ukunceda!

Iinkcukacha zoqhagamshelwano Highbridge

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.