• Bob
  • NEWBIE
  • 170 Points
  • Member since 2008
  • Salesforce Administrator
  • Cybex International

  • Chatter
    Feed
  • 1
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 135
    Questions
  • 171
    Replies

hi ,

 

im working on to write test class, in that im facing problem to how to wrire test code for the attachment class. please provide solution for that.

 

 

thakyou.

I have a opportunity trigger that I'm trying to move to my production org, but the test class gives me an error message stating there is zero percent coverage. I have the trigger and the test class below. I've looked at the test class and can not figure out why there is'nt enough coverage for the trigger. Any help would be greatly appreciated.

Trigger:
trigger Update_Opportunity_Amount on Quote (before insert, before update) {
List<Opportunity> opps = new List<Opportunity>();
List<Quote> quotes = new List<Quote>();
Map<Id, Double> quoteNR = new Map<Id, Double>();
Set<Id> oppIds = new Set<Id>();
Set<Id> qteIds = new Set<Id>();
for (Quote q : Trigger.new) {
if (q.Primary_Quote__c == true) {
quotes.add(q);
qteIds.add(q.Id);
if (!quoteNr.isEmpty() && quoteNr.containsKey(q.OpportunityId)) {
quoteNR.clear();
q.addError('You are attempting to create multiple Primary Quotes into the one Opportunity');
}
else {
quoteNR.put(q.OpportunityId, q.Net_Revenue__c);
}
}
}
if (!quoteNR.isEmpty()) {
// Check if any Quotes tied to the same Opportunity as this Quote is listed as a Primary Quote
for (Quote q : [SELECT Id, Primary_Quote__c, OpportunityId FROM Quote WHERE OpportunityId IN :quoteNR.keySet() AND Primary_Quote__c = true]) {
if (qteIds.isEmpty() || !qteIds.contains(q.Id)) {
oppIds.add(q.OpportunityId);
}
}
if (!oppIds.isEmpty()) {
for (Quote q : quotes) {
if (oppIds.contains(q.OpportunityId)) {
q.addError('The Opportunity tied to this Quote already contains a Primary Quote. This quote cannot be set as a Primary Quote');
}
}
}
// Update the Opportunity with the Net Revenue from the Quote
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :quoteNR.keySet()]) {
o.Amount = quoteNR.get(o.Id);
opps.add(o);
}
}
if (!opps.isEmpty()) {
update(opps);
}
}
@isTest
private class Update_Opportunity_Amount_TestClass {
static testMethod void myUnitTest() {
RecordType naOppType = [SELECT Id FROM RecordType WHERE Name = 'NA Opportunity Record Type' LIMIT 1];
RecordType naAccTypeCustomer = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Active Customer - BW' LIMIT 1];
RecordType naAccTypeProspect = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Prospect - BW' LIMIT 1];
List<Account> accs = new List<Account>();
List<Opportunity> opps = new List<Opportunity>();
List<Quote> quotes = new List<Quote>();
// Insert the Accounts to be used for the testing
Integer j = 0;
for (Integer i = 0; i < 41; i++) {
Account a = new Account();
a.Name = 'Account Test ' + i;
a.Sales_Channel__c = '160 SPECIAL FORCES';
a.Marketing_Level__c = 'Developer';
a.Billing_Region__c = '1';
a.BillingCity = '1';
a.BillingCountry = '1';
a.BillingPostalCode = '1';
a.BillingState = '1';
a.BillingStreet = '1';
a.Shipping_Region__c = '1';
a.ShippingCity = '1';
a.ShippingCountry = '1';
a.ShippingPostalCode = '1';
a.ShippingState = '1';
a.ShippingStreet = '1';
if (j == 0) {
a.RecordTypeId = naAccTypeProspect.Id;
j = 1;
}
else {
a.RecordTypeId = naAccTypeCustomer.Id;
j = 0;
}
accs.add(a);
}
insert(accs);
// Insert the Opportunities to be used for the testing
for (Integer i = 0; i < 41; i++) {
Opportunity o = new Opportunity();
o.Name = 'Opportunity Test ' + i;
o.Amount = 111.11;
o.StageName = 'H - Hot Prospect';
o.CloseDate = Date.today() + 365;
o.AccountId = accs[i].Id;
o.RecordTypeId = naOppType.Id;
if (j == 0) {
o.Interface_Status_del__c = 'D';
j = 1;
}
else {
j = 0;
}
opps.add(o);
}
insert(opps);
// Create Quoets that are NOT Primary Quotes. Each Quote for its own Opportunity
for (Integer i = 0; i < 40; i++) {
Quote q = new Quote();
q.Name = 'Quote Test ' + i;
q.Net_Revenue__c = 222.22;
q.Primary_Quote__c = false;
q.OpportunityId = opps[i].Id;
quotes.add(q);
}
insert(quotes);
// Validate that the Amount on the Opportunities still equals 111.11
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
System.assertEquals(o.Amount, 222.22);
}
// Create Quoets that are Primary Quotes. Each Quote for its own Opportunity
quotes.clear();
for (Integer i = 0; i < 40; i++) {
Quote q = new Quote();
q.Name = 'Quote Test ' + i;
q.Net_Revenue__c = 999.99;
q.Primary_Quote__c = true;
q.OpportunityId = opps[i].Id;
quotes.add(q);
}
insert(quotes);
// Validate that the Amount on the Opportunities now equals 999.99
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
System.assertEquals(o.Amount, 999.99);
}
// Update the Quotes with a new Net Revenue
for (Quote q : quotes) {
q.Net_Revenue__c = 555.55;
}
update(quotes);
// Validate that the Amount on the Opportunities now equals 555.55
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
System.assertEquals(o.Amount, 555.55);
}
// Insert new Quotes that are also Primary Quotes to the same Opportunities as above. An error should be thrown
quotes.clear();
for (Integer i = 0; i < 40; i++) {
Quote q = new Quote();
q.Name = 'Quote Test ' + i;
q.Net_Revenue__c = 333.33;
q.Primary_Quote__c = true;
q.OpportunityId = opps[i].Id;
quotes.add(q);
}
// Validate that the Amount on the Opportunities still equals 555.55 and not 333.33
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
System.assertEquals(o.Amount, 555.55);
}
// Create multiple Quotes for the one Opportunity all quotes being a Primary Quote. An error should be thrown
// Check that the last Opportunity (used for above test) still has the Amount 111.11
for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id = :opps[40].Id]) {
System.assertEquals(o.Amount, 111.11);
}
}
}
Test Class:
@isTest
private class Update_Opportunity_Amount_TestClass {

    









static testMethod void myUnitTest() {
        
        RecordType naOppType = [SELECT Id FROM RecordType WHERE Name = 'NA Opportunity Record Type' LIMIT 1];
        RecordType naAccTypeCustomer = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Active Customer - BW' LIMIT 1];
        RecordType naAccTypeProspect = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Prospect - BW' LIMIT 1];
        List<Account> accs = new List<Account>();
        List<Opportunity> opps = new List<Opportunity>();
        List<Quote> quotes = new List<Quote>();

        // Insert the Accounts to be used for the testing
        Integer j = 0;
        for (Integer i = 0; i < 41; i++) {
            Account a = new Account();
            a.Name = 'Account Test ' + i;
            a.Sales_Channel__c = '160 SPECIAL FORCES';
            a.Marketing_Level__c = 'Developer';
            a.Billing_Region__c = '1';
            a.BillingCity = '1';
            a.BillingCountry = '1';
            a.BillingPostalCode = '1';
            a.BillingState = '1';
            a.BillingStreet = '1';
            a.Shipping_Region__c = '1';
            a.ShippingCity = '1';
            a.ShippingCountry = '1';
            a.ShippingPostalCode = '1';
            a.ShippingState = '1';
            a.ShippingStreet = '1';
            if (j == 0) {
                a.RecordTypeId = naAccTypeProspect.Id;
                j = 1;
            }
            else {
                a.RecordTypeId = naAccTypeCustomer.Id;
                j = 0;          
            }
            accs.add(a);
        }
        insert(accs);
        
        // Insert the Opportunities to be used for the testing
        for (Integer i = 0; i < 41; i++) {
            Opportunity o = new Opportunity();
            o.Name = 'Opportunity Test ' + i;
            o.Amount = 111.11;
            o.StageName = 'H - Hot Prospect';
            o.CloseDate = Date.today() + 365;
            o.AccountId = accs[i].Id;
            o.RecordTypeId = naOppType.Id;
            if (j == 0) {
                o.Interface_Status_del__c = 'D';
                j = 1;
            }
            else {
                j = 0;          
            }           
            opps.add(o);
        }
        insert(opps);
        
        // Create Quoets that are NOT Primary Quotes. Each Quote for its own Opportunity
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 222.22;
            q.Primary_Quote__c = false;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities still equals 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 222.22);
        }
        
        // Create Quoets that are Primary Quotes. Each Quote for its own Opportunity
        quotes.clear(); 
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 999.99;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities now equals 999.99
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 999.99);
        }       
        
        // Update the Quotes with a new Net Revenue
        for (Quote q : quotes) {
            q.Net_Revenue__c = 555.55;
        }
        update(quotes);     
        
        // Validate that the Amount on the Opportunities now equals 555.55
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }       
        
        
        // Insert new Quotes that are also Primary Quotes to the same Opportunities as above. An error should be thrown
        quotes.clear();     
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 333.33;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
             
        
        // Validate that the Amount on the Opportunities still equals 555.55 and not 333.33 
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }
        
        // Create multiple Quotes for the one Opportunity all quotes being a Primary Quote. An error should be thrown
       
        // Check that the last Opportunity (used for above test) still has the Amount 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id = :opps[40].Id]) {
            System.assertEquals(o.Amount, 111.11);
        }
    }
}


