• msaz87
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 31
    Replies
I'm trying to use the REST API SObject Get Updated resource to give me a list of updated/deleted Accounts during a period of time, but I'm getting bogged down by irrelevant updates.

Ideally, I'd like to only bring in Accounts that had changes to specific fields during that period of time. Is that possible?

Example: I want a list of Account Ids for any Account that had its name changed during a period of time. When I use Get Updated, it gives me those Ids as well as every Account Id that had any other change that I don't care about (e.g. address change).
  • March 13, 2017
  • Like
  • 0
I'm trying to disable an old trigger, chatter_answers_question_escalation_to_case_trigger, via Eclipse, but when I try to deploy it I get the error, "Entity is not org-accessible."

It appears that the the sobject type for the trigger in the sandbox is "Question" but that object no longer exists in production.

User-added image

From what I've gathered via other forums is this relates to the removal of Chatter Answers in the Summer '16 release. In fact, I still have a "Chatter Answers" section in my setup in sandbox, but not in Production.

Sandbox:
User-added image

Production:
User-added image

How can I fix this to allow me to disable the trigger in production?
  • September 11, 2016
  • Like
  • 0
I'm repeatedly getting the following error in my flow, which is supposed to lookup matching FeedItems, then delete them:
An error occurred at element Find_Matching_Posts (FlowRecordLookup). unable to parse field as dataType could not be retrieved for the passed field: RawFieldImpl[tableName: FeedItem, columnName: CreatedById__NotFound]
It looks like this might be an SFDC bug, as listed here, but I wanted to make sure I wasn't doing something wrong.

Here's my flow:
User-added image
User-added image
User-added image
It's a headless flow that errors seemingly every time I run it (though it did process correctly at least once). Any ideas? Is this just a bug, or am I doing something wrong?
I wanted to use Process Builder + a flow to automatically delete the chatter post generated on an account when a lead is converted. I've created both parts, but it doesn't seem to be working...

Here's the process builder:
User-added image

It triggers on the "Feed Item" object, when an object is created or edited, with no recursion.

The action group criteria is pretty basic for now, just to test it -- with the only condition being FeedItem Type = "Tracked Change"
User-added image

And the only action is to launch the flow that deletes the record...
User-added image
The flow is just one part:
User-added image
Taking the variable ID from the Process Builder and deleting it
User-added image

Any ideas why this wouldn't work?
I have a PB flow which is meant to send reminders to change an opportunity's stage after a date has expired. There's multiple emails that go out -- an hour after the date elapses, a day after, etc -- but the problem is that even after the opportunity's stage has been changed, the alerts don't stop. It was my understanding that once the record no longer qualified for the rules, it wouldn't continue the flow.

Here's the flow:

User-added image

User-added image

So if the first scheduled action fires, and the opportunity's stage is changed in response to that, it shouldn't receive the other scheduled actions. Any reason why that wouldn't work?
  • March 24, 2016
  • Like
  • 0
I'm getting the following error in a Process Builder rule, and I'm not sure why. The rule fires when a user lookup field on the Account changes. When that field changes, it changes all of the Account's Contacts ownerId to equal the new field value.

