在Apex触发器中调用我的Apex方法获取错误


    public static void insertInboundJive(Map<Id, String> mapCases){
    try{
        system.debug('Aditya');
        Map<Id, String> mapCases1 = new Map<Id, String>();
        Map<Id, Integer> mapIncrements = new Map<Id, Integer>();
        //List<ICS_Case_Interaction__c> lstCaseInteraction;
        if(mapCases != null && mapCases.size() > 0) {
        List<ICS_Case_Interaction__c> lstCaseInteraction  = [ SELECT Id,case__r.origin FROM ICS_Case_Interaction__c Where case__r.Id =:mapCases.keySet()];
            for(ICS_Case_Interaction__c caseInteracts :lstCaseInteraction ){
                if(caseInteracts.case__r.Id != null && caseInteracts.case__r.Status == 'New Customer Message'){
                    system.debug('**AdityaDebug**' +caseInteracts.case__r.Id);
                    system.debug('**AdityaDebug**' +caseInteracts.case__r.Status);
                    mapcases1.put(caseInteracts.case__r.Id , TYPE_JIVE_INBOUND);
                    Integer intIncrement = mapIncrements.get(caseInteracts.case__r.Id);
                    system.debug('Increment' +intIncrement);
                    if(intIncrement != null){
                        intIncrement++;
                        system.debug('Increment++' +intIncrement);
                    }
                    else {
                        intIncrement = 1;
                    }
                     mapIncrements.put(caseInteracts.case__r.Id, intIncrement);
                }
            }
            if(mapCases.size() > 0) {
                insertByCaseAsync(mapCases, mapIncrements);
            }
        }
    }
    catch(Exception ex){
        Core_Log_Entry.logEntryWithException('Case Interaction Metrics', 'CaseInteraction','insertInboundEmail', 'Error', null, null, ex);
    }
}

这是我在课堂上的方法。我试图在触发器中调用Apex方法。但是它丢弃了错误。请您帮助我并尝试达到最好的。

我遇到的错误是第188行,col 106.方法不存在或不正确签名:void insertinboundjive(list)来自类型ICS_CASE_INTERACTIONS_TRIGGER_HANDLER

if(trigger.isUpdate) {

if(label.ics_case_interaction_metrics.equals('1')){iCs_case_interactions_trigger_trigger_handler.insertinboundjive(trigger.new);}}

您正在尝试传递错误的参数。在该方法中,您已经定义了,当调用时,您需要传递一个值是字符串的地图,但是您要通过触发器。我的方法是处理触发器中的映射,然后在控制器中操纵数据:

在这种情况下,您可以执行下面的记录并在控制器中获取所需的数据字符串。或在触发器中进行操作,以免更改控制器。

Map<Id,Contact> map = new Map<Id,ICS_Case_Interaction__c>();  // new map
for(ICS_Case_Interaction__c con :trigger.new){  
    map.put(con.Id, con);  // enter the records you need for the method
}
if(trigger.isUpdate) {
        if(Label.ICS_Case_Interaction_Metrics.equals('1')) {
    ICS_Case_Interactions_Trigger_Handler.insertInboundJive(map);
        } 
    }

,在控制器中,您应该有

public static void insertInboundJive(Map<Id, ICS_Case_Interaction__c> mapCases){
}

最新更新