Lines not covered


 
  • November 03, 2016
  • Like
  • 0
I am having an issue with a flow process. It keeps giving me  the following error. The flow failed to access the value for myVariable_old.AccountId because it hasn't been set or assigned. I updated the updated record decison but it still give me the same error. Below is the error report and the process images.  Any help with this would be greatly appreciated.

An error occurred at element myDecision2 (FlowDecision).
The flow failed to access the value for myVariable_current.AccountId because it hasn't been set or assigned.

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: Set_Primary_Quote_Process
Type: Workflow
Version: 6
Status: Active
Flow Interview Details
Interview Label: Set_Primary_Quote_Process-7_Quote
Current User: NA Integration User (00580000003Mg0C)
Start time: 10/19/2016 10:19 AM
Duration: 0 seconds
How the Interview Started
NA Integration User (00580000003Mg0C) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = 0Q0340000007wpwCAA
myVariable_current = 0Q0340000007wpwCAA
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "10/19/2016 10:19 AM"
DECISION: isChangedDecision4_myRule_3_Name
DECISION: isChangedDecision5_myRule_3_Oracle_Quote_c
DECISION: isChangedDecision6_myRule_3_Amount_c
Executed this outcome: isChangedRule_6_myRule_3_Amount_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Amount__c} (295,824) Does not equal {!myVariable_current.Amount__c} (90,608)
Logic: All conditions must be true (AND)
DECISION: isChangedDecision7_myRule_3_Net_Revenue_c
Executed this outcome: isChangedRule_7_myRule_3_Net_Revenue_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Net_Revenue__c} (295,824) Does not equal {!myVariable_current.Net_Revenue__c} (90,608)
Logic: All conditions must be true (AND)
DECISION: isChangedDecision8_myRule_3_Order_Type_c
DECISION: isChangedDecision9_myRule_3_Pricebook_c
DECISION: isChangedDecision10_myRule_3_Stage_c
Executed this outcome: isChangedRule_10_myRule_3_Stage_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Stage__c} (Draft) Does not equal {!myVariable_current.Stage__c} (Cancelled)
Logic: All conditions must be true (AND)
DECISION: myDecision

User-added image

User-added image

User-added image

 
  • October 19, 2016
  • Like
  • 0
I have a quote trigger called Update_Opportunity_Amount. I am getting the following error when i try to deploy it to my production org.


The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Update_Opportunity_Amount

I do have a test class, but the error states I have no code coverage. I would appreciate if anyone can tell me what is wrong with my test class that it is not testing my trigger.

Trigger

Update_Opportunity_Amount
trigger Update_Opportunity_Amount on Quote (before insert, before update) {

    List<Opportunity> opps = new List<Opportunity>();
    List<Quote> quotes = new List<Quote>();
    Map<Id, Double> quoteNR = new Map<Id, Double>();
    Set<Id> oppIds = new Set<Id>();
    Set<Id> qteIds = new Set<Id>();

    for (Quote q : Trigger.new) {
        if (q.Primary_Quote__c == true) {
            quotes.add(q);
            qteIds.add(q.Id);
            if (!quoteNr.isEmpty() && quoteNr.containsKey(q.OpportunityId)) {
                quoteNR.clear();
                q.addError('You are attempting to create multiple Primary Quotes into the one Opportunity');
            }
            else {
                quoteNR.put(q.OpportunityId, q.Net_Revenue__c);
            }
        }
    }
    
    if (!quoteNR.isEmpty()) {
        
        // Check if any Quotes tied to the same Opportunity as this Quote is listed as a Primary Quote
        for (Quote q : [SELECT Id, Primary_Quote__c, OpportunityId FROM Quote WHERE OpportunityId IN :quoteNR.keySet() AND Primary_Quote__c = true]) {
            if (qteIds.isEmpty() || !qteIds.contains(q.Id)) {
                oppIds.add(q.OpportunityId);
            }
        }

        if (!oppIds.isEmpty()) {
            for (Quote q : quotes) {
                if (oppIds.contains(q.OpportunityId)) {
                    q.addError('The Opportunity tied to this Quote already contains a Primary Quote. This quote cannot be set as a Primary Quote');
                }
            }
        }
            
        // Update the Opportunity with the Net Revenue from the Quote 
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :quoteNR.keySet()]) {
            o.Amount = quoteNR.get(o.Id);
            opps.add(o);
        }
    }
    
    if (!opps.isEmpty()) {
        update(opps);
    }
}

Test Class
@isTest
private class Update_Opportunity_Amount_TestClass {

