• Brandon Bridges 16
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 4
    Replies
We  have been having an issue where a consultant will fail to log out and ends up missing a number of chats, which hurts our reporting.

Is there a feature whereby if someone misses more than two chats, for example, they are automatically put into an inactive state?
I've tried a few different ways. the hard coding is just for testing...
List<note>mylist=new List<note>();
NOTE thisNote = new NOTE(body='hey!',title='noteB');
case mycase=[SELECT id,accountid,ownerid from case where id=:'500P0000005bZv1IAE' LIMIT 1];

thisNote.OwnerId=mycase.ownerid;
thisNote.isPrivate=false;
thisNote.parentId=mycase.accountid;
           myList.add(thisNote);
insert(mYList);*/

    
attachment attach=new attachment();
attach.name='testme';
attach.body=Blob.valueOf('informationg oes hesoejh');
attach.parentID='500P0000005bZv1';
insert attach;*/


task mtask=new task();
mtask.description=('yolo');
mtask.whatid='500P0000005bZv1';
mtask.subject='subjectB';
mtask.ownerid=UserInfo.getUserID();
mtask.status='Open';

caseComment newComment = new CaseComment();
newComment.CommentBody='hello';
newComment.IsPublished=TRUE;
newcomment.ParentId='500P0000005bZv1';
    
upsert newComment;
System.Debug(newComment.id);*/


contentnote Cnote=new contentnote();
Cnote.content=Blob.ValueOf('contentB');
Cnote.title='goTitle';
insert Cnote;

ContentDocumentLink cdl = new ContentDocumentLink();
cdl.ContentDocumentId=Cnote.id;
cdl.LinkedEntityId='500P0000005bZv1';
cdl.Visibility='AllUsers';
cdl.ShareType='I';

insert cdl;
With good reason, How do I show white space (blank) instead of --none-- in a visualforce case picklist? 

​I have about 10 picklist fields. None are required and I want the ones that have no value to be blank white space instead of "--none--". 

The reason for this is to keep my UI looking clean and readable.
Having 10 fields with a label and "--none--" beside each of them is very cumbersome. I'd much rather they just show blank.
Currently, I have two pageblocksections inside of a two column panelgrid. The challenge is to get the second pageblocksection to align at the top with the other one.

I have a visualforce page to be used by customer service consultants. 

Currently, the visualforce page pseudo-dynamically renders inputfield choices through a series of if/then statements that change each field's "renderVariable" to true or false.

So, user picks 'A' from picklist one. Fields A1,A2,A3 appear for input.

Then, user picks 'B' from picklist two. Fields B1,B2 appear for input.

Is there a better way to do this?

The main problem I have is that multiple selections cause multiple fields to render in the order they were entered rather than added to the bottom of the list. Is there a way to make the inputfields append what's already rendered?

<apex:inputField value="{!case.Status}">
  <apex:actionSupport event="onchange" action="{!Evaluate}" rerender="RequiredFields"/>
</apex:inputField>

<apex:pageBlockSection title="Required Fields" id="RequiredFields">
  <apex:inputField value="{!Case.Transaction_Number__c}" label="Transaction Number" rendered="{!if(TransactionNumber==true,true,false)}"/>

----------------------------------------------
public class FieldManager{  
  public case myCase {get;set;}
  public boolean TransactionNumber {get;set;}

  public ShowFieldManager(){
        string PageId=ApexPages.currentPage().getParameters().get('id');
        myCase=[SELECT id FROM case WHERE id=:PageId];        
        
        Evaluate();            
    }

public pagereference Falsify(){TransactionNumber=false;return null;}

public pagereference Evaluate(){
    Falsify();
     if(myCase.status=='Waiting for Transaction Number') TransactionNumber=true;
    return null.
    }
}

 

I'm concerned that my outgoing email count will increment too many times due to multiple firings in the same insert.

Will someone please tell me if this trigger is any good? How could it be improved?

