Andy in the Cloud

From BBC Basic to Force.com and beyond…

About

I started this blog to share some thoughts, ideas and opinions around my main passion in life computing, or more specifically these days Cloud computing. Who knows maybe I’ll go stray now and again into some of my others as well!

I am currently working for Salesforce.com in Product Management for the Platform. Previously FinancialForce.com CTO. Enjoying working and at times coding hard with everyone to make this new startup company a raging success! Along with our friends at Salesforce.com and UNIT4. I am pleased to have been selected as a Force.com MVP!

I am a Salesforce MVP. For more information on the Salesforce MVP community, visit: http://www.salesforce.com/mvp/. Salesforce, Force, Force.com, Chatter, and others are trademarks of salesforce.com, inc. and are used here with permission.

Any views expressed on this blog are entirely my own.

forcedotcom-mvp

209 thoughts on “About

  1. Hello, I’m having trouble using Declarative Lookup on salesforce. How could I get in touch?

  2. The Declarative Rollup looks great, is it free to use?

  3. Hi Andrew, I have a requirement where i need to develop a VF page through which i am able to create queue. So i can have functionality where user can create queue without having access to access to setup area and other permissions.

    Is there anyway to create custom queue page. Can you provide me some directions on same and if there is any other useful info related to it.

  4. I’m trying to download Declarative Lookup but am getting message that the package has been deprecated and can no longer be installed. Saying I should try installing a newer version or contact the package owner. Is there another version available and if so, how do I get a copy?

  5. that should have said- from app exchange, not – for app exchange

  6. I keep getting an error in my Relationship Criteria. I’m trying to calculate the AMOUNT of closed won opportunities YTD and for previous years (i,e., 01-01-2016 to 12-31-2016). FOr YTD, my criteria: StageName = Closed Won AND CloseDate >= 01-01-2017

    The error: Error: Relationship Criteria ‘StageName = Closed Won, CloseDate >= 01-01-2017’ is not valid, see SOQL documentation http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_select_conditionexpression.htm, error is ‘expecting a colon, found ‘Closed”

  7. Hi Andrew , I want to automate a report generation process :

    Report : we need to create a report containing Notes created for each lead in a month.

    What we do Manually:

    We query the data in two way : First we query all the required filed from the the Lead object . Secondly, we query notes record using lead Id as parent Id. Then we consolidate the data in Excel sheet . there is one row per Notes. Means Same lead can have 10 row in Excel if the 10 Notes have been created in a Month.

    For Automating :

    1. Created Custom controller.
    2. Fetch the record using inner query.
    3. Created a wrapper class according to the fields of Notes and Lead required in each row .
    4 Populated the data in wrapper class list.
    5. Then I created a visualforce page ( that will call the action in controller returning the list .
    6. Finally I am calling this Visualforce in a scheduler which return the data .

    But rows can be more 10000 or more . So I am getting String too large or more than 60k ..

    • I used this in page attribute : contenttype=”application/vnd.ms-excel#{!fileName}.xls” Page Name : AgentDealerFollowup

      I am using below code in scheduler :

      Datetime myDatetime = Datetime.now();
      String myDatetimeStr = myDatetime.format(‘ MMMM,yyyy’);
      EmailTemplate et = [SELECT id FROM EmailTemplate WHERE name = ‘Monthly Dealer Report Template’];
      Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
      ApexPages.PageReference report = new ApexPages.PageReference(‘/apex/AgentDealerFollowup’);
      attachment.setFileName(‘Agent Dealer Follow up’+ myDatetimeStr + ‘.xls’);
      attachment.setBody(Blob.valueof(report.getContent().toString()));
      //attachment.setContentType(‘text/csv’);
      Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
      message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
      // message.setSubject(‘Report’);

    • Try readOnly mode for your Visualforce page, it’s an attribute

  8. Hi Andrew, I’m trying to deploy DouglasCAyers/sfdc-reloadable-visualforce-lightning-component to my salesforce sandbox and I’m getting the following error: “Failures: pages/DemoAccountFlowPage.page(DemoAccountFlowPage):The specified Package Version number does not exist for that Package: dlrs, 2.8.” It says deployment complete but I don’t see the custom component. Any help would be useful I’m anxious to get this working in my org and it would help a lot. P.S I’m not familiar with the processes in Github Thanks!

  9. Him Andrew, I bought your book and I think is amazing. Just to tell you that on page 59, indicates that Data Replication is a REST API, and I think it is just SOAP.
    Again, thanks a million for writing such an amazing book.

  10. Hi Andy,
    I have had some great success with DLRS for my clients. I would like to do a webinar for them and show them how it might help them with some of their problems.
    I like to check in with authors before presenting their material.
    Please let me know if this is OK with you.
    Thanks… Bob

  11. Hi Andrew, following along with your amazing book and blogging myself about Salesforce Connect (https://salesforcegraells.wordpress.com/2017/10/30/salesforce-connect-amazon-rds-odata/) I read on page 76 that External Objects has some limitations on Reporting. As those limitations are not detailed, if those were related to the blog entry made by Mark Kovacevich (https://developer.salesforce.com/blogs/engineering/2016/02/salesforce-connect-reporting.html) on Feb 2016, it is very satisfying to know that they were superseded with new functionality on Winter 17 (http://www.odata.org/blog/Webinar-on-Salesforce-Connect-External-Object-Reporting/).

    Probably you wrote about other limitations, but just in case where those that were present on Mark’s article, I’d like to point it out.

    Again, thank you so much for what a wonderful book and blog.

  12. Hey Andy, I’m working on a project that uses the fflib architecture. We’ve been debating about whether or not trigger logic should be allowed call out to service classes. On one hand, it is an easy way to satisfy business rules such as ‘after on close of ProductOne, call ProductTwoService.activate()’. On the other hand it seems wrong for domain logic to call out to services.

    I guess ideally the structure would be:
    ProductOneService.close(productOnes) {
    new ProductOne(productOnes).close();
    ProductTwoService.close([select related productTwos]);
    }

    Would you recommend treating these sorts of updates as an implied service call? Or should the product be structured in a way that the only way to perform certain updates is via a service call?

    Thanks for any feedback! Love your work.

    John

    • Hey John, i think… i recall responding to a question like this before? Sometimes duplicate comments get posted so wanted to check. Did you get a response from me on this?

      • Hey Andy, a colleague and I were just having another discussion about this & I pulled up this post and saw that you had replied! I must have forgotten to tick the notification boxes and so missed your response.

        No, I haven’t received a response from you on this, but I’d love some advice. What criteria do you use to draw the line between ‘trigger logic’ and ‘not trigger logic’? I struggle sometimes between the convenience of a trigger and the greater readability of leaving logic outside of the trigger.

      • Service logic orchestrations tasks, that span multiple objects, often multiple queries and multiple updates, kind of like the conductor in a band. Trigger/Domain logic focuses on the integrity of your data, validation, defaulting etc. Some folks like to start processes from triggers so sometimes call the service layer from the that. I know there are sometimes no elegant altertnatives without creating a new UI, but i do regard that as a bit of an an anti-pattern. These days we have many more ways to customize the native UI, custom actions, components etc. these controllers can invoke the service.

  13. Hi Andy ,

    I am facing issue on Test class for Meta ServiceExample Class.
    I unable to get any wayout for this.

    Can you please help me

  14. Hi Andy ,
    Congratulations….Commendable work by you
    I am New to metadata Api . I have used your Code for The same and modified accordingly but i am not able to Run test class for it.
    Can you help me with the test class?
    I have raised an issue on The GITHUB. Please help me with the Issue
    (https://github.com/financialforcedev/apex-mdapi/issues/193)
    Please help me with this

  15. Hi Andrew
    Thanks for sharing your work and incredible articles. It really helps.

    I am trying to generate the latest Tooling API class using Tooling API wsdl download from Setup > Develop > API.
    It generate multiple classes….

    The Tooling API class here in this article is a single class.
    https://github.com/afawcett/apex-toolingapi

    Could you please guide how can i generate it.

  16. Hi Andy, I am getting the error message “This Remote Site Name already exists or has been previously used. Please choose a different name.”. If I delete that Remote Site and re-create it, will this affect any existing roll up summaries?

    • No, not at all, it’s only used when configuring them

      • Great, thanks so much!

      • Hi Andy, I have come across another issue. I updated to the most recent release (in an org that had previously installed it in 2014). In the Aggregate Operation field, all of the “concatenate” options, as well as First and Last, are missing from the picklist. I tried simply adding the picklist value, though I assumed that that wouldn’t work, and it did not. Is there something else that I need to do to get the Concatenate functionality? Thanks again!

      • Yes you need to add these. Double check the Readme release notes. I cannot recall the release, but if you scroll back through the release announcements you will see where I originally stated what you need to do in upgrading to the release that added these options.

  17. Hi Andrew – thanks so much for writing and posting this code. Awesome. Took me a few hours to create some list views but worked like a charm. Thanks so much!

  18. Hey Andrew. Your tools are amazing. I was wondering if I could ask you if there is a way to gather ‘consecutive’ records in the declarative lookup rollup summaries. I.e. if an account has 4 contacts named Noah Matt Noah Noah Matt created in that order, I could do a summary of contact records with a filter for Name = Noah, and that would show that Noah had come in twice in a row.

    If you have any ideas around this or how I might accomplish it that would be great.

  19. Great work Andrew…
    We have installed DLRS managed package and scheduled some rollups, having same child object.
    Sometime it gives exception “UNABLE_TO_LOCK_ROW”.
    Guide us on this.

    • Adjust the schedule to avoid overlap or if possible criteria. It’s a platform error to avoid inconsistent data. Review the wiki page on scheduling I added some notes at he weekend re retry logic.

  20. Hi I am trying to contact you and your telephone number isn’t working. I need to speak to you about your app that has been installed in our salesforce by the consultant who configured it. I have spoken to salesforce premier support and they need me to talk to you so you can log a case with them?
    Can you call me asap or email me a correct number?

    Thanks

  21. Hi Andrew,

    Hoping you can help. I’ve been running into an issue with Lookup Roll Calculate Jobs for a while, and I still haven’t managed to find a solution. I’m experincing the error “A calculate job for rollup ‘x’ is already executing.”. Sure enough, there are jobs which have failed to complete for whatever reason which I have to delete manually, however this is intermittent, sometimes all jobs will complete no issue, other times they will stumble and fail with that error. I have updated to 2.11 as I read this was a known issue prior to 2.8, but still the issue persists.

    Is there anything you can advise?

    Thanks, Jarrod.

    • Yes I am getting reports the fix is not always working. I have some more detail from another user. I will try to see what’s going on this weekend. Can you message my AndyInTheCloud user in Salesforce Community with your email and details if I need to reach out.

  22. Hi Andrew,

    Hoping you can be of assistance.

    I’m facing an issue whereby, if a record suddenly falls outside of the rollup criteria scope, historical field values are blanked out?

    So for example, one of my criterias is that the record data is within last 30 days. The rollup works fine, aslong as the date is within the last 30 days, but as soon as it falls outside of that date, the aggregate field is blanked.

    Is there a way to keep this data persistent historically?

    thanks

    • No, but you could have a workflow rule copy it over to another field but only when there is a value and it’s changed. Then use this field on your layouts, reports etc

  23. Hi Andrew, I am trying the GitHub SF deploy tool. Which is great tool. I am getting OATH error after click on allow. I land on your page but it just says oops something went wrong.. It gives me no further information. I am trying to connect to a sandbox which has a custom URL instead of test.salesforce.com. I also tried the same with my Developer Org which also has a custom URL. In both cases I am getting some error as mentioned above. Can you please check and help?

  24. Hello Andrew,

    My org. installed Declarative Lookup Rollup Summaries Tool in 2017. I guess we have a field called “Contact Spend this Year” which will rollup all the opportunity Amount to the contact. Now business requirement is to change the fields and criteria. as its a managed package; i dont know where to make the necessary changes. Can you please help me on this.

    Thanks,
    Rakesh

    • This tool is declaratively driven which means that you can change such things with clicks not code! Find the Declarative Rollup Summaries app in your drop down (classic UI) or launcher (lightning UI). Then first check the Manage Rollup Summaries tab for the rollup, if not check the Lookup Rollup Summaries tab for it. Hopefully whoever configured the tool in 2017 used obvious names / descriptions. If not focus on the Parent and Child fields to locate and obviously check the Relationship Criteria field on the rollup definition matches your current expectations of how it works. If you run into problems the Chatter Community Group for the tool is full folks who can help as well. https://github.com/afawcett/declarative-lookup-rollup-summaries (see README for group link).

  25. Is there a sandbox version of the Declarative Rollup Summary Tool? We have to test all new packages in a non-production environment here.

  26. Having a problem with DLRS on Salesforce. Is there a support person I can talk with?

  27. Hi Andrew,

    I am a new SF developer, bought your enterprise architecture book, liked it very much, especially the separation of concerns, unit test sections.
    Though I have only been in SF for a short period of time, when I read those sections, “exactly that is my pain point!” comes often in my mind.

    Do you think if i could have the honor to invite you once as the guest of my salesforce developer podcast show (http://salesforceway.com)?

    Thanks for your excellent book and knowledge sharing!

    Br,
    Xi

    • I would be totally honored to do this. Contact me via DM on Twitter and we can arrange some time to chat about it. Thank you!

  28. Hi Andrew, I want to do a DLRS rollup summary on a rollup summary field. I gave this a quick test and it seemed to work fine but we’ve a big expansion phase coming up and people in my organisation are worried it might cause problems. Can you confirm that everything should work alright?

    • Thats quite a wide open question tbh not having enough details its hard to given you a steer. Its a very powerful tool thats easy to use so i have seen some folks create way to many rollups when say reports or dashboards could be an altnerative then making the system do the work on every edit. You should also check out the wiki page for the tool that talks about using schedule mode, again i think sometimes when real time rollups are less important this can be used. So if you plan to do a lot of rollups plan the options you are going to take. Hope this helps.

  29. Hi Andy. my organisation would like to use DLRS for their rollups. They’ve got a big expansion phase coming up and are worried that a roll-up on a roll-up field might not update probably. Is it fine to make a rollup on a roll-up field?

    • If you use the Realtime mode this should be ok, as one will trigger the other. Where it gets complex is if you have to switch to the differed/schedule mode for some rollups as their is no way currently of defining the dependency between rollups. If you do need to mix i would only use the scheduled mode for your top-level rollups and make child ones realtime. Hope this helps.

  30. Hi Andy,

    Looking at some of your projects, I see you make use of many inner classes, for example in the MetadataService class. I have a feeling this is being done because of the lack of namespaces/packages in Apex, but at the same time, I feel it gives the outer class too many responsibilities, and some would argue that this violates the SRP.

    Could you please share some thoughts on this? I’m currently struggling with my code base due to the namespaces/packages limitation and I’m wondering if using inner classes the way you are using them, would help me.

    Thanks!

    • Yes that is a good observation and yes that is sometimes the reason. In terms of SRP, if the Outer class is really just a makeshift namespace with no features of its own, its not so bad, but of course it makes the class file large. The other thing that can be done is a prefix, e.g. fflib_, di_ etc. It’s ugly I know. One recent thought i had was a hybrid of the two, whereby the private/impl classes used a prefix and the ones designed for mainstream use got housed in a class with inner classes mostly delegating to the prefixed classes. Kind of like a public/private api style? As i say i’ve not really tried this out much. For me the main thing to watch is Unlocked Packages support Namespaces, see here for more thoughts https://andyinthecloud.com/2018/06/16/salesforce-dx-packages-and-open-source/

  31. Hi Andy,

    I am trying to reach you from few days regarding usage of apex common library. I am also reading your book edition 2 and it’s really helpful. Thank you very much

    We have a existing salesforce implementation, we have most of the login in triggers and trigger handlers. We are still using classic and no mobile or other UI.

    1. We have huge amount of logic in trigger handlers, once we refactored this in selector, domain, service and uow. We still have large amount of code in domain classes. We wrote some helper classes with public methods. Is there any other better pattern to refactor domain classes that are huge.

    eg. we have 30 field validations and 20 field defaults and the field defaults. Related object updates etc.

    2. We have default fields on before update event too, for this I extended the domain base class with this method, I know this is not upgrade safe. Is there a better option ?

    public virtual void onApplyDefaults(Map existingRecords) { }

    3. We have custom setting to to turn on and off triggers. for now it seems we need to write extra line of code in the trigger. is there any other better option for this ?

    if(customsetting){
    domainclass.getTriggerEvent(YourDomain.class).disableAll()
    }
    call domainclass here

    • Hello! Sorry for the late response.

      RE: 1, helper classes are good, but I would also consider domain base classes per the chapter in my book this can help you group shared logic between certain objects that have similar behaviors. You can use virtual or abstract methods in your own base classes much like the fflib_SObjectDomain to allow extension classes to customize your base classes behavior if need. You may also consider splitting groups of field validations into separate classes that implement a standard interface (e.g. IFieldValidator.validate) that can be used by the domain class to build a list of applicable validations based fields that have changed then execute them. This also helps with performance. Be careful though with SOQL/DML done in such classes, try to pass in the required state if possible to the validators.

      RE: 2, yes that does appear to be a missing feature. Meanwhile to make to avoid editing the base try public override void handleBeforeUpdate(Map existingRecords) { onApplyDefaults(existingRecords); onBeforeUpdate(existingRecords);}

      RE: 3, you could put this in the inner domain class constructor class at the bottom of your domain class perhaps? To encapsulate it better. Though if you are disabling all events it’s arguably more efficient to just by-pass the domain handler in the trigger code completely. if(customsetting){
      domainclass.getTriggerEvent(YourDomain.class).disableAll()
      } else { call domainclass here }

      Hope this helps!

  32. Hi Andy, I am using the apex-mdapi to update a custom label in Apex. Is there a way to check that it has been correctly changed before proceeding?

  33. Hi Andy!
    I have your app installed but unfortunately our IT team has asked that I uninstall and I’m having issues removing it. Salesforce support said that the issue is that I have lost the API connection but your app is recognizing that our site name is/was already connected. He recommended that I ask if our domain could be removed from your list. Is this something that you can help with? If not can you tell me what to do to re-establish the connection? Thanks!

  34. Hi Andy,

    I’m using DLRS and it’s been working well! Except, I just ran into an issue when trying to deploy a DLRS roll-up field on a custom object in Production. I get an error that the test coverage is 0 %. I first created and deployed the field in a fullcopy Sandbox and it worked perfectly. But now in Production, I re-created the DLRS field from scratch, and when it was deployed, it failed. Here’s the error message displayed:

    Warning:dlrs_AdvisingTrigger:Test coverage of selected Apex Trigger is 0%, at least 75% test coverage is required
    Error:dlrs_AdvisingTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Advising: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.AdvisingTriggerHandler.SetAffiliation: line 79, column 1 Trigger.Advising: line 8, column 1: [] Class.dlrs.RollupService.testHandler: line 282, column 1 Class.dlrs_AdvisingTest.testTrigger: line 11, column 1

    Please advise

  35. Hi Andy,
    I am using dlrs for our organisation’s database. Unfortunately we are getting this error:
    ERROR: dlrs_ContactTrigger: System.LimitException: dlrs:Too many query rows: 50001
    What is the workaround for this please?
    Kind regards
    Emma

    • This is a platform limit and requires you to review your lookup filter criteria ideally you can reduce the records needed and/or move some rollups to schedule more. There is some details on the readme file about limitations and you can find information on schedule more on the GitHub wiki. Finally the readme has a link to a great chatter Group in the Community.

  36. Hi Andy, I’m not a developer, but a mere mortal Salesforce functional administrator happily using DLRS. Until recently, that is. I suspect that something changed in Summer ’19. The Apex trigger for CampaignMember can’t be deployed anymore. I refreshed my installed package so that it’s back on status “passed”. This is the error message:

    dlrs_CampaignMemberTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: MALFORMED_ID, Invalid campaign id: null: [CampaignId] Class.dlrs.RollupService.testHandler: line 282, column 1 Class.dlrs_CampaignMemberTest.testTrigger: line 11, column 1

    Here are my questions:
    – Although the problem seems obvious (CampaignId field is not populated), I have no idea where to find this incorrect code, let alone change it. Can you tell me how to find it?
    – Could this be a general bug in DLRS, not limited to my org?
    – Is this blog the proper platform for my questions?
    Thanks.
    Eric Delahay
    Tilburg University
    Tilburg, The Netherlands

  37. Hello Andrew,
    Four your information, I was not the one in charge of the DLRS setup 2 years ago.
    When I try to send a bill, there is the following message :
    “Error : Update failed. First exception on row 0 with id a0V1t00000FOURvEAP; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_sofactoapp_Factures_clientTrigger: execution of AfterUpdate caused by: dlrs.RollupServiceException: Lookup Rollup Summary ‘CA Facturé pour opportunité’ is invalid, your org configuration may have changed. (dlrs) : []”

    And when I try to delete a “rough” bill, there is this message :
    “Validation Errors While Saving Record(s)
    There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was “Apex trigger dlrs_sofactoapp_Factures_clientTrigger caused an unexpected exception, contact your administrator: dlrs_sofactoapp_Factures_clientTrigger: execution of AfterDelete caused by: dlrs.RollupServiceException: Lookup Rollup Summary ‘CA Facturé pour opportunité’ is invalid, your org configuration may have changed.: (dlrs)”.”

    The issues came out last week and I have not been aware of any org configuration changes. Do you have any suggestions about these issues ?

    Thanks in advance,
    Cédric Pagès

    • So this could be that one of the fields referenced on the rollup ca fracture pour opportunite has been renamed or deleted. Open that rollup summary and resave it and see if you get any errors.

  38. Hey Andy,
    Thanks for the great tool dlrs and knowledge sharing on the blog. We are moving few things to change data capture in our org, was wondering if dlrs can be put on change event object, more like async apex triggers instead of direct trigger on object ?!
    Hope you could shed some light on this.

    Thanks
    Prashant

  39. Hi, will Declarative Lookup Rollup Summaries Tool be updated for Lightning?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s