Cannot create trigger on custom object
It is not possible to create a trigger on a custom object.
Prerequisites
DevOrg with namespace and managed package. Package is managed released (not beta). Custom object is also released.
Steps to repeat
- open new apex trigger wizard in IC
- select custom object
- select After Update
- confirm with OK
Expected
Trigger is deployed to Salesforce
Actual
Trigger cannot be deployed with the following error message:
Deployment Failed: INVALID_ARGUMENT_TYPE - Invalid object or access for CustomObject__c on field [TableEnumOrId]
Note that the namespace prefix is missing from the object type in the error message.
Comments (10)
-
reporter -
repo owner Thanks for reporting, Alexander. Let me take a look and see if I can reproduce this. Is it consistently reproducible for you? I'm pretty sure I created a new trigger on custom object via IC just this week with no problem. Also, if you can reproduce it, does the same behavior occur if you switch to the Metadata API? You can do so by unchecking Prefer Tooling API for>Apex in Illuminated Cloud>Configure Application>Validation & Deployment.
-
reporter This can be reproduced in two different projects. Standard objects are not affected. When i disable the tooling API, the trigger can be deployed without the error message.
-
repo owner Okay, that helps. This is a bug I've reported to Salesforce with metadata creation via the Tooling API. I may just take out Tooling API-based metadata creation for now given that it seems to be causing issues for folks. Thanks for confirming!
-
I can repro this exact scenario. Trying to develop in our packaging org on 12/6/2018
-
As a note -- if I switch to NOT Prefer Tooling API (which then uses the Metadata API) I can deploy as expected.
-
repo owner Yep, it's a bug on the Salesforce side. As I mentioned, I may just route all Apex file creation to occur through the Metadata API until Salesforce fixes this.
-
repo owner Delivered in 2.0.0.2. I will also be updating IC1 with the fix tomorrow morning and will keep this open until I do so.
-
repo owner - changed status to resolved
Delivered for IC1 in 1.8.1.5.
-
repo owner - changed component to Metadata Deployment/Retrieval/Removal
- Log in to comment
When i create the trigger in the Salesforce webinterface, i can update and save it in IC without any issues afterwards.