    static testMethod void myUnitTest() {
        
        RecordType naOppType = [SELECT Id FROM RecordType WHERE Name = 'NA Opportunity Record Type' LIMIT 1];
        RecordType naAccTypeCustomer = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Active Customer - BW' LIMIT 1];
        RecordType naAccTypeProspect = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Prospect - BW' LIMIT 1];
        List<Account> accs = new List<Account>();
        List<Opportunity> opps = new List<Opportunity>();
        List<Quote> quotes = new List<Quote>();

        // Insert the Accounts to be used for the testing
        Integer j = 0;
        for (Integer i = 0; i < 41; i++) {
            Account a = new Account();
            a.Name = 'Account Test ' + i;
            a.Sales_Channel__c = '160 SPECIAL FORCES';
            a.Marketing_Level__c = 'Developer';
            a.Billing_Region__c = '1';
            a.BillingCity = '1';
            a.BillingCountry = '1';
            a.BillingPostalCode = '1';
            a.BillingState = '1';
            a.BillingStreet = '1';
            a.Shipping_Region__c = '1';
            a.ShippingCity = '1';
            a.ShippingCountry = '1';
            a.ShippingPostalCode = '1';
            a.ShippingState = '1';
            a.ShippingStreet = '1';
            if (j == 0) {
                a.RecordTypeId = naAccTypeProspect.Id;
                j = 1;
            }
            else {
                a.RecordTypeId = naAccTypeCustomer.Id;
                j = 0;          
            }
            accs.add(a);
        }
        insert(accs);
        
        // Insert the Opportunities to be used for the testing
        for (Integer i = 0; i < 41; i++) {
            Opportunity o = new Opportunity();
            o.Name = 'Opportunity Test ' + i;
            o.Amount = 111.11;
            o.StageName = 'H - Hot Prospect';
            o.CloseDate = Date.today() + 365;
            o.AccountId = accs[i].Id;
            o.RecordTypeId = naOppType.Id;
            if (j == 0) {
                o.Interface_Status_del__c = 'D';
                j = 1;
            }
            else {
                j = 0;          
            }           
            opps.add(o);
        }
        insert(opps);
        
        // Create Quoets that are NOT Primary Quotes. Each Quote for its own Opportunity
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 222.22;
            q.Primary_Quote__c = false;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities still equals 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 111.11);
        }
        
        // Create Quoets that are Primary Quotes. Each Quote for its own Opportunity
        quotes.clear(); 
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 999.99;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities now equals 999.99
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 999.99);
        }       
        
        // Update the Quotes with a new Net Revenue
        for (Quote q : quotes) {
            q.Net_Revenue__c = 555.55;
        }
        update(quotes);     
        
        // Validate that the Amount on the Opportunities now equals 555.55
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }       
        
        
        // Insert new Quotes that are also Primary Quotes to the same Opportunities as above. An error should be thrown
        quotes.clear();     
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 333.33;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        try {
            insert(quotes);
            System.assert(false);
        } catch (DmlException e) {
            System.assert(e.getDmlMessage(0).indexOf('The Opportunity tied to this Quote already contains a Primary Quote. This quote cannot be set as a Primary Quote') > -1);
        }       
        
        // Validate that the Amount on the Opportunities still equals 555.55 and not 333.33 
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }
        
        // Create multiple Quotes for the one Opportunity all quotes being a Primary Quote. An error should be thrown
        quotes.clear();
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 888.88;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[40].Id;
            quotes.add(q);
        }
        try {
            insert(quotes);
            System.assert(false);
        } catch (DmlException e) {
            System.assert(e.getDmlMessage(0).indexOf('You are attempting to create multiple Primary Quotes into the one Opportunity') > -1);
        }
        
        // Check that the last Opportunity (used for above test) still has the Amount 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id = :opps[40].Id]) {
            System.assertEquals(o.Amount, 111.11);
        }
    }
}

 
  • October 17, 2016
  • Like
  • 0
I am having an issue with one a flow process. It keeps giving me  the following error. The flow failed to access the value for myVariable_old.AccountId because it hasn't been set or assigned.
User-added image

User-added image
  • October 17, 2016
  • Like
  • 0
My test class below keeps coming up with an error when i triy to move an updated trigger over to my production org via outbound change set or eclipse. The error is List has no rows for assignement. If anyone can help find the reason this test class keeps coming up with an error, i would appreciate it.
User-added image

/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 *
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */

@isTest
private class Account_Create_Contact_TestClass {

    static testMethod void myUnitTest() {
       
        Profile p = [SELECT Id FROM Profile WHERE Name = 'BLX Telemarketer' LIMIT 1];
        User u = [SELECT Id FROM User WHERE ProfileId = :p.Id AND User.IsActive = true LIMIT 1];
        List<Account> accs = new List<Account>();
        List<Account> conAccs = new List<Account>();
        Set<Id> accIds = new Set<Id>();
       
        Integer i = 0;
        System.runAs(u) {
           
            // Test Accounts with no Last Name has been added
            for (Account a : [SELECT Id FROM Account LIMIT 50]) {
                a.Eerstenaam__c = 'Test First Name';
            }
           
            if (!accs.isEmpty()) {
                update(accs);
                accs.clear();
            }
                   
            for (Account a : [SELECT Id FROM Account LIMIT 50]) {
                accIds.add(a.Id);
                a.Eerstenaam__c = 'Test First Name';
                a.Achternaam__c = 'Test Last Name';
                a.Nieuwsbrieven_ontvangen__c = false;
                if (i == 0) {
                    a.Nieuwsbrieven_Ontvangen__c = true;
                    a.Dezelfde_Email__c = true;
                    i = 1;
                }
                else if (i == 1) {
                    i = 2;
                    a.Status_Belactie_2010__c = 'Wil Gebeld Worden Door Account Manager';
                    a.Opmerkingen__c = 'This is a test Task';
                }
                else {
                    a.Achternaam__c = NULL;
                }
                accs.add(a);
            }
            if (!accs.isEmpty()) {
                update(accs);
            }
           
            for (Contact c : [SELECT Id, LastName, AccountId FROM Contact WHERE AccountId IN :accIds AND LastName = 'Test Last Name']) {
                Account a = new Account(Id=c.AccountId);
                a.Achternaam__c = c.LastName;
                conAccs.add(a);
            }
           
            if (!conAccs.isEmpty()) {
                update(conAccs);
            }          
        }
               
       
    }
}
  • October 17, 2016
  • Like
  • 0
I am creating a process for task that changes the record type of the task based on the assigned users profile.  Here is my process below that keeps getting the error.


User-added image












 
  • September 21, 2016
  • Like
  • 0
I have the following code below that i'm trying to add and if statement to check to see if a record has been recently modified by the last date and time being greater than the created date.  I also tried to and it to where I can check for old values and new vlalues but nothing seems to work. I would like to remove the old field value section of the code and add a check for last modified date and time. If the record has the newest last modifiied date and time then check the Primary Quote checkbox. Any help would be greatly appreciated. 
 
trigger MarkPrimaryQuote on Quote (before insert, before update) {
    List<Quote> quoteListToUpdate = new List<Quote>();

    Set<Id> opppIds = new Set<Id>();
    for(Quote qRec : Trigger.new){
        if(qRec.OpportunityId!= null){
            opppIds.add(qRec.OpportunityId);
        }
    }
    Map<Id,Opportunity> mapOfOpps = new Map<Id,Opportunity>([Select id,(Select Primary_Quote__c from Quotes) from Opportunity where Id IN :opppIds]);
    if(trigger.isInsert){
        for(Quote qRec : Trigger.new){
            qRec.Primary_Quote__c = true;
        }
        for(Opportunity opp : mapOfOpps.values()){
            for(Quote existingQuote : opp.Quotes){
                existingQuote.Primary_Quote__c =false;
                quoteListToUpdate.add(existingQuote);
            }
        }
        if(quoteListToUpdate.size() > 0){
            update quoteListToUpdate;
        }
    }
     if(trigger.isUpdate){
        for(Quote qRec : Trigger.new){
  // I would like to remove this section and add a check for last date and time modified         
     Quote oldQuote = trigger.oldMap.get(qRec.id);
            if(oldQuote.Stage__c != qRec.Stage__c || oldQuote.Amount__c !=      qRec.Amount__c || oldQuote.Discount__c != qRec.Discount__c ){
                qRec.Primary_Quote__c =true;

                if(qRec.OpportunityId!= null && mapOfOpps.containsKey(qRec.OpportunityId)){
                    for(Quote existingQuote : mapOfOpps.get(qRec.OpportunityId).Quotes){
                        if(existingQuote.id != qRec.id){
                            quoteListToUpdate.add(existingQuote);
                        }
                    }
                }
            }
        }
        if(quoteListToUpdate.size() > 0){
            update quoteListToUpdate;
        }
    }
}

 
  • May 25, 2016
  • Like
  • 0
I have a trigger that I am trying to add a before update to a before insert trigger but i keep getting the following error. 
What can I change on this code to make it allow insert and updates? I need it to set to 'true' for any new Quotes and 'false' for any Quotes that get updated?

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger MarkPrimaryQuote caused an unexpected exception, contact your administrator: MarkPrimaryQuote: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0Q0n0000000DRrLCAW; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0Q0n0000000DRrL) is currently in trigger MarkPrimaryQuote, therefore it cannot recursively update itself: []: Trigger.MarkPrimaryQuote: line 19, column 1
 
