Good day all @Salesforce DX,
"sf project retrieve start -m EmailTemplate:unfiled\$public/my_email_template -o myOrg"
This command never worked for me.
I got this message:
Entity of type 'EmailTemplate' named ' unfiled$public/my_email_template -o myOrg ' cannot be found.
Searched a lot on the internet, many faced the same issue, but some said it is working for them.
Can anyone advise?
Thank you.
I got the answer.
My script is first query from email template:
SELECT Id, Name, DeveloperName, NamespacePrefix, Folder.DeveloperName, Folder.NamespacePrefix, FolderId FROM EmailTemplate
Sample result in json:
{
"attributes": {
"type": "EmailTemplate",
"url": "/services/data/v59.0/sobjects/EmailTemplate/00X############"
},
"Id": "00X############",
"Name": "my_template_1",
"DeveloperName": "my_template_1",
"NamespacePrefix": null,
"Folder": {
"attributes": {
"type": "Folder",
"url": "/services/data/v59.0/sobjects/Folder/00l############"
},
"DeveloperName": "folder_1",
"NamespacePrefix": null
},
"FolderId": "00l############"
},
{
"attributes": {
"type": "EmailTemplate",
"url": "/services/data/v59.0/sobjects/EmailTemplate/00X############"
},
"Id": "00X############",
"Name": "my_template_2",
"DeveloperName": "my_template_2",
"NamespacePrefix": null,
"Folder": null,
"FolderId": "005############"
},
then my script will jq the folder attribute:
folder=$(echo "$email" | jq -r '.Folder')
following script logic is to check if $folder==null, then assume the template is in unfiled$public, HOWEVER, this is not the case always, if the FolderId begins with 005, that means the template is in user's personal folder, which even admin profile user are not able to retrieve it.
unfiled$public folder id should begins with 00D, the org id :)