• JimmyK12
  • NEWBIE
  • 25 Points
  • Member since 2012

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

The method below fails and throws a null pointer exception on the highlighted and only on the highlighted line, which is strange because the highlighted is nearly exactly the same as a line above it that is in a different if/else branch. The other thing that has me scratching my head is that the system.assert(also highlighted) shows me that the variable called 'source'  is not null and has the expected value. So, can anyone spot why I might be getting this error?

 

Thanks!

  public static void saveLogic(Map<Id,List<courseCodeWrapper>> consCourseCodeMap, String triggerType, String source) {
        
        if(triggerType == 'Insert/Update') {            
            List<Contact_Course_Code__c> conCourseCodes = new List<Contact_Course_Code__c>();
                        
            for(Contact con : [Select Id,Name, Course_Code_Count__c, (Select Id, Contact__c, Course_Code__c, CourseRoleCount__c, Current__c, Primary__c, EvalCount__c from Contact_Course_Code__r) from Contact where Id IN: consCourseCodeMap.keySet()]) {
                
                if(con.Course_Code_Count__c == 0) {
	                    for(courseCodeWrapper cc : consCourseCodeMap.get(con.Id)) {
	                        
	                        //Integer currentCount = cc.currentCheck ? 1 : 0;
	                		//Integer primaryCount = cc.PrimaryCheck ? 1 : 0;
	                        
	                        Contact_Course_Code__c newCCC = new Contact_Course_Code__c(
	                    		Contact__c = con.Id,                            
	                        	Course_Code__c = cc.courseCodeId,
	                            CourseRoleCount__c = source == 'Course' ? 1 : 0,
	                            EvalCount__c = source == 'Eval' ? 1 : 0
	                            //Current__c = currentCount,                                    
	                            //Primary__c = primaryCount                            
	                    	);
	                        conCourseCodes.add(newCCC);
	                    }                	
                    insert conCourseCodes;
                } else if(con.Course_Code_Count__c > 0) {
                    for(courseCodeWrapper cdWrap : consCourseCodeMap.get(con.Id) ) {
                        
                        //Integer currentCounter = cdWrap.currentCheck ? 1 : 0;
                        //Integer primaryCounter = cdWrap.primaryCheck ? 1 : 0;
                        
                        for(Contact_Course_Code__c conCD : con.Contact_Course_Code__r) {
                            if(conCD.Course_Code__c == cdWrap.CourseCodeId) {                                
                                conCD.CourseRoleCount__c += source == 'Course' ? 1 : 0;
                                conCD.EvalCount__c += source == 'Eval' ? 1 : 0;
                                //conCD.Current__c += currentCounter;
                                //conCD.Primary__c += primaryCounter;
                                conCourseCodes.add(conCD);
                            }
                        }
                    }
                    update conCourseCodes;
                }
            }
        }
            
        if(triggerType == 'Delete') {
            List<Contact_Course_Code__c> conCourseCodesUpdate = new List<Contact_Course_Code__c>();
            List<Contact_Course_Code__c> conCourseCodesDel = new List<Contact_Course_Code__c>();
                        
            for(Contact con : [Select Id,Name, Course_Code_Count__c, (Select Id, Contact__c, Course_Code__c, CourseRoleCount__c, Current__c, Primary__c,Total_Association_Count__c from Contact_Course_Code__r) from Contact where Id IN: consCourseCodeMap.keySet()]) {
                
                if(con.Course_Code_Count__c > 0) {
                    for(courseCodeWrapper cdWrap : consCourseCodeMap.get(con.Id) ) {
                        
                        //Integer currentCounter = cdWrap.currentCheck ? 1 : 0;
                        //Integer primaryCounter = cdWrap.primaryCheck ? 1 : 0;
                        
                        for(Contact_Course_Code__c conCD : con.Contact_Course_Code__r) {
                            if(conCD.Course_Code__c == cdWrap.CourseCodeId) {                                
                                if(conCD.Total_Association_Count__c > 1) {
                                    conCD.CourseRoleCount__c -= source == 'Course' ? 1 : 0;  //system.assert(false, 'This is your SOURCE: '+source);
                                    conCD.EvalCount__c -= source == 'Eval' ? 1 : 0;
                                    //conCD.Current__c += currentCounter;
                                    //conCD.Primary__c += primaryCounter;
                                    conCourseCodesUpdate.add(conCD);
                                }else{
                                    conCourseCodesDEL.add(conCD);
                                }
                            }
                        }
                    }
                    if(conCourseCodesUpdate.size() > 0) {
                    	update conCourseCodesUpdate;
                    }
                    if(conCourseCodesDel.size() > 0) {
                        delete conCourseCodesDel;
                    }
                }
            }
        }    	
    }

 

