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

"Apex Trigger .. has not been deployed"; too restrictive for dev-to-stage-to-prod workflow #94

Closed
cropredy opened this issue Nov 29, 2014 · 30 comments

Comments

@cropredy
Copy link

Here's our deployment model:

  1. Create LRS entry in Dev; click Manage Child Trigger (trigger deployed into Dev); click LRS active checkbox
  2. Use ANT to push changed apex from Dev to Stage sandbox. This includes the dlrs__xxx trigger/test class created in Administrative Lock on account #1
  3. Go to Stage sandbox, create a LRS to match the one in Dev
  4. Click Active checkbox on Stage LRS record

Oops - won't work as DLRS returns this error:
Error: Apex Trigger dlrs_xxxTrigger has not been deployed. Click Manage Child Trigger and try again.

where xxx is the name of the child object

But the trigger/test class are deployed, but not via DLRS, but via the Ant build

The only way around this is to delete (or never include in the ant build) the trigger/test class and then deploy via the Manage Child Trigger button in Stage sandbox (and PROD)

So, suggestion(s):

  1. Update the doc to tell users not to do this (probably under a section organized by error message) or ..
  2. When clicking 'Active' checkbox on LRS page, if the trigger/test class are already present, use them, or, if this is not possible, tell the user that they were found but not deployed via Manage Child Trigger and must be removed.
@afawcett
Copy link
Collaborator

afawcett commented Dec 5, 2014

It should match on the name of the trigger (derived from the child object name). When it deploys the trigger its using the same Metadata API that your Ant solution is using. So i'm confused. If you let DLRS deploy in production does it use a different trigger name?

@afawcett
Copy link
Collaborator

@cropredy Any thoughts on my last comment, can you confirm the generated name of the trigger and class is the same in both sandbox and production?

@cropredy
Copy link
Author

trigger names were identical between Dev sandbox and stage sandbox - as they would be when deploying via Ant -- I could see the triggers in Stage Sandbox Setup | Develop | Triggers and the sobject name was the same between dev sandbox and stage sandbox.

@afawcett
Copy link
Collaborator

The validation when setting the Activate checkbox simply looks up on the ApexTrigger object for the name of the trigger as specified in the error message.

So your saying you get something like this...

Error: Apex Trigger dlrs_MyObjectTrigger has not been deployed. Click Manage Child Trigger and try again.

And yet you can clearly see under Setup > Develop > Triggers, that dlrs_MyObjectTrigger exists?

Can you confirm the exact error message? As there is a potential problem when the logic has to truncate the apex trigger name due to max 32 character trigger names.

@oavon
Copy link

oavon commented Dec 22, 2014

hello Andrew,

Thanks so much for your answer

I can go further now

But i have another problem, hihi

Message below

If you ever have some times to tell me what i do wrong;-)
thanks in advance
olivier

Deployment CompleteTest failure, method:
RollupControllerTest.testNotDeployedStatus -- System.AssertException:
Assertion Failed: Expected: /**

  • Auto Generated and Deployed by the Declarative Lookup Rollup
    Summaries Tool package (dlrs)
    /
    trigger dlrs_ContactTrigger on Contact
    (before delete, before insert, before update, after delete, after
    insert, after undelete, after update)
    {
    dlrs.RollupService.triggerHandler();
    }
    , Actual: /
  • Auto Generated and Deployed by the Declarative Lookup Rollup
    Summaries Tool package (dlrs)
    **/
    trigger dlrs_ContactTrigger on Contact
    (before delete, before insert, before update, after delete, after
    insert, after undelete, after update)
    {
    RollupService.triggerHandler();
    } stack Class.RollupControllerTest.testNotDeployedStatus: line 162, column 1

Test failure, method: RollupControllerTest.testDeployedStatus --
System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupControllerTest.testDeployedStatus: line 62, column 1

Test failure, method: RollupServiceTest.testCountById --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack Class.RollupServiceTest.testCountById:
line 307, column 1

Test failure, method: RollupServiceTest.testCountByType --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testCountByType: line 249, column 1

Test failure, method:
RollupServiceTest.testLimitsConsumedWithConditions --
System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testLimitsConsumedWithConditions: line 647,
column 1