trigger FirstContactResolution_Email on EmailMessage(before insert){
/*General Description:000000000000000000000000000000000000000000000000000000000000000000000
 * Track how many outgoing emails are associated with a case. 
 * Note that the value does not decrease when an associated email is deleted.
 * This field and trigger are specifically to determine first contact resolution.
000000000000000000000000000000000000000000000000000000000000000000
for(EmailMessage e:Trigger.new){
if(e.Incoming==false)//Email must be outgoing
{
case myCase=[SELECT id,outgoing_email_count__c//Get related case info
FROM case
WHERE id=:e.parentId LIMIT 1];//Based on parent ID of email.
 if(myCase!=null){
if(myCase.Outgoing_Email_Count__c!=null)
myCase.outgoing_email_count__c++;//Add one to related case outgoing count.
else myCase.Outgoing_Email_Count__c=1;//Unless no value exists
System.Debug(myCase.Outgoing_email_count__c);
upsert(myCase);//Update that case
}}}}

 
*/trigger FirstContactResolution on Case(before insert,before update){/*
/*	*/for(case c:Trigger.New){//Trigger.New grabs updated information/* 
/*    	*/dateTime now=System.Now();//Assess current time to be used throughout this trigger/*
/*//Phone/Chat-First Contact Resolution Logic/*
* 		*/if(c!=null){
/*			*/if((c.Origin.contains('Phone')||c.Origin.contains('Chat'))&&(!c.Origin.contains('CP')))/*
 *			*/{/*
 *				*/if(c.Status=='Solved'){/*
 *	    			*/if(Trigger.isUpdate){/*
 *						*/c.ElapsedTime__c=/*
 * 	   					*/(Double.valueOf(now.getTime())-Double.valueOf(c.createddate.getTime()))/1000/60;/*
 * 	   					//Current datetime minus createdDate, convert to minute format from milliseconds
 * 	   					*/if(c.ElapsedTime__c<61){/*
 *      	    			*/c.First_Contact_Resolution__c=True;/*
 *          	    		*/c.First_Solve_DateTime__c=now;/*
 *          			*/}else{c.First_Contact_Resolution__c=False;}/*
 *					*/}/*                                                            
 *      			*/if(Trigger.isInsert){/*
 *						*/c.ElapsedTime__c=0;/*
 *						*/c.First_Contact_Resolution__c=True;/*
 *    					*/c.First_Solve_DateTime__c=now;/*
 *					*/}/*	  
 *				*/}else{c.First_Contact_Resolution__c=False;}/*
 *	 	 	*/}/*
 *		*/}/*
 *	*/}/*

 
In the service cloud, I am trying to set up a trigger.

The trigger is on emailMessage. When a consultant sends a second email to a customer, I want to create a new case with all of the same field values as the original case,except for id, and attach the trigger email to that new case. 
Currently, I'm having major trouble with the SOQL query that does this.
 
...
for(EmailMessage e:Trigger.new){
 if(e.Incoming==false){//Email must be outgoing
    string expr='[SELECT ';
    Map<String, String> labelMap = new Map<String, String>();
    Schema.DescribeSObjectResult objectDescribe  = Case.SObjectType.getDescribe();
    Map<String, Schema.SObjectField>fieldMap = objectDescribe.fields.getMap();
   	for(String fieldName:fieldMap.keySet()) {
      		Schema.SObjectField field=fieldMap.get(fieldName);
        	Schema.DescribeFieldResult fieldDescribe=field.getDescribe();      		labelMap.put(fieldDescribe.getLabel(),fieldDescribe.getName());
    		expr+=fieldDescribe.getName()+',';
    		}
    	expr=expr.substring(0,expr.length()-1)+
               ' FROM case WHERE id=:e.parentId]';
    	System.Debug(expr);
        System.Debug(e.ParentId);
        System.Debug('size'+expr.length());
        List<case>myCases=[SELECT expr FROM case WHERE id=:e.ParentId LIMIT 1];

 

I have a visualforce page to be used by customer service consultants. 

Currently, the visualforce page pseudo-dynamically renders inputfield choices through a series of if/then statements that change each field's "renderVariable" to true or false.

So, user picks 'A' from picklist one. Fields A1,A2,A3 appear for input.

Then, user picks 'B' from picklist two. Fields B1,B2 appear for input.

Is there a better way to do this?

The main problem I have is that multiple selections cause multiple fields to render in the order they were entered rather than added to the bottom of the list. Is there a way to make the inputfields append what's already rendered?

<apex:inputField value="{!case.Status}">
  <apex:actionSupport event="onchange" action="{!Evaluate}" rerender="RequiredFields"/>
</apex:inputField>

<apex:pageBlockSection title="Required Fields" id="RequiredFields">
  <apex:inputField value="{!Case.Transaction_Number__c}" label="Transaction Number" rendered="{!if(TransactionNumber==true,true,false)}"/>

----------------------------------------------
public class FieldManager{  
  public case myCase {get;set;}
  public boolean TransactionNumber {get;set;}

  public ShowFieldManager(){
        string PageId=ApexPages.currentPage().getParameters().get('id');
        myCase=[SELECT id FROM case WHERE id=:PageId];        
        
        Evaluate();            
    }

public pagereference Falsify(){TransactionNumber=false;return null;}

public pagereference Evaluate(){
    Falsify();
     if(myCase.status=='Waiting for Transaction Number') TransactionNumber=true;
    return null.
    }
}

I have a visualforce page to be used by customer service consultants. 

Currently, the visualforce page pseudo-dynamically renders inputfield choices through a series of if/then statements that change each field's "renderVariable" to true or false.

So, user picks 'A' from picklist one. Fields A1,A2,A3 appear for input.

Then, user picks 'B' from picklist two. Fields B1,B2 appear for input.

Is there a better way to do this?

The main problem I have is that multiple selections cause multiple fields to render in the order they were entered rather than added to the bottom of the list. Is there a way to make the inputfields append what's already rendered?

<apex:inputField value="{!case.Status}">
  <apex:actionSupport event="onchange" action="{!Evaluate}" rerender="RequiredFields"/>
</apex:inputField>

<apex:pageBlockSection title="Required Fields" id="RequiredFields">
  <apex:inputField value="{!Case.Transaction_Number__c}" label="Transaction Number" rendered="{!if(TransactionNumber==true,true,false)}"/>

----------------------------------------------
public class FieldManager{  
  public case myCase {get;set;}
  public boolean TransactionNumber {get;set;}

  public ShowFieldManager(){
        string PageId=ApexPages.currentPage().getParameters().get('id');
        myCase=[SELECT id FROM case WHERE id=:PageId];        
        
        Evaluate();            
    }

public pagereference Falsify(){TransactionNumber=false;return null;}

public pagereference Evaluate(){
    Falsify();
     if(myCase.status=='Waiting for Transaction Number') TransactionNumber=true;
    return null.
    }
}
*/trigger FirstContactResolution on Case(before insert,before update){/*
/*	*/for(case c:Trigger.New){//Trigger.New grabs updated information/* 
/*    	*/dateTime now=System.Now();//Assess current time to be used throughout this trigger/*
/*//Phone/Chat-First Contact Resolution Logic/*
* 		*/if(c!=null){
/*			*/if((c.Origin.contains('Phone')||c.Origin.contains('Chat'))&&(!c.Origin.contains('CP')))/*
 *			*/{/*
 *				*/if(c.Status=='Solved'){/*
 *	    			*/if(Trigger.isUpdate){/*
 *						*/c.ElapsedTime__c=/*
 * 	   					*/(Double.valueOf(now.getTime())-Double.valueOf(c.createddate.getTime()))/1000/60;/*
 * 	   					//Current datetime minus createdDate, convert to minute format from milliseconds
 * 	   					*/if(c.ElapsedTime__c<61){/*
 *      	    			*/c.First_Contact_Resolution__c=True;/*
 *          	    		*/c.First_Solve_DateTime__c=now;/*
 *          			*/}else{c.First_Contact_Resolution__c=False;}/*
 *					*/}/*                                                            
 *      			*/if(Trigger.isInsert){/*
 *						*/c.ElapsedTime__c=0;/*
 *						*/c.First_Contact_Resolution__c=True;/*
 *    					*/c.First_Solve_DateTime__c=now;/*
 *					*/}/*	  
 *				*/}else{c.First_Contact_Resolution__c=False;}/*
 *	 	 	*/}/*
 *		*/}/*
 *	*/}/*

 
I'd like to start working with the macros in the Service Cloud Console, but each help article begins with "Click the Macros widget in the bottom right of your screen." Yet, I don't see it. I'm a Sys Admin, so I have read/edit access to the macros object. Any ideas?