Salesforce Certified MuleSoft Developer Practice Questions

Salesforce Certified MuleSoft Developer exam preparationAligned with the official Exam Guide (Spring '24 release; guide version 13)

Salesforce Certified MuleSoft Developer practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 120 minutes.

Salesforce Certified MuleSoft Developer free question 4 / 10 · Domain 3: Accessing and Modifying Mule Events

A Logger in a flow has the message Order #[payload.id] accepted and logs the expected text. A developer copies the same value into a Set Payload component so that the caller receives that sentence. Following the Logger reference, how should the value of the Set Payload be written?

  1. As two Set Payload components in a row, one for the fixed text and one for #[payload.id]
  2. As one expression that builds the text, such as #['Order ' ++ payload.id ++ ' accepted']
  3. Leave Order #[payload.id] accepted as is, because Set Payload resolves #[ ] blocks inside text
  4. As a Logger message, because Set Payload is limited to a single DataWeave selector
Show the answer and explanation

Answer: B

Why this is correct
The Logger reference carries a warning: the Logger is one of the only components that supports mixing strings and expressions within a value, and DataWeave string interpolation or concatenation within a single expression should be used elsewhere. A Logger message such as Order #[payload.id] accepted works because the Logger evaluates the #[ ] part and keeps the surrounding text. Set Payload takes either a literal string or one DataWeave expression as its value. To return the sentence, the whole value must be one expression that builds the text, for example #['Order ' ++ payload.id ++ ' accepted'], which is the same pattern the Set Payload page uses with #['Hello World!' ++ ' Today is ' ++ now()]. Interpolation inside a DataWeave string is the other option the reference names.

Why the other options are wrong
"Leave Order #[payload.id] accepted as is, because Set Payload resolves #[ ] blocks inside text" … Set Payload does not treat the value this way. Mixing fixed text and #[ ] blocks in one value is a feature of the Logger, which is one of the only components that supports it. Elsewhere the value has to be a single DataWeave expression.
"As two Set Payload components in a row, one for the fixed text and one for #[payload.id]" … Set Payload replaces the payload with its value each time it runs. The second component would overwrite the fixed text with the order id, and the caller would receive only the id.
"As a Logger message, because Set Payload is limited to a single DataWeave selector" … Set Payload is limited to simple expressions, not to selectors: its value accepts a literal string or a DataWeave expression, and the reference's own example concatenates text with now(). A concatenation of a few strings is within that scope.

Why the copy looked harmless
The Logger reference shows both styles side by side: one Logger mixes text and expressions, another uses a single expression with ++. Both work in a Logger, which is why the mixed style is easy to copy. When you move a message into Set Payload, Set Variable or a connector field, rewrite it in the single-expression form first.

Go to the Salesforce Certified MuleSoft Developer practice app (10 free questions; purchase unlocks all questions)

See the full practice set