Hello Everyone,
I’ve been working on a fairly specific integration scenario and wanted to share what I’ve found so far - along with some open questions where I’d love to hear from others who’ve tackled this.
The Setup
We’re building a flow where Pega sends an email to an external system from a specific case, with the Case ID embedded in the subject line (e.g., “Re: Policy Verification - Claim-C-123456”). When the external party replies, we need Pega to pick it up and associate it back to that case.
To handle inbound emails, I’ve set up an Email Listener in Pega. Since we’re using Microsoft Graph (MSGraph) rather than a traditional POP3/IMAP source, Pega requires a custom request mapping approach — enabled via the toggle EnableCustomDataAccessForMSGraph on the Service Email rule’s Request tab. The official documentation for this is here:
Pegasystems Documentation
The Limitation I Hit
Here’s where things get tricky. The custom mapping only supports single-value (scalar) fields of primitive types — Boolean, Integer, and String. That’s fine for flat fields, but the JSON payload coming in from MSGraph looks something like this:
{
"@odata.context": "https://graph.microsoft.com/v1.0/...",
"id": "AAMkAGI2ThEs6AAA=",
"subject": "Re: Policy Verification - Claim-C-123456",
"internetMessageId": "<[email protected]>",
"conversationId": "AAQkAGI2ThEs6CONVERSATION==",
"receivedDateTime": "2026-06-12T10:30:00Z",
"hasAttachments": true,
"from": {
"emailAddress": {
"name": "ABC Policy Verifier",
"address": "[email protected]"
}
},
"toRecipients": [
{
"emailAddress": {
"name": "Tech User",
"address": "[email protected]"
}
}
],
"body": {
"contentType": "html",
"content": "ABC Policy Verification Team"
}
}
Fields like from, toRecipients, and body are nested objects/arrays, which means they cannot be mapped into the Pega clipboard using the custom mapping block. You’re essentially limited to flat fields like id, subject, receivedDateTime, and hasAttachments.
My Current Workaround
The approach I’ve landed on (not ideal, but functional):
- In the Custom Mapping block on the Service Email rule’s Request tab, map only the scalar fields (
id,subject,receivedDateTime,hasAttachments, etc.) - In the Service Activity or a Data Transform invoked afterward, make a second call to the MSGraph Messages API using the mapped
idto retrieve the full message payload — including nested fields and attachments - Parse the full response and process the email body and attachments from there
For attachments specifically, it seems like there’s no escaping a dedicated Graph API call to:
- Retrieve the base64-encoded attachment stream
- Decode it
- Create a
Data-WorkAttach-Fileinstance - Link it to the case
It works, but it feels like an unnecessary round trip. It would be great if Pega’s custom MSGraph mapping supported nested/complex structures out of the box — one less API call and a much cleaner implementation.
My Questions for the Community
- Has anyone found a way to map nested MSGraph JSON fields into Pega without making a second API call? Any connector rules or custom parsing tricks?
- For attachments, is the additional Graph API call truly unavoidable, or is there a smarter pattern others have used?
- Are there any alternative approaches to the Email Listener setup for MSGraph-sourced emails that offer more flexibility?
Happy to share more specifics about my setup if it helps. Appreciate anyone who takes the time to respond.
Regards
JC




