• kaushik Krishnan 15
  • NEWBIE
  • 15 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi,
I am facing an issue for writing a test class for a invocable method which is getting called by Process Builder.
Actual class--
public class vOppDuplicate {
//public virtual class BaseException extends Exception {}
//public class OtherException extends BaseException {}
@InvocableMethod (label='Records for duplicate' description='Duplicate Check')
public static void updateOppDup(List<Id> OpportunityIds) {
try{
        List<Opportunity> oppList = [SELECT Opp_Acc_Concatenate__c,Opportunity_Unique_Name__c FROM Opportunity WHERE Id in :OpportunityIds];
        for(Opportunity opp: oppList)
         {
           opp.Opportunity_Unique_Name__c = opp.Opp_Acc_Concatenate__c;               
         } 
          update oppList;
        //return oppList;
    }
    catch(DMLException e)
    {
        //throw new OtherException('Duplicate value is present');
        throw new DMLException('Duplicate value with same opportunity and account name already present.'+'<br/>');
        //System.debug('The following exception has occurred: ' + e.getMessage());
        //if(e.getMessage().contains('Update failed')){
        //e.setMessage('Duplicate value is already present.');
        //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, e.getMessage()));
    //}

    }
    }
}

Test Class---
@isTest
private class vOppDuplicateTest {
@isTest static void testdup() {
    Account acc = new Account(name='TestClient');
    insert acc;
    Opportunity oppList = new Opportunity(Opportunity_Unique_Name__c= 'DupAccOppTest', Name = 'OppDup',AccountId=acc.Id);
    insert oppList;
    //oppList = [SELECT Id from Opportunity where Id = : oppList.Id];
    vOppDuplicate oppdup = new vOppDuplicate();
    //oppdup.updateOppDup();
}
}

How do i call the method and pass the value ?

Thanks
Hi,
I am facing an issue for writing a test class for a invocable method which is getting called by Process Builder.
Actual class--
public class vOppDuplicate {
//public virtual class BaseException extends Exception {}
//public class OtherException extends BaseException {}
@InvocableMethod (label='Records for duplicate' description='Duplicate Check')
public static void updateOppDup(List<Id> OpportunityIds) {
try{
        List<Opportunity> oppList = [SELECT Opp_Acc_Concatenate__c,Opportunity_Unique_Name__c FROM Opportunity WHERE Id in :OpportunityIds];
        for(Opportunity opp: oppList)
         {
           opp.Opportunity_Unique_Name__c = opp.Opp_Acc_Concatenate__c;               
         } 
          update oppList;
        //return oppList;
    }
    catch(DMLException e)
    {
        //throw new OtherException('Duplicate value is present');
        throw new DMLException('Duplicate value with same opportunity and account name already present.'+'<br/>');
        //System.debug('The following exception has occurred: ' + e.getMessage());
        //if(e.getMessage().contains('Update failed')){
        //e.setMessage('Duplicate value is already present.');
        //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, e.getMessage()));
    //}

    }
    }
}

Test Class---
@isTest
private class vOppDuplicateTest {
@isTest static void testdup() {
    Account acc = new Account(name='TestClient');
    insert acc;
    Opportunity oppList = new Opportunity(Opportunity_Unique_Name__c= 'DupAccOppTest', Name = 'OppDup',AccountId=acc.Id);
    insert oppList;
    //oppList = [SELECT Id from Opportunity where Id = : oppList.Id];
    vOppDuplicate oppdup = new vOppDuplicate();
    //oppdup.updateOppDup();
}
}

How do i call the method and pass the value ?

Thanks
Hi All,

I am new at this, so please bare with me. I am trying to create a custom Export to Excel button that would appear on our Account related list "Agency Planning". I am receiving the syntax error: "Error: Export_to_Excel line 4, column 71: Element type "apex:pageblocktable" must be followed by either attribute specifications, ">" or "/>"

I ended line 4 with ">" but the error is still appearing. Any help would be great!

<apex:page standardController="Account" contentType="application/vnd.ms-excel">
    <apex:relatedList="Agency_Planning__c">
        <apex:pageBlock title="Agency Planning">
            <apex:pageBlockTable value="{!Account.Agency_Planning__c}"var="Agency_Planning__c">
                <apex:column value="{!Agency_Planning__c.Accounting_Month}">
                <apex:column value="{!Agency_Planning__c.Planned_New_Business_Commission}"/>
                <apex:column value="{!Agency_Planning__c.Actual_New_Business_Commission}"/>
                <apex:column value="{!Agency_Planning__c.Over_Under}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>   
    </apex:relatedList>                          
</apex:page>


Thanks!
Erica