Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We can’t retrieve the specified metadata object: EmailTemplateFolder #1345

Closed
FabienTaillon opened this issue Jan 4, 2022 · 7 comments
Closed
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue

Comments

@FabienTaillon
Copy link

Summary

While saving a Lightning Email Template in a custom folder with Folders and Enhanced Sharing enabled, pulling changes displays the following warning:

We can’t retrieve the specified metadata object: EmailTemplateFolder. Certain metadata types, like MyFolder are not currently supported by the CLI.
File a bug here: https://github.com/forcedotcom/cli/issues and provide the name of the unsupported metadata type

Being obedient, I'm filing a bug as requested ;-)

Not sure if this is a 100% issue with the CLI, if so is it something I could fix myself via a PR ? Or does it need any internal validation about the source format for this file (is it decomposed or not, file name etc) ?

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Enable Folders and Enhanced Sharing in Setup/Lightning Email Templates or ad the following setting to your project-scratch-def.json file:
"emailTemplateSettings": {
      "enableTemplateEnhancedFolderPref": true
}
  1. Go to the Contact tab, create one
  2. In the Activity section, select Email
  3. Enter a random subject
  4. Below body field, click on the Insert, create, or update template button and select Save as new template...
  5. Click on Select Folder and then New Folder
  6. Create a new folder, and save your template in it
  7. Pull everything

Expected result

Email Template and Email Template Folder should be pulled.

Actual result

Only Email Template is pulled, and a warning is displayed about Email Template Folder:

We can’t retrieve the specified metadata object: EmailTemplateFolder. Certain metadata types, like MyFolder are not currently supported by the CLI.
File a bug here: https://github.com/forcedotcom/cli/issues and provide the name of the unsupported metadata type

System Information

{
        "cliVersion": "sfdx-cli/7.132.0",
        "architecture": "win32-x64",
        "nodeVersion": "node-v16.13.1",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.2.15 (core)",
                "@oclif/plugin-not-found 1.2.6 (core)",
                "@oclif/plugin-plugins 1.10.10 (core)",
                "@oclif/plugin-update 1.5.0 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.3 (core)",
                "@oclif/plugin-which 1.0.3 (core)",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "alias 1.2.0 (core)",
                "apex 0.7.0 (core)",
                "auth 1.8.0 (core)",
                "config 1.3.2 (core)",
                "custom-metadata 1.0.12 (core)",
                "data 0.6.6 (core)",
                "generator 1.2.1 (core)",
                "info 1.1.4 (core)",
                "limits 1.3.0 (core)",
                "org 1.11.0 (core)",
                "salesforce-alm 53.7.0 (core)",
                "schema 1.1.0 (core)",
                "sfdx-cli 7.132.0 (core)",
                "source 1.6.2 (core)",
                "telemetry 1.4.0 (core)",
                "templates 52.7.0 (core)",
                "texei-sfdx-plugin 1.14.0",
                "trust 1.1.0 (core)",
                "user 1.7.0 (core)"
        ],
        "osVersion": "Windows_NT 10.0.18363"
}

Additional information

In case it's not easy to find, here is the button to click to save your Lightning Email Template:
saveastemplate

@FabienTaillon FabienTaillon added the investigating We're actively investigating this issue label Jan 4, 2022
@github-actions
Copy link

github-actions bot commented Jan 4, 2022

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@maggiben
Copy link
Contributor

maggiben commented Jan 4, 2022

I created an email template + folder and I was able to retrieve them despite the warning message:
image
Also uploaded the results here If this is not what you need please let me know.

@maggiben maggiben added the bug Issue or pull request that identifies or fixes a bug label Jan 5, 2022
@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-10385112

@FabienTaillon
Copy link
Author

Thank you @maggiben for your answer.

What you're getting here is the EmailTemplate itself, but not the metadata for the containing folder.
If you try to create a new scratch org from this metadata, you'll get an error on push saying that the folder can't be found:

error

If you do the same thing for a metadata being supported, let's say a report folder, you can see that in addition to the report itself, there is a metadata file for the report folder:

report

This is what's missing here and prevent us to recreate a new scratch org without having to manually create the email template folder first.

@mshanemc
Copy link
Contributor

mshanemc commented Jan 6, 2022

What I'm seeing is that EmailTemplate now has 2 potential parent types (EmailFolder, similar to ReportFolder which it's always had and now a new type called EmailTemplateFolder).

Gotta figure out how to handle that possibility.

@FabienTaillon
Copy link
Author

@mshanemc looks like EmailFolder is for Classic Email Template, and EmailTemplateFolder for Lightning Email Template.

I was able to retrieve it with a package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>MyLightningFolder</members>
        <members>MyLightningFolder/My_Lightning_Template_1641477219455</members>
        <name>EmailTemplate</name>
    </types>
    <version>53.0</version>
</Package>

This gives me a MyLightningFolder-meta.xml metadata file which content is different from a regular EmailFolder file (root tag is EmailTemplateFolder instead of EmailFolder, includes a folderShares tag etc...), but if I copy/paste it as is under force-app/main/default/email and change the file extension to match the other EmailFolder files (MyLightningFolder.emailFolder-meta.xml), it works.

I'm able to push to a new Scratch Org again, and folder is created correctly as a Lightning Email Template folder.
So retrieving it like a regular EmailFolder and saving it at the same place and with the same extension should work.

@mshanemc
Copy link
Contributor

This is quite a nasty problem. We're gonna get a response from the metadata owners before deciding how to fix it.

Thanks for reporting, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

4 participants