trigger MarkPrimaryQuote on Quote (before insert, before update) {
    
  
 List<DateTime> oracleQuoteList = new List<DateTime>();
    for(Quote qRec : Trigger.new) {
    
    if(qRec == null )
        qRec.Primary_Quote__c = true;
        oracleQuoteList.add(qRec.Created_Date__c );      
    }
    
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,Created_Date__c from Quote WHERE Created_Date__c= TODAY AND HOUR_IN_DAY(LastModifiedDate) > 1]) {
        qRec.Primary_Quote__c =false;
        quoteListToUpdate.add(qRec);    
    }
    
    if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }

  
  
}

 
  • May 17, 2016
  • Like
  • 0
I have a trigger that I am trying to add a before update to a before insert trigger but i keep getting the following error.  What can I change on this code to make it allow insert and updates?

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger MarkPrimaryQuote caused an unexpected exception, contact your administrator: MarkPrimaryQuote: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0Q0n0000000DRrLCAW; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0Q0n0000000DRrL) is currently in trigger MarkPrimaryQuote, therefore it cannot recursively update itself: []: Trigger.MarkPrimaryQuote: line 19, column 1
 
//Created by Bob Poliquin 5/12/2016
// Updated the soql query to identify last modified date. 5/12/2016

trigger MarkPrimaryQuote on Quote (before insert,before update) {
    List<Datetime> oracleQuoteList = new List<Datetime>();
    for(Quote qRec : Trigger.new) {
   
        qRec.Primary_Quote__c = true;
        oracleQuoteList.add(qRec.LastModifiedDate);      
    }
    
    
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,CreatedDate from Quote WHERE LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 1]) {
        qRec.Primary_Quote__c =false;
        quoteListToUpdate.add(qRec);    
    }
         if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }
    
}

 
  • May 16, 2016
  • Like
  • 0
I have a trigger below that works but i need it to check a Primary_Quote__c checkbox on the newest created quote on an opportunity with the record type of "NA Opportunity Record Type".  How would i accomplish adding a filter to only check the newest Primary_Quote__c quote while unchecking previous qoutes?


 
trigger Trigger_MarkPrimaryQuote on Quote (before insert) { 
    List<Id> opptyList = new List<Id>();
    for(Quote qRec : Trigger.New)
        opptyList.add(qRec.OpportunityId);
        
    Map<Id,Opportunity> opptyMap = new Map<Id,Opportunity>([Select Id, RecordType.Name from Opportunity where Id IN :opptyList]) ;
    for(Quote qRec :Trigger.New ) {
        if(opptyMap.containsKey(qRec.OpportunityId) && opptyMap.get(qRec.OpportunityId).RecordType.Name == 'NA Opportunity Record Type')
            qRec.Primary_Quote__c = true;
    
    
    }
    }

 
  • May 05, 2016
  • Like
  • 0
I have a trigger that should only update quotes if the opportunity record type is 'NA Opportunity Record Type' .  The trigger must update the Primary_Quote__c checkbox of the newest created record and uncheck any previous records.  I added a Opportunity list but i receive the following error below. Any help would be appreciated.

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Trigger_MarkPrimaryQuote caused an unexpected exception, contact your administrator: Trigger_MarkPrimaryQuote: execution of BeforeInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Trigger.Trigger_MarkPrimaryQuote: line 9, column 1

 
trigger Trigger_MarkPrimaryQuote on Quote (before insert) {
    


List<Opportunity> opps = new List<Opportunity>();
   for(Opportunity oppsrec :[Select id, RecordType.Name from Opportunity where RecordType.Name = 'NA Opportunity Record Type' ]){

 // 
 List<String> oracleQuoteList = new List<String>();
    for(Quote qRec : Trigger.new) {
        qRec.Primary_Quote__c = true;
           
    }
    
    
 //   
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,OpportunityId   from Quote WHERE Oracle_Quote__c IN : oracleQuoteList]) {
        qRec.Primary_Quote__c =false;
        quoteListToUpdate.add(qRec);    
    }
    
    
//    
    if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }
}
 }

 
  • May 05, 2016
  • Like
  • 0
I have a trigger that should only update quotes if the opportunity record type is 'NA Opportunity Record Type' . I've tried to add it into the trigger but nothing has worked. Any help would be greatly appreciated. 

 



trigger Trigger_MarkPrimaryQuote on Quote (before insert) {
    
 // 
 List<String> oracleQuoteList = new List<String>();
    for(Quote qRec : Trigger.new) {
        qRec.Primary_Quote__c = true;
        oracleQuoteList.add(qRec.Oracle_Quote__c);      
    }
 //   
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,Oracle_Quote__c,Opportunity.RecordType.Name   from Quote WHERE Oracle_Quote__c IN : oracleQuoteList]) {
        qRec.Primary_Quote__c =false;
        qRec.Opportunity.RecordType.Name ='NA Opportunity Record Type';
        quoteListToUpdate.add(qRec);    
    }
//    
    if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }

 }

 
  • May 02, 2016
  • Like
  • 0
I need to add specific record types to my trigger below. The record type names are below as well. I've tried adding record types, but nothing seems to work. Any help with this would be greatly appreaciated. 

Record Types:
NA Customer Account Record Type - Active Customer - BW
NA Customer Account Record Type - Prospect - BW
NA Contact Record Type - BW
 
//Created by Bob Poliquin  4/15/2016


trigger Trigger_ChangeContactOwner on Contact (after insert, after update) {
List <Id> AccountIds = new List <Id>();
List <Account> accounts = new List<Account>();
List <Contact> contacts = new List<Contact>();

List <Account> accSave = new List<Account>();
List <Contact> contSave = new List<Contact>();

for(Contact c:trigger.new ){
if(c.AccountId !=NULL)
AccountIds.add(c.AccountId);
}

accounts = [Select Id, OwnerId, RecordType.DeveloperName From Account Where Id IN :AccountIds];
contacts = [Select Id, AccountId, OwnerId From Contact Where AccountId IN :AccountIds and Id NOT IN :trigger.new];

for(Contact c:trigger.new ){
for(Account acc:accounts){

if(c.AccountId == acc.Id && c.OwnerId !=acc.OwnerId ){
acc.OwnerId = c.OwnerId;
accSave.add(acc);
}
}

for(Contact con:contacts){
if(c.AccountId == con.AccountId && c.OwnerId != con.OwnerId){
con.OwnerId = c.OwnerId;
contSave.add(con);
}
}
}
update(accSave);
update(contSave);
}

 
  • April 27, 2016
  • Like
  • 0
I have a after insert after update trigger that works when you change the account owner on existing accounts and contacts. But when I try to create a new account, I get the following error message. Apex trigger Trigger_ChangeContactOwner caused an unexpected exception, contact your administrator: Trigger_ChangeContactOwner: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object: (). I can't seem to find out where the error is coming from on my trigger. Any help on this would be greatly appreciated.
 
trigger Trigger_ChangeContactOwner on Account (after insert, after update) {
  
      Set<Id> accountIds = new Set<Id>(); 
      Map<Id, String> oldOwnerIds = new Map<Id, String>();
      Map<Id, String> newOwnerIds = new Map<Id, String>();
      Contact[] contactUpdates = new Contact[0]; 
     
      for (Account a : Trigger.new) 
      { 
         if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId) 
         {
            oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId); 
            newOwnerIds.put(a.Id, a.OwnerId); 
            accountIds.add(a.Id); 
         }
      }
        if (!accountIds.isEmpty()) { 
         for (Account acc : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) FROM Account WHERE Id in :accountIds])
            {
            String newOwnerId = newOwnerIds.get(acc.Id); 
            String oldOwnerId = oldOwnerIds.get(acc.Id); 
            for (Contact c : acc.Contacts) 
            { 
               if (c.OwnerId == oldOwnerId) 
               {
               Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId);
               contactUpdates.add(updatedContact);
               }
            }
            
            }
       }
            update contactUpdates;
}

 
  • April 15, 2016
  • Like
  • 0