Test failure, method: RollupServiceTest.testMultiRollup --
System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testMultiRollup: line 119, column 1

Test failure, method:
RollupServiceTest.testLimitsConsumedWithoutConditions --
System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testLimitsConsumedWithoutConditions: line 768,
column 1

Test failure, method: RollupServiceTest.testMultiRollupNoConditions --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testMultiRollupNoConditions: line 192, column
1

Test failure, method: RollupServiceTest.testMultiRollupWithTwoParents
-- System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest.testMultiRollupWithTwoParents: line 400,
column 1

Test failure, method:
RollupServiceTest2.testChangeInCriteriaReferencedField --
System.QueryException: No such column 'NumberOfLocations__c' on entity
'Account'. If you are attempting to use a custom field, be sure to
append the '__c' after the custom field name. Please reference your
WSDL or the describe call for the appropriate names. stack
Class.RollupServiceTest2.testChangeInCriteriaReferencedField: line
415, column 1

Test failure, method: RollupServiceTest2.testChangeInRelationship --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest2.testChangeInRelationship: line 456, column 1

Test failure, method:
RollupServiceTest2.testMultiRollupBothScheduledWithConditions --
System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest2.testMultiRollupBothScheduledWithConditions:
line 89, column 1

Test failure, method: RollupServiceTest2.testMultiRollupOneScheduled
-- System.DmlException: Insert failed. First exception on row 1; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest2.testMultiRollupOneScheduled: line 173, column
1

Test failure, method:
RollupServiceTest2.testScheduleItemsAndLogsCleanup --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Object does not exist.:
[ChildObject__c] stack
Class.RollupServiceTest2.testScheduleItemsAndLogsCleanup: line 307,
column 1

Test failure, method: RollupServiceTest2.testScheduleItemsAndLogs --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Object does not exist.:
[ChildObject__c] stack
Class.RollupServiceTest2.testScheduleItemsAndLogs: line 227, column 1

Test failure, method: RollupServiceTest3.testCalculateJob --
System.NullPointerException: Attempt to de-reference a null object
stack Class.RollupServiceTest3.testCalculateJob: line 51, column 1

Test failure, method: RollupServiceTest2.testUnDeleteRealtime --
System.QueryException: No such column 'NumberOfLocations__c' on entity
'Account'. If you are attempting to use a custom field, be sure to
append the '__c' after the custom field name. Please reference your
WSDL or the describe call for the appropriate names. stack
Class.RollupServiceTest2.testUnDeleteRealtime: line 541, column 1

Test failure, method: RollupServiceTest3.testCalculateJobNotActive --
System.NullPointerException: Attempt to de-reference a null object
stack Class.RollupServiceTest3.testCalculateJobNotActive: line 139,
column 1

Test failure, method:
RollupServiceTest3.testDateRollupInsertConditionalChild --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest3.testDateRollupInsertConditionalChild: line
343, column 1

Test failure, method: RollupServiceTest3.testDateRollupDeleteChild --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Field does not exist.:
[AggregateResultField__c] stack
Class.RollupServiceTest3.testDateRollupDeleteChild: line 296, column 1

Test failure, method: RollupServiceTest3.testDeveloperAPI --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Object does not exist.:
[ChildObject__c] stack Class.RollupServiceTest3.testDeveloperAPI: line
214, column 1

Test failure, method:
RollupServiceTest3.testRollupWithInAccessibleParent --
System.DmlException: Insert failed. First exception on row 0; first
error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Object does not exist.:
[ChildObject__c] stack
Class.RollupServiceTest3.testRollupWithInAccessibleParent: line 386,
column 1

Test failure, method:
RollupSummariesTest.testInsertBadFieldTypeSumNotValid --
System.AssertException: Assertion Failed: Expected: Sum/Avg doesnt
looks like valid for dates ! Still want, then implement the
IRollerCoaster yourself and change this class as required., Actual:
Field does not exist. stack
Class.RollupSummariesTest.testInsertBadFieldTypeSumNotValid: line 255,
column 1

Test failure, method:
RollupSummariesTest.testInsertCountByCloseDateNoErrors --
System.AssertException: Assertion Failed: Expected: 0, Actual: 1 stack
Class.RollupSummariesTest.testInsertCountByCloseDateNoErrors: line
342, column 1

