• djamouha
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi guys,
I am having a trouble with the addError method. In fact I have done a litte code that block any user of our org from sending private message using Chatter. That looks like this : 
public static void insertNewChatterMessage(List<ChatterMessage> listeChatterMessages){
    	for(ChatterMessage c : listeChatterMessages){
    		
    		System.debug('chat mess : '+c);    		
    		c.Body.addError('Private Messages are not allowed');	
    	}
}

This parts works pretty well as it returns on GUI the custom message and prevent sending the message.
The issue comes in the Test Class. 
I am just doing something as simple as that : 
@isTest(SeeAllData=true)
    static void testChatterMessageBeforeInsert(){
    		Test.startTest();
           
    		try{
                ConnectApi.ChatterMessages.sendMessage('Test chatter message', String.valueOf(userReceivingChatterMessage.Id));
                throw new MyChatterException('Private Messages are not allowed');
            }
            catch(DmlException e){
                system.debug('###Mess : '+e.getMessage());
                system.assert(e.getMessage().contains('Private Messages are not allowed'));
            }
            catch(MyChatterException f){
                system.debug('###Mess : '+f.getMessage());
                system.assert(!f.getMessage().contains('Private Messages are not allowed'));
            }

But I always get this error when running the test : "Validation Errors While Saving Record(s)"

Any idea of where I am doing bad.

Regards

Hi everyone,

 

I am a little new in salesforce developpement and I would like to know  if it is possible to customize live agent chat window as it doesn't appear like a popup but as a customized widget. I would like to have something like the window chat of facebook. Someone to help ?

 

Thanks for any informaton :)

 

djamouha

Hi guys,
I am having a trouble with the addError method. In fact I have done a litte code that block any user of our org from sending private message using Chatter. That looks like this : 
public static void insertNewChatterMessage(List<ChatterMessage> listeChatterMessages){
    	for(ChatterMessage c : listeChatterMessages){
    		
    		System.debug('chat mess : '+c);    		
    		c.Body.addError('Private Messages are not allowed');	
    	}
}

This parts works pretty well as it returns on GUI the custom message and prevent sending the message.
The issue comes in the Test Class. 
I am just doing something as simple as that : 
@isTest(SeeAllData=true)
    static void testChatterMessageBeforeInsert(){
    		Test.startTest();
           
    		try{
                ConnectApi.ChatterMessages.sendMessage('Test chatter message', String.valueOf(userReceivingChatterMessage.Id));
                throw new MyChatterException('Private Messages are not allowed');
            }
            catch(DmlException e){
                system.debug('###Mess : '+e.getMessage());
                system.assert(e.getMessage().contains('Private Messages are not allowed'));
            }
            catch(MyChatterException f){
                system.debug('###Mess : '+f.getMessage());
                system.assert(!f.getMessage().contains('Private Messages are not allowed'));
            }

But I always get this error when running the test : "Validation Errors While Saving Record(s)"

Any idea of where I am doing bad.

Regards

Hi,

 

i am using Salesforce native Live Agent feature. My requirement is to load the live agen ton a form and let user fill the form. When the user clicks on chat the live agent should launch and the filled form details should be send to live agent.

 

I have tried to send the soem dummy data to live agent and I am succesful in doing so as I use "addCustomDetail" before the init in teh page loads itself. however when ever I try to do it thorugh a function call ie when  the user clicks on the live agent button i call afn which has the "addCustomDetail" and init method i get a pop up blocker from the browser.

 

Can anyone suggest me a way of dymanically picking data from form without running into pops.

 

Appreciate the help.

 

Thanks,

Sachin