• ABravo473
  • NEWBIE
  • 30 Points
  • Member since 2020

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello Everyone

I am new to the salesforce, I am working on a formula field where i am trying calculate the values from 2 seperate parent child objects
 I am tring to design a formula but i am getting an error
 
 "Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 4"
 
 Any suggestion would be really helpfull
 
 below is my formula
 
 IF(TEXT(ISPICKVAL( Project_Resource__r.Billing_Type__c , "Per Hour", Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ) * 8,
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Per Day",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Calendar Man-month Working Days",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Calendar Man-Month Days",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Custom",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),Null)))))))))))))))
public with sharing class MyApexFirstClass {
  public static void myFirstMethod() {
            List<String>listOfStrings = new List<String>{'Anjana','Sharma'};
                listOfStrings.add('Test');
                listOfStrings.add('Test1');
            system.debug(listOfStrings);
            
            Set<String>SetStrings = new Set<String>{'Hello','World'};
                setStrings.add('Case');
                setStrings.add('Case1');
            system.debug(SetStrings);
            
            Map<String , String>mapStrings = new Map<String , String>{'a' => 'b', 'c' => 'd'};
            mapStrings.put('pink' ,'blue');
                mapStrings.put('red','green');
            system.debug(mapStrings);
        }
    
    
    public static void mySecondMethod() { 
        
        List<String>listOfStrings = new List<String>{'Jaipur','Bhilwara'};
            listOfStrings.add('Test');
            listOfStrings.add('Test1');
     for(String s :listOfStrings ){
         System.debug('We have List are ' +  s);
     }
        system.debug(listOfStrings.get(0));
       
        Set<String>SetStrings = new Set<String>{'Good','Bad'};
            setStrings.add('Case');
            setStrings.add('Case1');
     for(String str :SetStrings ){
         System.debug('We have Sets are ' + str);
     }
     
     Map<String , String>mapStrings = new Map<String , String>();
        mapStrings.put('pink' ,'blue');
            mapStrings.put('red','green');
     
     String color = mapStrings.get('pink');
      System.debug('The color is: ' + color);
     
        for(String mkey :mapStrings.keyset() ){
          System.debug('Map key is ' + mkey);
       }
     for(String mvalue :mapStrings.values() ){
          System.debug('Map value is ' + mvalue);
       }
    }
    
  
    
 
    public static void myThirdMethod() {
        
        List<String>list1 = new List<String>{'Jaipur','Bhilwara'};
           List<List<String>> list2 = new List<List<String>>();
        list2.add(list1);     
        system.debug(list2);
        
        Set<String>SetStrings = new Set<String>{'Good','Bad'};
           Set<Set<String>>SetStrings1 = new Set<Set<String>>();
        SetStrings1.add(SetStrings);
        system.debug(SetStrings1);
        
        Map<String , String>mapStrings = new Map<String , String>{'a' => 'b', 'c' => 'd'};
            Map<String,Map<String,String>>mapStrings1 = new  Map<String,Map<String,String>>();
        for(String mkey :mapStrings.keyset() )
        { 
            mapStrings1.put(mkey ,mapStrings);  
        }
        for(String mvalue :mapStrings.values() )
        { 
            mapStrings1.put(mvalue ,mapStrings);  
            System.debug(mapStrings1); 
        }
     }
    
           :   
      
    public static void myFourthMethod() {
      Date someDate = Date.newInstance(2016, 4, 28);
         List<Date> dates = new List<Date>();
        dates.add(someDate);
      system.debug(dates);   
  }  
    
  
      public static  Map<String,Map<String, Map<String, String>>> myFivthMethod() {
     
           Map<String, String> mapFirstStrings = new Map<String, String>{'Test' => 'Test'};
            Map<String, Map<String, String>> mapSecondString = new Map<String, Map<String, String>>();
            mapSecondString.put('Test1', mapFirstStrings);
             Map<String, Map<String, Map<String, String>>> mapThirdString = new Map<String, Map<String, Map<String, String>>>();
             mapThirdString.put('Test2', mapSecondString);
      
           system.debug(mapThirdString);
           return mapThirdString;
     
 }
 
Hello Everyone

I am new to the salesforce, I am working on a formula field where i am trying calculate the values from 2 seperate parent child objects
 I am tring to design a formula but i am getting an error
 
 "Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 4"
 
 Any suggestion would be really helpfull
 
 below is my formula
 
 IF(TEXT(ISPICKVAL( Project_Resource__r.Billing_Type__c , "Per Hour", Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ) * 8,
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Per Day",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Calendar Man-month Working Days",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Calendar Man-Month Days",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),
IF(TEXT(ISPICKVAL(Project_Resource__r.Billing_Type__c , "Custom",Project_Resource__r.Rate_Card__c  * ( Days_Calculation__c + Currency_Cost__c ),Null)))))))))))))))
I have this method
 
Public void Method(){
for (AccountContactRelation accountContactRelation : (List<AccountContactRelation>) Trigger.new) {
            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

i want to remove Trigger.New and Trigger.Old and replace them with parameters like : 
 
Public void Method(List<AccountContactRelation> NewAccCont , List<AccountContactRelation> OldAccCont){

for (AccountContactRelation accountContactRelation : NewAccCont ) {

//How can i declare OldRoles using the parameter OldAccCont

            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

How can i declare OldRoles using the new parameter OldAccCont