• ABravo473
  • NEWBIE
  • 30 Points
  • Member since 2020

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    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)))))))))))))))
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