↑ ↓ to move, Enter to open, Esc to close

    SF-MCDMarketing Cloud Developer

    Switch exam

    Microsoft Azure

    aws Amazon Web Services

    Google Cloud

    ServiceNow

    Databricks

    Cisco

    Salesforce

    All exams and search

    Exams / SF-MCD / D1 Scripting and Automation

    D1.1

    Scripting and Automation (part 1 of 3)

    • 2 min read
    • 6 sections
    • 24 questions
    • Free preview
    • Exam domain: Scripting and Automation
    You are reading a free preview. The rest of the SF-MCD course unlocks with an Exam pass or All access.See plans

    AMPscript basics

    Function What it does Exam point
    Output(fn()) Returns the result of an AMPscript function and includes it in the rendered content Only produces output when the value is a function call; a string literal gives an error
    Mod(a, b) Remainder of a / b Odd/even test for alternating rows: Mod(@n, 2) = 1
    Add(a, b) Sum of exactly two numbers Nest calls for more than two values
    DateAdd(date, n, unit) Date arithmetic; units Y, M, D, H, MI DateAdd(d, -1, 'H') moves back one hour
    RaiseError(msg, skipCurrentOnly, ...) Logs the error and skips the current subscriber (or stops the job) For error handling, not segmentation
    CreateSmsConversation() Starts a MobileConnect SMS conversation from AMPscript (e.g. CloudPage) Not usable with Double Opt-In / Info Capture templates

    Order of operations

    HTML, text, subject, then one batch

    • AMPscript is processed as a batch, the final step of the send, not line by line.
    • Order: HTML body, text body, subject line. A variable set in the HTML body keeps its value in the text body and subject; a variable set in the subject line is null in the bodies.
    • Multiple SETs of one variable: the last one processed wins (subject line beats HTML and text).
    • Cancelling a send before the batch completes means UpdateDE writes no rows.

    SSJS and AMPscript

    Variable.GetValue("@subKey") reads an AMPscript variable; SSJS adds the @ prefix if you omit it.

    SOAP API

    Object Role
    TriggeredSendDefinition Configuration of a triggered send
    TriggeredSend One instance of a triggered email: Create it to send
    ResultItem + RequestID Status of an asynchronous call
    DataExtension Definition (Create method creates a data extension with any name)
    DataExtensionObject Rows: real-time inserts/updates
    SentEvent Tracking object, read-only (no POST/Create)

    TriggeredSend vs definition

    REST API

    Need Call
    Authenticate calls Authorization: Bearer YOUR_ACCESS_TOKEN header
    Inject a contact into a journey POST /interaction/v1/events (ContactKey, EventDefinitionKey, Data)
    Verify a messageDefinitionSends send (202 only means accepted) GET /messaging/v1/messageDefinitionSends/key:{key}/deliveryRecords

    Automation Studio

    Need Use
    File arrives at unpredictable time, unique filenames File Drop Automation
    File name of triggering file in Import/Data Copy %%FILENAME_FROM_TRIGGER%%
    Extract tracking data to FTP Data Extract activity + File Transfer
    Exclusion Script on a send Automation Studio Send Email activity
    Contact Builder batch delete Up to 1 million contacts per batch

    (The last four rows come from Salesforce Help pages and the question explanations; they could not be quoted from the allowed doc sites.)

    Exam traps

    • TriggeredSendDefinition + Create sends nothing; create a TriggeredSend.
    • Add() takes two arguments only.
    • H is the hour unit of DateAdd, not HH; FormatDate does not shift time.
    • A 202 from REST means "accepted", not "delivered".
    • Subject line is processed last, so its SET wins.
    • %%FILENAME_FROM_TRIGGER%%, not %%FILENAME%%, is the file-drop substitution string.

    Docs

    The rest of this chapter is part of the SF-MCD premium course

    Unlock every chapter, all 130 questions and spaced review with All access or a 90-day exam pass. Every Fundamentals exam stays free, and the first chapter of every exam is open.

    Chapters