You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: support both templateReferenceId and internal db id lookup
1. First try: Filter by templateReferenceId (Document Service)
2. Fallback: Try internal database id via entityService
This ensures backward compatibility with frontends that send
internal database IDs (5, 117) instead of templateReferenceId.
strapi.log.info(`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`);
120
+
returnbyRefId[0];
121
+
}
118
122
119
-
if(result){
120
-
strapi.log.info(`[magic-mail] [SUCCESS] Found template by templateReferenceId ${id}: documentId=${result.documentId}, name="${result.name}"`);
121
-
}else{
122
-
strapi.log.warn(`[magic-mail] [WARNING] Template with templateReferenceId ${id} not found`);
123
+
// 2. Fallback: Try internal database id via entityService (for backward compatibility)
124
+
strapi.log.info(`[magic-mail] [FALLBACK] templateReferenceId not found, trying internal db id: ${numericId}`);
strapi.log.info(`[magic-mail] [SUCCESS] Found template by internal id ${numericId}: documentId=${byInternalId.documentId}, name="${byInternalId.name}"`);
131
+
returnbyInternalId;
123
132
}
124
133
125
-
returnresult;
134
+
strapi.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
0 commit comments