Test failure, method:
RollupSummariesTest.testTriggerAndTestClassNaming --
System.NullPointerException: Attempt to de-reference a null object
stack Class.RollupSummaries.calculateComponentName: line 230, column 1
Class.RollupSummaries.makeTriggerName: line 205, column 1
Class.RollupSummariesTest.testTriggerAndTestClassNaming: line 271, column 1

Code coverage issue, class: RollupServiceTest2Trigger -- Test coverage
of selected Apex Trigger is 0%, at least 1% test coverage is required

@afawcett
Copy link
Collaborator

What are you trying to do here? Install the tool?

@oavon
Copy link

oavon commented Dec 22, 2014

exactly :-)
it was OK in sandbox
but seems pretty complicated in production (enterprise )

if you have any clue?
it will be much appreciated
thanks a lot :-)

Oliver
+33611674518
On Dec 22, 2014 3:35 PM, "Andrew Fawcett" [email protected] wrote:

What are you trying to do here? Install the tool?


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

Unless your editing the code, i would recommend in both sandbox and production that you install the packaged version of the tool? https://github.com/afawcett/declarative-lookup-rollup-summaries#packaged-release-history

@oavon
Copy link

oavon commented Dec 22, 2014

Thanks Andrew

it's what i tried with your GithUb deploy to Salesforce Button.
but i got the error message below;-(

Thanks
best
olivier


Oliver
+33611674518

On 22 December 2014 at 16:07, Andrew Fawcett [email protected]
wrote:

Unless your editing the code, i would recommend in both sandbox and
production that you install the packaged version of the tool?
https://github.com/afawcett/declarative-lookup-rollup-summaries#packaged-release-history


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

Yes the GitHub Deploy to Salesforce Button is only for developers intending to edit / customise the code or add features to submit back. If your only using the tool, please use the package install links, you will not get these problems.

@oavon
Copy link

oavon commented Dec 22, 2014

Thanks a lot Andrew,

Sorry to ask, i just dont understand what is the "package install link"

Do i need this bad Eclipse software then? :-(

Thanks
olivier


Oliver
+33611674518

On 22 December 2014 at 16:28, Andrew Fawcett [email protected]
wrote:

Closed #94
#94
.


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

No, not at all, you simply click the package install link here and follow the prompts to install into your org. No need for any tools at all.

@oavon
Copy link

oavon commented Dec 22, 2014

waooo,

great, thanks a lot

i feel dumb!

best
Olivier


Oliver
+33611674518

On 22 December 2014 at 16:32, Andrew Fawcett [email protected]
wrote:

No, not at all, you simply click the package install link here
https://github.com/afawcett/declarative-lookup-rollup-summaries#packaged-release-history
and follow the prompts to install into your org. No need for any tools at
all.


Reply to this email directly or view it on GitHub
#94 (comment)
.

@cropredy
Copy link
Author

Andrew -- looks like you closed this issue but because it got conflated with oavon's issue. To your question:

The validation when setting the Activate checkbox simply looks up on the ApexTrigger object for the name of the trigger as specified in the error message.

So your saying you get something like this...
Error: Apex Trigger dlrs_MyObjectTrigger has not been deployed. Click Manage Child Trigger and try again.

And yet you can clearly see under Setup > Develop > Triggers, that dlrs_MyObjectTrigger exists?

Answer: YES, that is the error I got. And yes, the trigger was in Setup | Develop | Triggers. This is the trigger name: dlrs_Agreement_Line_ItemTrigger.trigger - 34 characters exclusive of the file type. Per this, maxlen of trigger name is 255

@afawcett afawcett reopened this Dec 23, 2014
@afawcett
Copy link
Collaborator

Yes your correct trigger and apex class name is 255, either way, its not truncating it, so my theory as to what is going on is not sound. So my next suggestion would be to enable subscriber support in the org refusing to activate the rollup. So that i can go in, reproduce it and grab a debug log with the full code trace in it. Would you be able to enable that and give me the org id?

@cropredy
Copy link
Author

This may be tricky for me to set up as I worked around the issue as originally stated. Give me some time here and I'll let you know when I can reproduce

@cropredy
Copy link
Author

OK, here is some more info but not exactly what you asked for as I can't give you access to these orgs

  1. We are running a Deployment Validation using ANT into our Production org
  2. We have a test class that runs as @istest V31 to test a class that mocks DLRS rows. That is, we know the trigger already exists because it was deployed as metadata a sprint release ago but since I don't like to have testmethods that are SeeAllData=true, I wrote a utility method to mock the DLRS row for those tests that require a DLRS to be present.
  3. The testmethod that tests the DLRS mocking runs fine in dev and stage sandboxes; but when it runs (via a PROD validation), it fails with the message below where I am using an upsert to (insert) a mock DLRS row.
  4. FIELD_CUSTOM_VALIDATION_EXCEPTION, Apex Trigger dlrs_Agreement_Line_ItemTrigger has not been deployed. Click Manage Child Trigger and try again.: [dlrs__Active__c]
    (dlrs__LookupRollupSummary__c:{Name=ProductLineItemCount, dlrs__ChildObject__c=Agreement_Line_Item__c, dlrs__RelationshipField__c=ContractID__c, dlrs__ParentObject__c=Contract, dlrs__AggregateOperation__c=Count, dlrs__RelationshipCriteria__c= line_item_type__c IN ('Content Product Line Item','Product Line item'), dlrs__RelationshipCriteriaFields__c=line_item_type__c, dlrs__Active__c=true, dlrs__FieldToAggregate__c=CreatedDate, dlrs__CalculationMode__c=Realtime,

dlrs Stack Trace
class.UtilityFns.mockDLRS: line 932, column 1
Class.TestUtilityFns.testMockDlrsNoOrgData: line 351, column 1

  1. The trigger does exist in PROD - see attached image:
    image
  2. We're at V14 of DLRS in PROD; deploying user has System Administrator profile and access to all DLRS sobjects
  3. In PROD, if I click Manage Child Trigger for the DLRS in question, I get expected Info message:
    image
  4. The mocking is done via simple setup (some bits omitted for clarity)
Map<String,dlrs__LookupRollupSummary__c>    dlrsNameToMockDlrsMap   = new Map<String,dlrs__LookupRollupSummary__c> {
'productlineitemcount' =>new dlrs__LookupRollupSummary__c(  
   name = 'ProductLineItemCount',                                                                       
   dlrs__Active__c = true,                                                                      
   dlrs__AggregateOperation__c          = 'Count',                                                                                  
   dlrs__AggregateResultField__c        = 'Product_Line_Item_Count_rsf__c',
   dlrs__CalculationMode__c         = 'Realtime',                                                               
   dlrs__ChildObject__c             = 'Agreement_Line_Item__c',                                                                                 
   dlrs__FieldToAggregate__c            = 'CreatedDate',                                                                                    
   dlrs__ParentObject__c                = 'Contract',                                                                                   
   dlrs__RelationshipCriteriaFields__c  = 'line_item_type__c',                                                                                  
   dlrs__RelationshipCriteria__c        = ' line_item_type__c IN (\'Content Product Line Item\',\'Product Line item\')',                                                                                    
   dlrs__RelationshipField__c           = 'ContractID__c') };

upsert dlrsNameToDlrsMap.values();

So, I'm baffled -- the trigger exists in all envs, the testclass exists in all envs, but when we try to mock a DLRS row via a testmethod with seeAllData=false, we get the error in #4 above - but only in PROD now

@afawcett
Copy link
Collaborator

afawcett commented Apr 8, 2015

Are you stilling getting this issue with your DLRS test?

Have you got the latest release?

@afawcett
Copy link
Collaborator

afawcett commented Apr 8, 2015

Also can you try to do upsert the DLRS records one by one, instread of in bulk as your doing via upsert dlrsNameToDlrsMap.values();

@afawcett
Copy link
Collaborator

@cropredy Sorry this one is dragging, any thoughts on my latest questions?

@vadkinson
Copy link

Hi Andy -
We are having a similar issue to this one with our Salesforce instance and were hoping to get your help. When we try to activate a DLRS from the Lead to the Task objects, we get an error message stating: Apex Trigger dlrs_TaskTrigger has not been deployed. Click Manage Child Trigger and try again. However, from the Manage Child Trigger, screen, the screen indicates that the trigger has already been deployed.
We're having a another, seemingly unrelated, issue deploying a Contact to Campaign Member rollup. The error message that we receive references the MailChimp Subscribers object (see screenshot below) and we're trying to understand the connection:
screen shot 2015-05-06 at 2 18 49 pm

Please let us know if you can help us troubleshoot these issues. Much appreciated!

@afawcett
Copy link
Collaborator

Sorry for the late reply, i've been on holiday.

Can you include a screenshot of the Lead to Task trigger activation error as well please?

Also if you run MCSubscriberTest test via the standard Salesforce Setup or Developer Console UI does give the same error?

@DanielleLutsky
Copy link

Hi Andrew. Victoria and I work together - we resolved the first issue that she sent over, but now were running into a different issue. We love the app, so hopefully this can be resolved.

Our client is using the nonprofit starter pack and trying to convert a lead to a contact that already exists. They're getting a DLRS error.

screen shot 2015-06-04 at 3 12 35 pm

@afawcett
Copy link
Collaborator

afawcett commented Jun 6, 2015

Hmmm i thing there is something special about Leads and Tasks around this tool, i've seen a few other issues crop up recently. Can you send me a screen shot of the rollup/s you have, i'd like to try and replicate. Also the steps your doing to get to the above screen, as i am not a big CRM app expert.

@DanielleLutsky
Copy link

Here's a screen shot:

image

Were just creating a lead; clicking convert which brings you to the lead
conversion page, then clicking convert again, and we get the dlrs error.

I want this to work so badly, we need it for so many of our analytics. Your
help is so appreciated!

Danielle Lutsky

Director of Consulting

[email protected]

On Sat, Jun 6, 2015 at 5:02 AM, Andrew Fawcett [email protected]
wrote:

Hmmm i thing there is something special about Leads and Tasks around this
tool, i've seen a few other issues crop up recently. Can you send me a
screen shot of the rollup/s you have, i'd like to try and replicate. Also
the steps your doing to get to the above screen, as i am not a big CRM app
expert.


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

afawcett commented Jun 8, 2015

Wow this is a complex setup, any chance i can login via Subscriber Support and grab a debug log? If you r ok to set this for the next few days, and tell me which Lead to click Convert on, i'll see what i can see from the Debug Log.

@DanielleLutsky
Copy link

I just granted you log in access.
I cant activate these until the evening when everyone is logged off.. we'll
have to coordinate. Can you email me personally to set something up?

Im not sure its the complexity of the org thats affectng things; its
happening in many orgs around the new lead conversion page on the nonprofit
starter pack.

Danielle Lutsky

Director of Consulting

[email protected]

On Mon, Jun 8, 2015 at 3:20 PM, Andrew Fawcett [email protected]
wrote:

Wow this is a complex setup, any chance i can login via Subscriber Support
and grab a debug log? If you r ok to set this for the next few days, and
tell me which Lead to click Convert on, i'll see what i can see from the
Debug Log.


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

afawcett commented Jul 1, 2015

I've recently written up some shared details on the code coverage issue described in this case, please check the details here and comment at the bottom of the wiki page.

@DanielleLutsky
Copy link

Thank you andrew! I'll check this out!

Danielle Lutsky

Director of Consulting

[email protected]

office: (718) 392-3085

cell: (917) 438-8553

Please note that I will be out of the office from June 27-30th, and July
28-August 11th.

On Wed, Jul 1, 2015 at 2:57 PM, Andrew Fawcett [email protected]
wrote:

I've recently written up some shared details on the code coverage
https://github.com/afawcett/declarative-lookup-rollup-summaries/wiki/Challenges-with-Code-Coverage
issue described in this case, please check the details here and comment at
the bottom of the wiki page.


Reply to this email directly or view it on GitHub
#94 (comment)
.

@afawcett
Copy link
Collaborator

afawcett commented Jul 4, 2015

Thanks, i've been reviewing this issue and its morphed several times from one issue to another, so i am going to close it now. Would you mind opening a new issue if you do happen to still have a problem. Thanks and appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants