function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PatMcClellan__cPatMcClellan__c 

SFDX pull error re: platform event translation

I created a Platform Event in my scratch org. When I try to pull it into source, I get the error:
ERROR:  Cannot retrieve translation for object:[my platform event name].
Translation is not enabled on the scratch org, and I don't need it.

I tried to .forceignore it, no-go. I can't pull the other things from my scratch org in that I need. I don't know where/how to fix this in the scratch org. I'm stuck...  
Best Answer chosen by PatMcClellan__c
Jeff HilyardJeff Hilyard

Here's a fix from within the scratch org.

This is an old question but I just had this problem so here's hoping I help someone else who puts a lot of time into building in the UI and then edits the API name of their Platform Event before pulling the source:

I was able to recover from this by marking the translation as obsolete in the SourceMember table/object.

Open the developer console from the scratch org, check the box "Use Tooling API" and execute the query:

SELECT Id,ChangedBy,IsNameObsolete,MemberIdOrName,MemberName,MemberType,RevisionCounter,RevisionNum From SourceMember where isNameObsolete=false

Then I looked for a row with a MemberType of customObjectTranslation and edited it's isNameObsolete value to be true (check the box) and clicked "Save Rows".

At that point sfdx force:source:pull worked.

I got the hint about the SourceMember table from this page: https://groups.google.com/a/illuminatedcloud.com/forum/#!topic/qanda/AJYQPpoUGzo

All Answers

Anastasia Shpurik 8Anastasia Shpurik 8
Hello, I am a developer for the Salesforce CLI. Are you still running into this issue? If so, will you please list out the results of sfdx plugins --core?

Additionally, what steps did you take to create the platform event in your org? I created a very simple one with no customizations and it pulled for me.