I am trying to figure out how to write  a trigger/apex class that would look through a list of quotes. There is a checkbox (Primary_Quote__c) I need the trigger or class to look through the list of quote. There is a custom field Entitled (Oracle_Quote__c). I need the trigger to look through the list of quotes with the same Oracle Quote Number and automatically check the Primary Quote checkbox on the record with the newest created date, and also uncheck the older quote records. Is this possible? How would I accomplish? Any helpwuold be greatly appreicated. 
  • April 13, 2016
  • Like
  • 0
I have a visualforce page I have added to a custom object page layout, but it does not show up on my slaesforce 1 mobile app.  I enabled the Available for Salesforce mobile apps and Lightning Pages checkbox on the page. Could it be my code needs to be html5? The code is below.


 
<apex:page standardController="Case" showChat="false" showHeader="false" standardStylesheets="false" >


<style>
table {


border-bottom: solid 1px #E0E3E5;
background-color:#ffffff;
font-size:11px;
font-family:arial;

}
.tr{
border-bottom: solid 1px #E0E3E5;


}

.background{
background-color:#ffffff;



|





</style>
 <apex:form >
  <apex:pageblock > 
                <table  >
                    <tr>
                        <div style="font-family:arial;font-size:14px;border-bottom: solid 1px #E0E3E5;" ><h4>Standard Warranty Information</h4></div>
                    </tr>
                </table>
                
                <table style="color:#4A4A56;background-color:#ffffff;" width="100%" cellpadding="10px">
                    <tr >
                   
                    
                        <th>Extended Wnty Order #</th>
                        <th>Ext. Warranty Type</th>
                        <th>Ext. Warranty Description</th>
                        <th>Sold To Company</th>
                        <th>Ship To Company</th>
                        <th>Active Start Date</th>
                        <th>End Date</th>
                       
                    </tr>
                    <tr>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{!Case.Serial_Number__r.Ext_Warranty__r.Name }" /></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{!Case.Serial_Number__r.Ext_Warranty__r.Ext_Wnty_Type__c}" /></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{!Case.Serial_Number__r.Ext_Warranty__r.Ext_Wnty_Desc__c}" /></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{!Case.Serial_Number__r.Ext_Warranty__r.Sold_To_Company_Name__c}" /></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{!Case.Serial_Number__r.Ext_Warranty__r.Ship_To_Company_Name__c}" /></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{0,date,MMMM dd, yyyy}">
                        <apex:param value="{!Case.Serial_Number__r.Ext_Warranty__r.Start_Date__c}"/> </apex:outputText></td>
                        <td style="border-bottom: solid 1px #E0E3E5;"><apex:outputText value="{0,date,MMMM dd, yyyy}">
                        <apex:param value="{!Case.Serial_Number__r.Ext_Warranty__r.End_Date__c}"/> </apex:outputText> </td>
                    </tr>

                   
             
                
   
                   
                   
                </table>
                
                
               
                
                
               
            </apex:pageblock>
           </apex:form>
</apex:page>

 
  • April 12, 2016
  • Like
  • 0


Below I have a trigger with a custom object called Unit__c. The custom object has a Ship_Date__c field. On my other custom object Warranty__c. I have two date fields Warranty_Active_Date__c  and Warranty_End_Date__c.  I need my trigger to look at the ship date on the unit object and find records that have a ship date >= Warranty_Active_Date__c and a ship date <=  Warranty_End_Date__c. For some reason I can't find why my trigger is not working. Any help would be appreciated. 
 
//Ceated by Bob Poliquin 2/16/2016 works with ship dates
trigger Trigger_UpdateWarranties on Unit__c (before insert, before update ) {


// Step 1: Create a set of all products of Units to query
  Set<Date> allwrntyad = new Set<Date>();
  Set<Date> allwrntyed = new Set<Date>();
  Set<String> products = new Set<String>();
  
for (Unit__c newUnit : Trigger.new) {
   if (newUnit.Ship_Date__c != null){
      allwrntyad.add(newUnit.Ship_Date__c);
      allwrntyed.add(newUnit.Ship_Date__c); 
      products.add(newUnit.Product__c);
      
      
    }  
  }

  // Step 2: Query for all the Units in Step 1
  List<Warranty__c> potentialproducts = [SELECT Id, Name, Warranty_Active_Date__c, Product__c,Warranty_End_Date__c FROM Warranty__c
                                 WHERE Product__c = :products AND Warranty_Active_Date__c >= :allwrntyad AND Warranty_End_Date__c <= :allwrntyed ];

  
   // Step 3: Make a Map that lets you search for units by product
  Map<String, Warranty__c> wrntyMap = new Map<String, Warranty__c>();
  for (Warranty__c w : potentialproducts) {
     wrntyMap.put(w.Product__c, w);
  }
 // Step 4: Get the matching Warranty in the Map by product!
  for (Unit__c newUnit : Trigger.new) {
     if (newUnit .Warranty_Type__c == null) {
      Warranty__c product = wrntyMap.get(newUnit.Product__c);
      
     if (wrntyMap.containsKey(newUnit.Product__c )) {
       newUnit.Warranty_Type__c = product.Id;
      }
    }
  }
    
 
    }

 
  • March 24, 2016
  • Like
  • 0
How would I stop this trigger below from firing once it has already done an update. I tried the trigger old.map but that didn't work.

 
trigger TriggerUpdateUnitExtWarranty on Unit__c (before insert, before update) {
  
  // Step 1: Create a set of all extended warranties of Units to query
  Set<String> extwrnty = new Set<String>();
  
  
  for (Unit__c newUnit : Trigger.new) {
   
      extwrnty.add(newUnit.uordernum_prodcode__c);    
  }

  // Step 2: Query for all the Units in Step 1
  List<Extended_Warranty__c> potentialproduct = [SELECT Id, Name,exordernum_prodcode__c FROM Extended_Warranty__c
                                 WHERE exordernum_prodcode__c IN :extwrnty];

  // Step 3: Make a Map that lets you search for units by extended warranty
  Map<String, Extended_Warranty__c> ewrntyMap = new Map<String, Extended_Warranty__c>();
  for (Extended_Warranty__c w : potentialproduct) {
    ewrntyMap.put(w.exordernum_prodcode__c, w);
  }

  // Step 4: Get the matching extended warranty in the Map by extended warranty!
  for (Unit__c newUnit : Trigger.new) {
    
    if (ewrntyMap.containsKey(newUnit.uordernum_prodcode__c)) {
      Extended_Warranty__c ordnm = ewrntyMap.get(newUnit.uordernum_prodcode__c);

  //ordnm is the name of the extended warranty record that is associated with the unit.      
    if (ordnm != null) {
      newUnit.Ext_Warranty__c  = ordnm.Id;
      }
     if (Trigger.oldMap == null) {
      newUnit.Ext_Warranty__c  = null;
      }
    }
  }

}
  • March 08, 2016
  • Like
  • 0
I'm still working with this same trigger below. It works, but it is not 100% acurrate. 
I have a trigger for two custom objects (Extended_Warranty__c & Unit__c)  The trigger's function is to find the Order_No__c and Product_Code__c field on the Unit__c object and match it to the Ext_Warranty__c and Product_Code__c fields on the Extended_Warranty__c object. Then the Extended Warranty is assigned to a lookup field on the Unit if there is a match. I have been trying to figure out how to get my trigger to match those fields and I am getting frustrated. Is there a way to put a condition in somewhere in my trigger below that will find those two fields and assign the extended warranty to the unit. Any help would be greatly appreciated. 
 
rigger TriggerUpdateUnitExtWarranty on Unit__c (before insert, before update) {
  
  // Step 1: Create a set of all extended warranties of Units to query
  Set<String> extwrnty = new Set<String>();
  
  for (Unit__c newUnit : Trigger.new) {
   extwrnty.add(newUnit.Order_No__c);    
   }

  // Step 2: Query for all the Units in Step 1
  List<Extended_Warranty__c> potentialproduct = [SELECT Id, Name,Order_No__c,Product_Code__c FROM Extended_Warranty__c
                                 WHERE  Name IN :extwrnty];

  // Step 3: Make a Map that lets you search for units by extended warranty
  Map<String, Extended_Warranty__c> ewrntyMap = new Map<String, Extended_Warranty__c>();
  for (Extended_Warranty__c w : potentialproduct) {
    ewrntyMap.put(w.Order_No__c, w);
  }

  // Step 4: Get the matching extended warranty in the Map by extended warranty!
  for (Unit__c newUnit : Trigger.new) {
    
    if (newUnit.Ext_Warranty__c == null) {
      Extended_Warranty__c ordnm = ewrntyMap.get(newUnit.Order_No__c);

  //ordnm is the name of the extended warranty record that is associated with the unit.      
    if (ordnm != null) {
      newUnit.Ext_Warranty__c  = ordnm.Id;
      }
     
    }
  }

}

 
  • March 01, 2016
  • Like
  • 0
I have a trigger for two custom objects (Extended_Warranty__c & Unit__c) that works perfectly within SFDC. The trigger's function is to find the Order_No__c and Product_Code__c field on the Unit__c object and match it to the Ext_Warranty__c and Product_Code__c fields on the Extended_Warranty__c object. This work perfectly when i edit records within salesforce, but when i tried updating records from the Data Loader or new units are pushed to SFDC via API. Not all of the records are assigned to the correct Order_No__c - Extended_Warranty__c. I was wondering if anyone has heard of this issue. Any help would be greatly appreciated. 
trigger TriggerUpdateUnitExtWarranty on Unit__c (before insert, before update) {
  
  // Step 1: Create a set of all extended warranties of Units to query
  Set<String> extwrnty = new Set<String>();
  
  for (Unit__c newUnit : Trigger.new) {
    if (newUnit.Order_No__c != null) {
      extwrnty.add(newUnit.Order_No__c);    }
  }

  // Step 2: Query for all the Units in Step 1
  List<Extended_Warranty__c> potentialproduct = [SELECT Id, Name,Product_Code__c FROM Extended_Warranty__c
                                 WHERE  Name IN :extwrnty];

  // Step 3: Make a Map that lets you search for units by extended warranty
  Map<String, Extended_Warranty__c> ewrntyMap = new Map<String, Extended_Warranty__c>();
  for (Extended_Warranty__c w : potentialproduct) {
    ewrntyMap.put(w.Product_Code__c, w);
  }

  // Step 4: Get the matching extended warranty in the Map by extended warranty!
  for (Unit__c newUnit : Trigger.new) {
    
    if (newUnit.Ext_Warranty__c == null) {
      Extended_Warranty__c ordnm = ewrntyMap.get(newUnit.Product_Code__c);

  //ordnm is the name of the extended warranty record that is associated with the unit.      
    if (ordnm != null) {
      newUnit.Ext_Warranty__c  = ordnm.Id;
      }
     
    }
  }

}
  • February 24, 2016
  • Like
  • 0
I have a trigger that should send an email to a specific email address if the task subject is troubleshooting and it is created by a specific user. But it doesnt work. any help would be greatly appreciated as I can not figure out this issue . The code is below.

 
trigger  Trigger_SendPartsTechEmail on Task (before update) {
   List<Messaging.SingleEmailMessage> emailList=new List<Messaging.SingleEmailMessage>();
   Map<Id, User> userMap = new Map<Id,User>([SELECT id FROM User WHERE Username IN('bpoliquin@cybexintl.com.cybextest','tghetti@cybexintl.com') AND isActive=True]);
    for(Task tsk : Trigger.New){
        if(tsk.Subject=='Troubleshooting' && userMap.keySet().contains(tsk.createdById) ){
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[] {'bpoliqui@aol.com'};
            mail.setToAddresses(toAddresses); // Set the TO addresses
            mail.setSubject('A task owned by you has been updated'); // Set the subject
                String template = 'Hello {tsk.First_Name__c}, \nYour task has been modified. Here are the details - \n\n';
                template+= 'Subject - {tsk.Subject}\n';
                template+= 'Comments - {tsk.Activity_Comment__c}\n';
             mail.setPlainTextBody (template);
             emailList.add(mail);
        }
    }
    Messaging.SendEmail(emailList);
}

 
  • July 13, 2015
  • Like
  • 1
I have a popup message using visualforce and java. I only need the message to popup once during a session but everytime someone clicks away from the record and clicks back the message keeps popping up.  Is there something I can add to my code below that will make this message popup once?

<apex:page standardController="Case">

  <script type="text/javascript">
    var s = "";
    var a = "{!JSENCODE(Case.Account.Alert_Message__c)}";
    if (a.length > 0)
    {
      s += "Account Alert: " + a + "\n";
    }
    
    if (s.length > 0)
    {
      window.alert(s);
    }
  </script>
 
</apex:page>
  • June 20, 2014
  • Like
  • 1
I need to change the behavior of where the pkb articles open. I want them to open in the right column after a user clicks the link.  Can some one point me in the right direction?

PKB Right Column
  • April 15, 2014
  • Like
  • 1
I am having an issue with a flow process. It keeps giving me  the following error. The flow failed to access the value for myVariable_old.AccountId because it hasn't been set or assigned. I updated the updated record decison but it still give me the same error. Below is the error report and the process images.  Any help with this would be greatly appreciated.

An error occurred at element myDecision2 (FlowDecision).
The flow failed to access the value for myVariable_current.AccountId because it hasn't been set or assigned.

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: Set_Primary_Quote_Process
Type: Workflow
Version: 6
Status: Active
Flow Interview Details
Interview Label: Set_Primary_Quote_Process-7_Quote
Current User: NA Integration User (00580000003Mg0C)
Start time: 10/19/2016 10:19 AM
Duration: 0 seconds
How the Interview Started
NA Integration User (00580000003Mg0C) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = 0Q0340000007wpwCAA
myVariable_current = 0Q0340000007wpwCAA
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "10/19/2016 10:19 AM"
DECISION: isChangedDecision4_myRule_3_Name
DECISION: isChangedDecision5_myRule_3_Oracle_Quote_c
DECISION: isChangedDecision6_myRule_3_Amount_c
Executed this outcome: isChangedRule_6_myRule_3_Amount_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Amount__c} (295,824) Does not equal {!myVariable_current.Amount__c} (90,608)
Logic: All conditions must be true (AND)
DECISION: isChangedDecision7_myRule_3_Net_Revenue_c
Executed this outcome: isChangedRule_7_myRule_3_Net_Revenue_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Net_Revenue__c} (295,824) Does not equal {!myVariable_current.Net_Revenue__c} (90,608)
Logic: All conditions must be true (AND)
DECISION: isChangedDecision8_myRule_3_Order_Type_c
DECISION: isChangedDecision9_myRule_3_Pricebook_c
DECISION: isChangedDecision10_myRule_3_Stage_c
Executed this outcome: isChangedRule_10_myRule_3_Stage_c
Outcome conditions: and
1. {!myVariable_old} (0Q0340000007wpwCAA) Is null false
2. {!myVariable_old.Stage__c} (Draft) Does not equal {!myVariable_current.Stage__c} (Cancelled)
Logic: All conditions must be true (AND)
DECISION: myDecision

