New answers tagged

0

Salesforce will strip trailing new lines from text fields, That would be easy to fix by starting the message on a new line instead of ending it with a new line. Simply replace: c.Quick_Notes__c = log + '[' + DateTime.now() +']: ' + note + '\n'; With: c.Quick_Notes__c = log + '\n[' + DateTime.now() +']: ' + note;


0

Same answer as rael_kid, but in one regex: replaceAll('\r\n|\n|\r',' ');


2

The first idea that came to me, is to add a technical field on account (flag, default = false). Extend your CSV with the new flag, set for all = true Update accounts Extract contacts with condition where Account.MyFlag__c = true update contacts Delete flag (since not more useful)


4

You could do this using a Process Builder (the downside is this uses more CPU so you could later hit CPU limit issues if you have a lot of other processing going on when contacts are updated). If you stick with this trigger-based approach note that you are doing far more iteration than needed and there's no need to query the account instances. I recommend ...


1

A good pattern to follow when writing a testmethod is the Given-When-Then pattern // Given a mock Account // When Account Updated // Then Verify Contact created then fill in the details // Given a mock Account Account mockAccount = new Account(...); insert mockAccount // When Account Updated Test.startTest(); update mockAccount; Test.stopTest(); // ...


0

Your trigger creates a new contact when Account is updated and if type = 'Prospect' @isTest public class Update_contact_based_on_accTest { public static testmethod void PrimaryAccountTest(){ Account acc = new Account(); acc.Name = 'Test'; acc.Type = 'Prospect'; insert acc; Profile p = [SELECT Id FROM Profile ...


1

You're correct in that it's the account being locked based on an operation on a child object. The 2nd link you provided and the example with Tasks/Accounts is basically the same scenario you're describing as the Account is the "parent" in both situations (Task and Contact). The Account would get locked by the operation on the Contact being associated to ...


1

This should work without issue. Suppose your E2C email is support@mycompany.com The E2C configuration binds this to some SFDC-generated address looking like blahblah..na56.salesforce.com If you define an Email Service foo, there is a SFDC generated address that looks like foo....apex.na56.salesforce.com Now, in your company's mail server, you set up auto-...


Top 50 recent answers are included