In order to use .forceignore for entities in the org, we have recently updated our documentation on how to format it correctly - see the section titled "Exclude Remote Changes Not Yet Synced with Your Local Source" here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
PatMcClellan__cPatMcClellan__c
Hi @Anastasia, I don't think this issue actually has to do with the Platform Event -- that's just what I happened to be pulling. Others on the SFDX community (can't remember which forum) say they avoid pulling anything because of the phantom Translation data.

Here are the plugins. Not sure if that's the same as back in July when I made my original post. 
 
-> sfdx plugins --core
@salesforce/plugin-generator 0.0.10 (core)
@salesforce/sfdx-trust 1.0.8 (core)
builtins 1.0.0 (core)
salesforcedx 43.12.0 (core)
Thanks for the Exclude link. That's been in need of further documentation.
Diane MacRobie 3Diane MacRobie 3
I have looked at the reference above and tried multiple variations and I am still getting the same issue attempting to sync.  I created a new Platform event in a scratch org.  Translation is not enabled in this scratch org.  Whenever I attempt to pull, I get the "Cannot retrieve translation for object:Doc_Submitted".  Doc_Submitted is my platform event.  I have tried the following in my .forceignore but no success
**objectTranslations
Doc_Submitted__e.objectTranslation
Any idea what I am missing?
PatMcClellan__cPatMcClellan__c
@Diane McRobie 3, I stopped having the issue when I put **objectTranslations in my .forceignore. 
If you want to exclude a specific file, I think you have to have the full file path:
/force-app/main/default/objectTranslations/Doc_Submitted__e.objectTranslation

I know it should already be excluded by the **objectTranslations.

It seems weird to have a __e (event) file in objectTranslations anyway.
Diane MacRobie 3Diane MacRobie 3
Thanks Pat.  I felt the same way.  I have created events in a scratch org before - this is the first time I ever ran into the translation.  I tried the full path as well and the other format is the one I saw in the exclude link that @Anastasia noted.  Still no joy - the ignore is just not having any effect.
Fred The DevFred The Dev
I am running into this same issue.
I created a platform event with 3 fields, a text field, checkbox, and long text. When I try to pull I get an error, Cannot retrieve translation for object:Message.

Has anyone found a solution for this?


This is the result of sfdx plugins --core
@salesforce/plugin-generator 1.0.1 (core)
@salesforce/sfdx-trust 2.1.0 (core)
builtins 1.0.0 (core)
salesforcedx 45.5.0 (core)
alex_bergalex_berg
I added a "Platform Event" in my scratch org and this "Cannot retrieve translation for object:My_Event" error has completely broken my "sfdx force:source:pull" command. :(

Lucky for me, I have an Illuminated Cloud license, and Illuminated Cloud very recently released a feature which enables performing a retrieve operation using the Metadata API and then transforming and merging it into an SFDX-formatted project structure. So, I am able to use this as a workaround for "sfdx force:source:pull".

But, without that, I would be totally unable to develop my SFDX project after creating a single Platform Event in my org.

It would be nice if Salesforce open-source the SFDX CLI tool to empower me to resolve this issue on my own without needing to wait for the DX product team to release a fix.
PatMcClellan__cPatMcClellan__c
Hey @Alex, SFDX CLI has had the deploy and retrieve commands for several months.
Jan TaksJan Taks
Any updates on this issue? I am running into exactly the same issues. I just can't believe these kinds of things are not getting fixed by Salesforce! I am relatively new to SF development but I keep on running into these frustrating little things that totally screw up my productivity. 
PatMcClellan__cPatMcClellan__c
Since I never use object translations, I just added this line to my .forceignore file: **objectTranslations
Jan TaksJan Taks
Thanks Pat. I have tried all possible entries my .forceignore file but nothing helps. Status show the following changes on remote:
 
STATE           FULL NAME                            TYPE                     PROJECT PATH
──────────────  ───────────────────────────────────  ───────────────────────  
Remote Add      Contract_Uploaded__e.contract_id__c  CustomField
Remote Add      Contract_Doc_Uploaded-en_US          CustomObjectTranslation

I created a Contract_Doc_Uploaded__e platform event but I have no idea why or what created the translation metadata. So I tried to get the  Contract_Doc_Uploaded-en_US with sfdx force:mdapi:retrieve but that did not retrieve anything either. I suppose 'pull' uses the same command behind the scenes.  

 I have added the following entries to .forceignore:
 
Contract_Doc_Uploaded-en_US.CustomObjectTranslation
**objectTranslations
CustomObjectTranslation/** 
CustomObjectTranslations/** 
CustomObjectTranslation/C**
**/CustomObjectTranslation/**

Non of these entries seem to stop de pull command from trying to pull the blocking object. 

So I am stuck. Obviously I could retrieve the other changes with MDAPI, convert to sfdx format and create a new scratch but I am affraid I will keep running into this issue every time I create a new platform event. 
Fred The DevFred The Dev
I was able to create a platform event and pull using SFDX in a fresh scratch org.
I can create fields, update them, no problems pulling and pushing.

As soon as I changed the platform event API name, using the UI, I could not pull anymore. Even deleting the event and trying to pull doesn't work. The only option was to delete the scratch org and start over.

I can change the name by changing the metadata on my computer and pushing back to the scratch org. This seems to work with no issues.
The only issue is changing the platform API name using the UI.

Until Salesforce fixes this the workaround is to change the API name in the metadata.

You can change the label with no problems.

Hopefully, this will help someone in the future.
 
Jeff HilyardJeff Hilyard

Here's a fix from within the scratch org.

This is an old question but I just had this problem so here's hoping I help someone else who puts a lot of time into building in the UI and then edits the API name of their Platform Event before pulling the source:

I was able to recover from this by marking the translation as obsolete in the SourceMember table/object.

Open the developer console from the scratch org, check the box "Use Tooling API" and execute the query:

SELECT Id,ChangedBy,IsNameObsolete,MemberIdOrName,MemberName,MemberType,RevisionCounter,RevisionNum From SourceMember where isNameObsolete=false

Then I looked for a row with a MemberType of customObjectTranslation and edited it's isNameObsolete value to be true (check the box) and clicked "Save Rows".

At that point sfdx force:source:pull worked.

I got the hint about the SourceMember table from this page: https://groups.google.com/a/illuminatedcloud.com/forum/#!topic/qanda/AJYQPpoUGzo

This was selected as the best answer
PatMcClellan__cPatMcClellan__c
@Jeff Hilyard, THANK YOU! It's an old thread but I just had this happen again to me and was banging my head to figure it out. This is the answer, finally! (Just tried it and it worked immediately.)