I'm working in my full sandbox attempting to update a custom button on the opportunity object to refresh the tab when working in the service console. The code is very simple and the "isInConsole()" method works fine - meaning the integration.js script is included and working to a degree.
As soon as I attempt to use a method that uses a callback I'm getting the following error in the browser console (my org is cs9):

GET https://cs9.salesforce.com/undefined 404 (Not Found)

I can't find any solution to this - only this other post with a mention of the problem but no solution to the issue I'm having (https://success.salesforce.com/ideaView?id=08730000000kpcfAAA)

Here's the code:
{!REQUIRESCRIPT("/xdomain/xdomain.js")}
{!REQUIRESCRIPT("/support/console/25.0/integration.js")}

alert('Is in console check: ' + sforce.console.isInConsole());
var callBackFunction = function callBackFunction(result) {
var tabId = result.id;
alert('Tab id: ' + tabId);
};
sforce.console.getEnclosingTabId(callBackFunction);//WHY YOU NO WORK?!

I have some trigger logic that determines the ownership of leads based on come criteria from a webform, but I would like to include some code that will attempt to assign the ownership to a user who is currently logged into our call center and ready to receive calls. We are using CTI and the Avaya adapter for salesforce.

 

Is there any way to find out which users are currently logged into our call center via apex - ideally via a trigger? Everything I've found so far has been javascript...

 

I can't seem to find where the agent's status ("Ready for calls"/"Not ready for calls"...) is stored, or if it is even stored at all in a way that apex can get to it.

 

Any assistance is greatly appreciated.

The method below fails and throws a null pointer exception on the highlighted and only on the highlighted line, which is strange because the highlighted is nearly exactly the same as a line above it that is in a different if/else branch. The other thing that has me scratching my head is that the system.assert(also highlighted) shows me that the variable called 'source'  is not null and has the expected value. So, can anyone spot why I might be getting this error?

 

Thanks!

  public static void saveLogic(Map<Id,List<courseCodeWrapper>> consCourseCodeMap, String triggerType, String source) {
        
        if(triggerType == 'Insert/Update') {            
            List<Contact_Course_Code__c> conCourseCodes = new List<Contact_Course_Code__c>();
                        
            for(Contact con : [Select Id,Name, Course_Code_Count__c, (Select Id, Contact__c, Course_Code__c, CourseRoleCount__c, Current__c, Primary__c, EvalCount__c from Contact_Course_Code__r) from Contact where Id IN: consCourseCodeMap.keySet()]) {
                
                if(con.Course_Code_Count__c == 0) {
	                    for(courseCodeWrapper cc : consCourseCodeMap.get(con.Id)) {
	                        
	                        //Integer currentCount = cc.currentCheck ? 1 : 0;
	                		//Integer primaryCount = cc.PrimaryCheck ? 1 : 0;
	                        
	                        Contact_Course_Code__c newCCC = new Contact_Course_Code__c(
	                    		Contact__c = con.Id,                            
	                        	Course_Code__c = cc.courseCodeId,
	                            CourseRoleCount__c = source == 'Course' ? 1 : 0,
	                            EvalCount__c = source == 'Eval' ? 1 : 0
	                            //Current__c = currentCount,                                    
	                            //Primary__c = primaryCount                            
	                    	);
	                        conCourseCodes.add(newCCC);
	                    }                	
                    insert conCourseCodes;
                } else if(con.Course_Code_Count__c > 0) {
                    for(courseCodeWrapper cdWrap : consCourseCodeMap.get(con.Id) ) {
                        
                        //Integer currentCounter = cdWrap.currentCheck ? 1 : 0;
                        //Integer primaryCounter = cdWrap.primaryCheck ? 1 : 0;
                        
                        for(Contact_Course_Code__c conCD : con.Contact_Course_Code__r) {
                            if(conCD.Course_Code__c == cdWrap.CourseCodeId) {                                
                                conCD.CourseRoleCount__c += source == 'Course' ? 1 : 0;
                                conCD.EvalCount__c += source == 'Eval' ? 1 : 0;
                                //conCD.Current__c += currentCounter;
                                //conCD.Primary__c += primaryCounter;
                                conCourseCodes.add(conCD);
                            }
                        }
                    }
                    update conCourseCodes;
                }
            }
        }
            
        if(triggerType == 'Delete') {
            List<Contact_Course_Code__c> conCourseCodesUpdate = new List<Contact_Course_Code__c>();
            List<Contact_Course_Code__c> conCourseCodesDel = new List<Contact_Course_Code__c>();
                        
            for(Contact con : [Select Id,Name, Course_Code_Count__c, (Select Id, Contact__c, Course_Code__c, CourseRoleCount__c, Current__c, Primary__c,Total_Association_Count__c from Contact_Course_Code__r) from Contact where Id IN: consCourseCodeMap.keySet()]) {
                
                if(con.Course_Code_Count__c > 0) {
                    for(courseCodeWrapper cdWrap : consCourseCodeMap.get(con.Id) ) {
                        
                        //Integer currentCounter = cdWrap.currentCheck ? 1 : 0;
                        //Integer primaryCounter = cdWrap.primaryCheck ? 1 : 0;
                        
                        for(Contact_Course_Code__c conCD : con.Contact_Course_Code__r) {
                            if(conCD.Course_Code__c == cdWrap.CourseCodeId) {                                
                                if(conCD.Total_Association_Count__c > 1) {
                                    conCD.CourseRoleCount__c -= source == 'Course' ? 1 : 0;  //system.assert(false, 'This is your SOURCE: '+source);
                                    conCD.EvalCount__c -= source == 'Eval' ? 1 : 0;
                                    //conCD.Current__c += currentCounter;
                                    //conCD.Primary__c += primaryCounter;
                                    conCourseCodesUpdate.add(conCD);
                                }else{
                                    conCourseCodesDEL.add(conCD);
                                }
                            }
                        }
                    }
                    if(conCourseCodesUpdate.size() > 0) {
                    	update conCourseCodesUpdate;
                    }
                    if(conCourseCodesDel.size() > 0) {
                        delete conCourseCodesDel;
                    }
                }
            }
        }    	
    }

 

I have a pre chat form, and used the following three query tag:

  • <input type="hidden" name="liveagent.prechat.query:Email" value="Contact,Contact.Email"/>
  • <input type="hidden" name="liveagent.prechat.query:Name" value="Contact,Contact.Name"/>
  • <input type="hidden" name="liveagent.prechat.query:PantherId" value="Contact,Contact.Student_Id__c"/>

The first two work but the last one does not.

Does anyone know where to find documentation about this queries? The developer guide only provided an example.

Is there a different syntax for custom fields?

 

Was wondering if anyone has come across a similar issue before...

 

Getting the following errors when trying to do a full deployment using the migration tool.

 

Error: workflows/PersonAccount.workflow(PersonAccount):Cannot create workflow directly; must create the CustomObject first

---> This is odd because it's a full deployment which means the object is there, but for some reason the error exists. In addition, there's no visible Person Account-specific workflow component in the org itself for a metadata component to be generated.

 

Error: workflows/Question.workflow(Question):Cannot create workflow directly; must create the CustomObject first

Error: workflows/Reply.workflow(Reply):Cannot create workflow directly; must create the CustomObject first

---> Best guess for these two is that they are related to the installation of the Timba app which some folks are trying out. Having said that, I've already uninstalled the app in the source org, but the *.workflow metadata components are still there. I even tried physically removing the metadata in both the IDE and yet when I do a refresh from the server, they both come back.

 

Appreciate any insights you can offer on these errors.

Hopefully someone has encountered them before and can let me know how they were able to get rid of them.

Last resort is of course doing a clean-up of the metadata after a 'retrieve' task and prior to the 'deploy',

but I'd rather find the root cause and fix it properly.

 

Thanks in advance!