User-added image

User-added image

User-added image

 
  • October 19, 2016
  • Like
  • 0
I have a quote trigger called Update_Opportunity_Amount. I am getting the following error when i try to deploy it to my production org.


The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
Update_Opportunity_Amount

I do have a test class, but the error states I have no code coverage. I would appreciate if anyone can tell me what is wrong with my test class that it is not testing my trigger.

Trigger

Update_Opportunity_Amount
trigger Update_Opportunity_Amount on Quote (before insert, before update) {

    List<Opportunity> opps = new List<Opportunity>();
    List<Quote> quotes = new List<Quote>();
    Map<Id, Double> quoteNR = new Map<Id, Double>();
    Set<Id> oppIds = new Set<Id>();
    Set<Id> qteIds = new Set<Id>();

    for (Quote q : Trigger.new) {
        if (q.Primary_Quote__c == true) {
            quotes.add(q);
            qteIds.add(q.Id);
            if (!quoteNr.isEmpty() && quoteNr.containsKey(q.OpportunityId)) {
                quoteNR.clear();
                q.addError('You are attempting to create multiple Primary Quotes into the one Opportunity');
            }
            else {
                quoteNR.put(q.OpportunityId, q.Net_Revenue__c);
            }
        }
    }
    
    if (!quoteNR.isEmpty()) {
        
        // Check if any Quotes tied to the same Opportunity as this Quote is listed as a Primary Quote
        for (Quote q : [SELECT Id, Primary_Quote__c, OpportunityId FROM Quote WHERE OpportunityId IN :quoteNR.keySet() AND Primary_Quote__c = true]) {
            if (qteIds.isEmpty() || !qteIds.contains(q.Id)) {
                oppIds.add(q.OpportunityId);
            }
        }

        if (!oppIds.isEmpty()) {
            for (Quote q : quotes) {
                if (oppIds.contains(q.OpportunityId)) {
                    q.addError('The Opportunity tied to this Quote already contains a Primary Quote. This quote cannot be set as a Primary Quote');
                }
            }
        }
            
        // Update the Opportunity with the Net Revenue from the Quote 
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :quoteNR.keySet()]) {
            o.Amount = quoteNR.get(o.Id);
            opps.add(o);
        }
    }
    
    if (!opps.isEmpty()) {
        update(opps);
    }
}

