• Mat Jaggard
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 4
    Replies
I added the below lines of code for upsert operation to record the duplicate record set.But I face compile time error .Please note that the dmloptions work for database.insert and database.update.Please help
Lines of Code:
Database.DMLOptions dml1 = new Database.DMLOptions();
  dml1.DuplicateRuleHeader.AllowSave = true;
  Database.upsert(lstOfEqup1, dml1);

Error message :
Method does not exist or incorrect signature: void upsert(List<Account>, Database.DMLOptions) from the type Database  
 
Hello,

I want to add a text inside like below

User-added image

caseObj.Descripion= Label.Descrption;

Description label is like
"Date:\nTime:\nname:"

When i try to add this label, it always adds the "Date:\nTime:\nname:"
the new line is never added.

How can i achieve it ?

I am not familiar with maps so any help is greatly appreciated!  Can anyone help me understand why I am getting the below error on the below code??  Please note that line 15 is "Map idsCoverage = new Map();"

 

Thanks in advance for any help!!!

 

Error: Compile Error: unexpected token: 'Map' at line 15 column 0

 

 

//This trigger includes all financial rollups to the Coverage

trigger UpdateRollupsToCoverage on Claim__c (after update)
//Define variables
{
double sumCoverageTotalExpenseOS = 0.0;
double sumCoverageTotalExpensePD = 0.0;
double sumCoverageTotalLegalOS = 0.0;
double sumCoverageTotalLegalPD = 0.0;
double sumCoverageTotalIndemnityOS = 0.0;
double sumCoverageTotalIndemnityPD = 0.0;
Coverage__c [] coveragesToUpdate = new Coverage__c[]{};


Map idsCoverage = new Map();

if(Trigger.isUpdate)
if(Claim__c.Claim_Coverage__c!=null)
{
Claim__c [] teNew = trigger.new;
for(Claim__c te : teNew)
{
for (Coverage__c claimCoverage : [select Id, Name, Coverage_Total_Expense_O_S__c from Coverage__c where Id = :te.Claim_Coverage__c])
{

//Sum all the claimCoverage entries
//Total Expense OS
for (Claim__c expenseOSs: [select Id, Expense_OS__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalExpenseOS += expenseOSs.Expense_OS__c;}
claimCoverage.Coverage_Total_Expense_O_S__c = sumCoverageTotalExpenseOS;
//Total Expense PD
for (Claim__c expensePDs: [select Id, Expense_PD__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalExpensePD += expensePDs.Expense_PD__c;}
claimCoverage.Coverage_Total_Expense_PD__c = sumCoverageTotalExpensePD;
//Total Legal OS
for (Claim__c legalOSs: [select Id, Legal_OS__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalLegalOS += legalOSs.Legal_OS__c;}
claimCoverage.Coverage_Total_Legal_O_S__c = sumCoverageTotalLegalOS;
//Total Legal PD
for (Claim__c legalPDs: [select Id, Legal_PD__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalLegalPD += legalPDs.Legal_PD__c;}
claimCoverage.Coverage_Total_Legal_PD__c = sumCoverageTotalLegalPD;
//Total Indemnity OS
for (Claim__c indemnityOSs: [select Id, Indemnity_OS__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalIndemnityOS += indemnityOSs.Indemnity_OS__c;}
claimCoverage.Coverage_Total_Indemnity_O_S__c = sumCoverageTotalIndemnityOS;
//Total Indemnity PD
for (Claim__c indemnityPDs: [select Id, Indemnity_PD__c from Claim__c where Claim_Coverage__c = :claimCoverage.id])
{sumCoverageTotalIndemnityPD += indemnityPDs.Indemnity_PD__c;}
claimCoverage.Coverage_Total_Indemnity_PD__c = sumCoverageTotalIndemnityPD;

if(!idsCoverage.containsId(claimCoverage.id))
{
idsCoverage.put(claimCoverage.id, claimCoverage.id);
//add claimCoverage to list to be updated outside of the loop only if coverage is Unique
coveragesToUpdate.add(claimCoverage);
}
else
{
//If coverage exists then update separately

update claimCoverage;
}

}}}

//commit the changes to Salesforce
update coveragesToUpdate;}

  • August 15, 2012
  • Like
  • 0

We're getting an unexpected error message when we try to compile this on the line noted below: "Error: Compile Error: Expression of type TestClass.TestType has no member named A at line ....."

 

If we comment out the contents of runTest then it compiles fine. We suspect a bug in Apex in which static methods cannot reference enums. This is ironic because static testMethods can!


@isTest
private class FixAccountIdInSalsTest
{
    private enum TestType{A, B}
    
    private static testMethod void testForA()
    {
        runTest(TestType.A); // COMPILES FINE
    }

    private static testMethod void testForB()
    {
        runTest(TestType.B); // COMPILES FINE
    }
    
    private static void runTest(TestType testType)
    {
        Test.StartTest();
        if (TestType.A == testType) // COMPILER BREAKS HERE
        {
            // do something
        }
        else if (TestType.B == testType) // AND PRESUMABLY BREAKS HERE
        {
            // do something else
        }
    }
}

Hello,

I want to add a text inside like below

User-added image

caseObj.Descripion= Label.Descrption;

Description label is like
"Date:\nTime:\nname:"

When i try to add this label, it always adds the "Date:\nTime:\nname:"
the new line is never added.

How can i achieve it ?