Here's the error:
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
    UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH, 

    This report lists the elements that the flow interview executed. The report is a beta feature.
    We welcome your feedback on IdeaExchange.

    Flow Details
    Flow Name: Update_Contact_to_Pipeline_Rep
    Type: Workflow
    Version: 1
    Status: Active

    Flow Interview Details
    Interview Label: Update_Contact_to_Pipeline_Rep-1_Account
    Current User: xxUserxx (005A0000005FohB)
    Start time: 3/2/2016 2:24 PM
    Duration: 28 seconds

    How the Interview Started
    Chris Thames (005A0000005FohB) started the flow interview.
    Some of this flow's variables were set when the interview started.
    myVariable_old = 001A0000014JsaDIAS
    myVariable_current = 001A0000014JsaDIAS
    RecursiveCountVariable = 0.00

    ASSIGNMENT: myVariable_waitStartTimeAssignment
    {!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
    Result
    {!myVariable_waitStartTimeVariable} = "3/2/2016 2:24 PM"

    DECISION: isChangedDecision2_myRule_1_Pipeline_Rep_c
    Executed this outcome: isChangedRule_2_myRule_1_Pipeline_Rep_c
    Outcome conditions: and
    1. {!myVariable_old} (001A0000014JsaDIAS) Is null false
    2. {!myVariable_old.Pipeline_Rep__c} (005A0000007DuG5IAK) Does not equal {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Logic: All conditions must be true (AND)

    DECISION: myDecision
    Executed this outcome: myRule_1
    Outcome conditions: and
    1. {!isChangedRule_2_myRule_1_Pipeline_Rep_c} (true) Equals true
    2. {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS) Is null false
    Logic: All conditions must be true (AND)

    RECORD UPDATE: myRule_1_A1
    Find all Contact records where:
    AccountId Equals {!myVariable_current.Id} (001A0000014JsaDIAS)
    Update the records’ field values.
    OwnerId = {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Result
    Failed to update records that meet the filter criteria.

    Error Occurred: UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH,

 
  • March 02, 2016
  • Like
  • 0
I'm attempting to include a mock web service callout in a test for a trigger, though the trigger and test don't explicitly execute a callout. I've found this documentation on creating the mock, but I'm pretty new to Apex and am unsure how to configure the two classes: WebServiceMockImpl and WebSvcCallout.

Any guidance would be appreciated. Below is the trigger, an associated class and the current test class.

Trigger:
trigger updateContactAfterConverted on Lead (after update) {
    
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            
            if (Lead.IsConverted) {
            
                // query new contact
            
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        
        }
    
    }
Associated class:
public class updateContactAfterConvertedFuture {
    
      @future
      public static void myMethod(String newContact) {
    
        // Find new contact
            
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
                                            
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    
    }
Test class:
@isTest
    private class testUpdateContactAfterConvertedOrig {
    
        static testmethod void myUnitTest() {

                Test.startTest();
                
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new WebServiceMockImpl());
        
        // Call the method that invokes a callout
        String output = WebSvcCallout.callEchoString('Hello World!');
        
        // Verify that a fake result is returned
        System.assertEquals('Mock response', output);                 
                
                // Create new test lead
                Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
                insert myLead;
                
                // Convert test lead
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.id);
                
                // Check conversion
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                lc.setDoNotCreateOpportunity(True);
                
                // Declare successful
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                Test.stopTest();
                System.assert(lcr.isSuccess());
    
        }
    }

 
  • February 20, 2016
  • Like
  • 0
I have a simple trigger that I'm trying to deploy, but am getting a 0% code coverage error when validating. I had to modify the test slightly to get around another problem (changed "static testMethod void" to "public static void") -- and I'm not sure if that's why the coverage isn't functioning properly or not. Here's my code:

Trigger:
trigger updateContactAfterConverted on Lead (after update) {
    
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            
            if (Lead.IsConverted) {
            
                // query new contact
            
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        
        }
    
    }
Class called in trigger:
public class updateContactAfterConvertedFuture {
    
      @future 
      public static void myMethod(String newContact) {
    
        // Find new contact
            
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
                                            
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    
    }
Test:
@isTest
    public class testUpdateContactAfterConvertedOrig {
    
        public static void myUnitTest() {
    
                // Create new test lead
                Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
                insert myLead;
                
                // Convert test lead
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.id);
                
                // Check conversion
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                
                // Declare successful
                Test.startTest(); 
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                Test.stopTest();
                System.assert(lcr.isSuccess());
    
        }
        
    }

 
  • February 15, 2016
  • Like
  • 0
I'm receiving the following error during validation/deployment: "Methods defined as TestMethod do not support Web service callouts"

My trigger doesn't contain a callout, but from what I've read it's likely being triggered by a package or another trigger.

I've seen other posts on this subject, and I've tried all their solutions including mocking HTTP responses and callouts, but nothing seems to work. Can anyone help?

Below are the trigger and two classes being deployed:

Trigger
trigger updateContactAfterConverted on Lead (after update) {
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            if (Lead.IsConverted) {
            
                // query new contact
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        }
    }

Class referenced in trigger
public class updateContactAfterConvertedFuture {
    
      @future 
      public static void myMethod(String newContact) {
    
        // Find new contact
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    }
Test class
@isTest
    private class testUpdateContactAfterConverted {
        static testMethod void myUnitTest() {
            // Create new test lead
            Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
            insert myLead;
            
            // Convert test lead
            Database.LeadConvert lc = new Database.LeadConvert();
            lc.setLeadId(myLead.id);
            
            // Check conversion
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            lc.setConvertedStatus(convertStatus.MasterLabel);
            
            // Declare successful
            Database.LeadConvertResult lcr = Database.convertLead(lc);
            System.assert(lcr.isSuccess());
        }
    }
I also tried not including the test class in the deployment, but without it I get 0% code coverage on the trigger.
  • February 14, 2016
  • Like
  • 0
I'm trying to use the REST API SObject Get Updated resource to give me a list of updated/deleted Accounts during a period of time, but I'm getting bogged down by irrelevant updates.

Ideally, I'd like to only bring in Accounts that had changes to specific fields during that period of time. Is that possible?

Example: I want a list of Account Ids for any Account that had its name changed during a period of time. When I use Get Updated, it gives me those Ids as well as every Account Id that had any other change that I don't care about (e.g. address change).
  • March 13, 2017
  • Like
  • 0
I wanted to use Process Builder + a flow to automatically delete the chatter post generated on an account when a lead is converted. I've created both parts, but it doesn't seem to be working...

Here's the process builder:
User-added image

It triggers on the "Feed Item" object, when an object is created or edited, with no recursion.

The action group criteria is pretty basic for now, just to test it -- with the only condition being FeedItem Type = "Tracked Change"
User-added image

And the only action is to launch the flow that deletes the record...
User-added image
The flow is just one part:
User-added image
Taking the variable ID from the Process Builder and deleting it
User-added image

Any ideas why this wouldn't work?
I'm getting the following error in a Process Builder rule, and I'm not sure why. The rule fires when a user lookup field on the Account changes. When that field changes, it changes all of the Account's Contacts ownerId to equal the new field value.

Here's the error:
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
    UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH, 

    This report lists the elements that the flow interview executed. The report is a beta feature.
    We welcome your feedback on IdeaExchange.

    Flow Details
    Flow Name: Update_Contact_to_Pipeline_Rep
    Type: Workflow
    Version: 1
    Status: Active

    Flow Interview Details
    Interview Label: Update_Contact_to_Pipeline_Rep-1_Account
    Current User: xxUserxx (005A0000005FohB)
    Start time: 3/2/2016 2:24 PM
    Duration: 28 seconds

    How the Interview Started
    Chris Thames (005A0000005FohB) started the flow interview.
    Some of this flow's variables were set when the interview started.
    myVariable_old = 001A0000014JsaDIAS
    myVariable_current = 001A0000014JsaDIAS
    RecursiveCountVariable = 0.00

    ASSIGNMENT: myVariable_waitStartTimeAssignment
    {!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
    Result
    {!myVariable_waitStartTimeVariable} = "3/2/2016 2:24 PM"

    DECISION: isChangedDecision2_myRule_1_Pipeline_Rep_c
    Executed this outcome: isChangedRule_2_myRule_1_Pipeline_Rep_c
    Outcome conditions: and
    1. {!myVariable_old} (001A0000014JsaDIAS) Is null false
    2. {!myVariable_old.Pipeline_Rep__c} (005A0000007DuG5IAK) Does not equal {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Logic: All conditions must be true (AND)

    DECISION: myDecision
    Executed this outcome: myRule_1
    Outcome conditions: and
    1. {!isChangedRule_2_myRule_1_Pipeline_Rep_c} (true) Equals true
    2. {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS) Is null false
    Logic: All conditions must be true (AND)

    RECORD UPDATE: myRule_1_A1
    Find all Contact records where:
    AccountId Equals {!myVariable_current.Id} (001A0000014JsaDIAS)
    Update the records’ field values.
    OwnerId = {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Result
    Failed to update records that meet the filter criteria.

    Error Occurred: UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH,

 
  • March 02, 2016
  • Like
  • 0
I'm attempting to include a mock web service callout in a test for a trigger, though the trigger and test don't explicitly execute a callout. I've found this documentation on creating the mock, but I'm pretty new to Apex and am unsure how to configure the two classes: WebServiceMockImpl and WebSvcCallout.

Any guidance would be appreciated. Below is the trigger, an associated class and the current test class.

Trigger:
trigger updateContactAfterConverted on Lead (after update) {
    
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            
            if (Lead.IsConverted) {
            
                // query new contact
            
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        
        }
    
    }
Associated class:
public class updateContactAfterConvertedFuture {
    
      @future
      public static void myMethod(String newContact) {
    
        // Find new contact
            
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
                                            
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    
    }
Test class:
@isTest
    private class testUpdateContactAfterConvertedOrig {
    
        static testmethod void myUnitTest() {

                Test.startTest();
                
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new WebServiceMockImpl());
        
        // Call the method that invokes a callout
        String output = WebSvcCallout.callEchoString('Hello World!');
        
        // Verify that a fake result is returned
        System.assertEquals('Mock response', output);                 
                
                // Create new test lead
                Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
                insert myLead;
                
                // Convert test lead
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.id);
                
                // Check conversion
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                lc.setDoNotCreateOpportunity(True);
                
                // Declare successful
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                Test.stopTest();
                System.assert(lcr.isSuccess());
    
        }
    }

 
  • February 20, 2016
  • Like
  • 0
I have a simple trigger that I'm trying to deploy, but am getting a 0% code coverage error when validating. I had to modify the test slightly to get around another problem (changed "static testMethod void" to "public static void") -- and I'm not sure if that's why the coverage isn't functioning properly or not. Here's my code:

Trigger:
trigger updateContactAfterConverted on Lead (after update) {
    
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            
            if (Lead.IsConverted) {
            
                // query new contact
            
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        
        }
    
    }
Class called in trigger:
public class updateContactAfterConvertedFuture {
    
      @future 
      public static void myMethod(String newContact) {
    
        // Find new contact
            
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
                                            
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    
    }
Test:
@isTest
    public class testUpdateContactAfterConvertedOrig {
    
        public static void myUnitTest() {
    
                // Create new test lead
                Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
                insert myLead;
                
                // Convert test lead
                Database.LeadConvert lc = new Database.LeadConvert();
                lc.setLeadId(myLead.id);
                
                // Check conversion
                LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                lc.setConvertedStatus(convertStatus.MasterLabel);
                
                // Declare successful
                Test.startTest(); 
                Database.LeadConvertResult lcr = Database.convertLead(lc);
                Test.stopTest();
                System.assert(lcr.isSuccess());
    
        }
        
    }

 
  • February 15, 2016
  • Like
  • 0
I'm receiving the following error during validation/deployment: "Methods defined as TestMethod do not support Web service callouts"

My trigger doesn't contain a callout, but from what I've read it's likely being triggered by a package or another trigger.

I've seen other posts on this subject, and I've tried all their solutions including mocking HTTP responses and callouts, but nothing seems to work. Can anyone help?

Below are the trigger and two classes being deployed:

Trigger
trigger updateContactAfterConverted on Lead (after update) {
        for(Lead lead:System.Trigger.new) {
            
            // was the lead converted?
            if (Lead.IsConverted) {
            
                // query new contact
                Contact newContact = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
                
                // run @future class to update contact after conversion completed
                updateContactAfterConvertedFuture.myMethod(newContact.id);
                
            }
        }
    }

Class referenced in trigger
public class updateContactAfterConvertedFuture {
    
      @future 
      public static void myMethod(String newContact) {
    
        // Find new contact
        Contact updateContact = [SELECT Id FROM Contact WHERE Contact.Id = :newContact LIMIT 1];
        
        // Set field to true                                    
        updateContact.Conversion_Completed__c = TRUE;
                        
        // Update contact                
                        
        update updateContact;     
      
       }
    }
Test class
@isTest
    private class testUpdateContactAfterConverted {
        static testMethod void myUnitTest() {
            // Create new test lead
            Lead myLead = new Lead(LastName = 'Fry', Company='Fry And Sons', LeadSource = 'Advertising', Lead_Source_Detail__c = 'PPC');
            insert myLead;
            
            // Convert test lead
            Database.LeadConvert lc = new Database.LeadConvert();
            lc.setLeadId(myLead.id);
            
            // Check conversion
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            lc.setConvertedStatus(convertStatus.MasterLabel);
            
            // Declare successful
            Database.LeadConvertResult lcr = Database.convertLead(lc);
            System.assert(lcr.isSuccess());
        }
    }
I also tried not including the test class in the deployment, but without it I get 0% code coverage on the trigger.
  • February 14, 2016
  • Like
  • 0