Test Class
@isTest
private class Update_Opportunity_Amount_TestClass {

    static testMethod void myUnitTest() {
        
        RecordType naOppType = [SELECT Id FROM RecordType WHERE Name = 'NA Opportunity Record Type' LIMIT 1];
        RecordType naAccTypeCustomer = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Active Customer - BW' LIMIT 1];
        RecordType naAccTypeProspect = [SELECT Id FROM RecordType WHERE Name = 'NA Customer Account Record Type - Prospect - BW' LIMIT 1];
        List<Account> accs = new List<Account>();
        List<Opportunity> opps = new List<Opportunity>();
        List<Quote> quotes = new List<Quote>();

        // Insert the Accounts to be used for the testing
        Integer j = 0;
        for (Integer i = 0; i < 41; i++) {
            Account a = new Account();
            a.Name = 'Account Test ' + i;
            a.Sales_Channel__c = '160 SPECIAL FORCES';
            a.Marketing_Level__c = 'Developer';
            a.Billing_Region__c = '1';
            a.BillingCity = '1';
            a.BillingCountry = '1';
            a.BillingPostalCode = '1';
            a.BillingState = '1';
            a.BillingStreet = '1';
            a.Shipping_Region__c = '1';
            a.ShippingCity = '1';
            a.ShippingCountry = '1';
            a.ShippingPostalCode = '1';
            a.ShippingState = '1';
            a.ShippingStreet = '1';
            if (j == 0) {
                a.RecordTypeId = naAccTypeProspect.Id;
                j = 1;
            }
            else {
                a.RecordTypeId = naAccTypeCustomer.Id;
                j = 0;          
            }
            accs.add(a);
        }
        insert(accs);
        
        // Insert the Opportunities to be used for the testing
        for (Integer i = 0; i < 41; i++) {
            Opportunity o = new Opportunity();
            o.Name = 'Opportunity Test ' + i;
            o.Amount = 111.11;
            o.StageName = 'H - Hot Prospect';
            o.CloseDate = Date.today() + 365;
            o.AccountId = accs[i].Id;
            o.RecordTypeId = naOppType.Id;
            if (j == 0) {
                o.Interface_Status_del__c = 'D';
                j = 1;
            }
            else {
                j = 0;          
            }           
            opps.add(o);
        }
        insert(opps);
        
        // Create Quoets that are NOT Primary Quotes. Each Quote for its own Opportunity
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 222.22;
            q.Primary_Quote__c = false;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities still equals 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 111.11);
        }
        
        // Create Quoets that are Primary Quotes. Each Quote for its own Opportunity
        quotes.clear(); 
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 999.99;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        insert(quotes);
        
        // Validate that the Amount on the Opportunities now equals 999.99
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 999.99);
        }       
        
        // Update the Quotes with a new Net Revenue
        for (Quote q : quotes) {
            q.Net_Revenue__c = 555.55;
        }
        update(quotes);     
        
        // Validate that the Amount on the Opportunities now equals 555.55
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }       
        
        
        // Insert new Quotes that are also Primary Quotes to the same Opportunities as above. An error should be thrown
        quotes.clear();     
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 333.33;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[i].Id;
            quotes.add(q);
        }
        try {
            insert(quotes);
            System.assert(false);
        } catch (DmlException e) {
            System.assert(e.getDmlMessage(0).indexOf('The Opportunity tied to this Quote already contains a Primary Quote. This quote cannot be set as a Primary Quote') > -1);
        }       
        
        // Validate that the Amount on the Opportunities still equals 555.55 and not 333.33 
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id IN :opps AND Id != :opps[40].Id]) {
            System.assertEquals(o.Amount, 555.55);
        }
        
        // Create multiple Quotes for the one Opportunity all quotes being a Primary Quote. An error should be thrown
        quotes.clear();
        for (Integer i = 0; i < 40; i++) {
            Quote q = new Quote();
            q.Name = 'Quote Test ' + i;
            q.Net_Revenue__c = 888.88;
            q.Primary_Quote__c = true;
            q.OpportunityId = opps[40].Id;
            quotes.add(q);
        }
        try {
            insert(quotes);
            System.assert(false);
        } catch (DmlException e) {
            System.assert(e.getDmlMessage(0).indexOf('You are attempting to create multiple Primary Quotes into the one Opportunity') > -1);
        }
        
        // Check that the last Opportunity (used for above test) still has the Amount 111.11
        for (Opportunity o : [SELECT Id, Amount FROM Opportunity WHERE Id = :opps[40].Id]) {
            System.assertEquals(o.Amount, 111.11);
        }
    }
}

 
  • October 17, 2016
  • Like
  • 0
I am having an issue with one a flow process. It keeps giving me  the following error. The flow failed to access the value for myVariable_old.AccountId because it hasn't been set or assigned.
User-added image

User-added image
  • October 17, 2016
  • Like
  • 0
My test class below keeps coming up with an error when i triy to move an updated trigger over to my production org via outbound change set or eclipse. The error is List has no rows for assignement. If anyone can help find the reason this test class keeps coming up with an error, i would appreciate it.
User-added image

/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 *
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */

@isTest
private class Account_Create_Contact_TestClass {

    static testMethod void myUnitTest() {
       
        Profile p = [SELECT Id FROM Profile WHERE Name = 'BLX Telemarketer' LIMIT 1];
        User u = [SELECT Id FROM User WHERE ProfileId = :p.Id AND User.IsActive = true LIMIT 1];
        List<Account> accs = new List<Account>();
        List<Account> conAccs = new List<Account>();
        Set<Id> accIds = new Set<Id>();
       
        Integer i = 0;
        System.runAs(u) {
           
            // Test Accounts with no Last Name has been added
            for (Account a : [SELECT Id FROM Account LIMIT 50]) {
                a.Eerstenaam__c = 'Test First Name';
            }
           
            if (!accs.isEmpty()) {
                update(accs);
                accs.clear();
            }
                   
            for (Account a : [SELECT Id FROM Account LIMIT 50]) {
                accIds.add(a.Id);
                a.Eerstenaam__c = 'Test First Name';
                a.Achternaam__c = 'Test Last Name';
                a.Nieuwsbrieven_ontvangen__c = false;
                if (i == 0) {
                    a.Nieuwsbrieven_Ontvangen__c = true;
                    a.Dezelfde_Email__c = true;
                    i = 1;
                }
                else if (i == 1) {
                    i = 2;
                    a.Status_Belactie_2010__c = 'Wil Gebeld Worden Door Account Manager';
                    a.Opmerkingen__c = 'This is a test Task';
                }
                else {
                    a.Achternaam__c = NULL;
                }
                accs.add(a);
            }
            if (!accs.isEmpty()) {
                update(accs);
            }
           
            for (Contact c : [SELECT Id, LastName, AccountId FROM Contact WHERE AccountId IN :accIds AND LastName = 'Test Last Name']) {
                Account a = new Account(Id=c.AccountId);
                a.Achternaam__c = c.LastName;
                conAccs.add(a);
            }
           
            if (!conAccs.isEmpty()) {
                update(conAccs);
            }          
        }
               
       
    }
}
  • October 17, 2016
  • Like
  • 0
I have the following code below that i'm trying to add and if statement to check to see if a record has been recently modified by the last date and time being greater than the created date.  I also tried to and it to where I can check for old values and new vlalues but nothing seems to work. I would like to remove the old field value section of the code and add a check for last modified date and time. If the record has the newest last modifiied date and time then check the Primary Quote checkbox. Any help would be greatly appreciated. 
 
trigger MarkPrimaryQuote on Quote (before insert, before update) {
    List<Quote> quoteListToUpdate = new List<Quote>();

    Set<Id> opppIds = new Set<Id>();
    for(Quote qRec : Trigger.new){
        if(qRec.OpportunityId!= null){
            opppIds.add(qRec.OpportunityId);
        }
    }
    Map<Id,Opportunity> mapOfOpps = new Map<Id,Opportunity>([Select id,(Select Primary_Quote__c from Quotes) from Opportunity where Id IN :opppIds]);
    if(trigger.isInsert){
        for(Quote qRec : Trigger.new){
            qRec.Primary_Quote__c = true;
        }
        for(Opportunity opp : mapOfOpps.values()){
            for(Quote existingQuote : opp.Quotes){
                existingQuote.Primary_Quote__c =false;
                quoteListToUpdate.add(existingQuote);
            }
        }
        if(quoteListToUpdate.size() > 0){
            update quoteListToUpdate;
        }
    }
     if(trigger.isUpdate){
        for(Quote qRec : Trigger.new){
  // I would like to remove this section and add a check for last date and time modified         
     Quote oldQuote = trigger.oldMap.get(qRec.id);
            if(oldQuote.Stage__c != qRec.Stage__c || oldQuote.Amount__c !=      qRec.Amount__c || oldQuote.Discount__c != qRec.Discount__c ){
                qRec.Primary_Quote__c =true;

                if(qRec.OpportunityId!= null && mapOfOpps.containsKey(qRec.OpportunityId)){
                    for(Quote existingQuote : mapOfOpps.get(qRec.OpportunityId).Quotes){
                        if(existingQuote.id != qRec.id){
                            quoteListToUpdate.add(existingQuote);
                        }
                    }
                }
            }
        }
        if(quoteListToUpdate.size() > 0){
            update quoteListToUpdate;
        }
    }
}

 
  • May 25, 2016
  • Like
  • 0
I have a trigger that I am trying to add a before update to a before insert trigger but i keep getting the following error. 
What can I change on this code to make it allow insert and updates? I need it to set to 'true' for any new Quotes and 'false' for any Quotes that get updated?

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger MarkPrimaryQuote caused an unexpected exception, contact your administrator: MarkPrimaryQuote: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0Q0n0000000DRrLCAW; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0Q0n0000000DRrL) is currently in trigger MarkPrimaryQuote, therefore it cannot recursively update itself: []: Trigger.MarkPrimaryQuote: line 19, column 1
 
trigger MarkPrimaryQuote on Quote (before insert, before update) {
    
  
 List<DateTime> oracleQuoteList = new List<DateTime>();
    for(Quote qRec : Trigger.new) {
    
    if(qRec == null )
        qRec.Primary_Quote__c = true;
        oracleQuoteList.add(qRec.Created_Date__c );      
    }
    
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,Created_Date__c from Quote WHERE Created_Date__c= TODAY AND HOUR_IN_DAY(LastModifiedDate) > 1]) {
        qRec.Primary_Quote__c =false;
        quoteListToUpdate.add(qRec);    
    }
    
    if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }

  
  
}

 
  • May 17, 2016
  • Like
  • 0
I have a trigger that I am trying to add a before update to a before insert trigger but i keep getting the following error.  What can I change on this code to make it allow insert and updates?

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger MarkPrimaryQuote caused an unexpected exception, contact your administrator: MarkPrimaryQuote: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0Q0n0000000DRrLCAW; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0Q0n0000000DRrL) is currently in trigger MarkPrimaryQuote, therefore it cannot recursively update itself: []: Trigger.MarkPrimaryQuote: line 19, column 1
 
//Created by Bob Poliquin 5/12/2016
// Updated the soql query to identify last modified date. 5/12/2016

trigger MarkPrimaryQuote on Quote (before insert,before update) {
    List<Datetime> oracleQuoteList = new List<Datetime>();
    for(Quote qRec : Trigger.new) {
   
        qRec.Primary_Quote__c = true;
        oracleQuoteList.add(qRec.LastModifiedDate);      
    }
    
    
    List<Quote> quoteListToUpdate = new List<Quote>();
    for(Quote qRec : [SELECT id,Primary_Quote__c,CreatedDate from Quote WHERE LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 1]) {
        qRec.Primary_Quote__c =false;
        quoteListToUpdate.add(qRec);    
    }
         if(quoteListToUpdate != null && quoteListToUpdate .size() > 0) {
        update quoteListToUpdate;
    }
    
}

 
  • May 16, 2016
  • Like
  • 0
I have a trigger below that works but i need it to check a Primary_Quote__c checkbox on the newest created quote on an opportunity with the record type of "NA Opportunity Record Type".  How would i accomplish adding a filter to only check the newest Primary_Quote__c quote while unchecking previous qoutes?


 
trigger Trigger_MarkPrimaryQuote on Quote (before insert) { 
    List<Id> opptyList = new List<Id>();
    for(Quote qRec : Trigger.New)
        opptyList.add(qRec.OpportunityId);
        
    Map<Id,Opportunity> opptyMap = new Map<Id,Opportunity>([Select Id, RecordType.Name from Opportunity where Id IN :opptyList]) ;
    for(Quote qRec :Trigger.New ) {
        if(opptyMap.containsKey(qRec.OpportunityId) && opptyMap.get(qRec.OpportunityId).RecordType.Name == 'NA Opportunity Record Type')
            qRec.Primary_Quote__c = true;
    
    
    }
    }

 
  • May 05, 2016
  • Like
  • 0
I am trying to figure out how to write  a trigger/apex class that would look through a list of quotes. There is a checkbox (Primary_Quote__c) I need the trigger or class to look through the list of quote. There is a custom field Entitled (Oracle_Quote__c). I need the trigger to look through the list of quotes with the same Oracle Quote Number and automatically check the Primary Quote checkbox on the record with the newest created date, and also uncheck the older quote records. Is this possible? How would I accomplish? Any helpwuold be greatly appreicated. 
  • April 13, 2016
  • Like
  • 0