• Anil Kumar 1257
  • NEWBIE
  • 0 Points
  • Member since 2020
  • Developer
  • Vserv Capital services

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 1
    Replies
Users are only allowed to edit car records on weekdays
I am write this trigger. i need test class, how to write.

trigger ContactDuplicatemobile on Contact (before insert, before update) {


List<Contact> Contactlist = [select id,MobilePhone from Contact];


for(Contact c:Trigger.new)

{

for(Contact cc: Contactlist)

{


if(c.MobilePhone==cc.MobilePhone)

{

c.adderror('mobile number already exist');

}

} }

}
 I CREATE NEW PLAYGROUND  BUT THEY GIVE ERROR
User-added image
i want to create report still i am not serch field Which filed requred ,they dont show please tell me step step  how to create
global class Kit19SMS  {
    global String sendMessage(List<String> numbers, String message){
        
        system.debug('sent sms done');
        
        String num = String.join(numbers,','); 
        String user;
        String pass;
        String send;
        
        API_Credentials__mdt[] logcredentials = [Select id,Username__c,password__c,senderId__c FROM API_Credentials__mdt WHERE developername = 'Kit19' LIMIT 1];
        for(API_Credentials__mdt login:logcredentials){
            
            user = login.Username__c;
            pass = login.password__c;
            send = login.senderId__c;  
        }
        
        system.debug('user=='+user);
         system.debug('pass=='+pass);
         system.debug('send=='+send);
        
        HttpRequest req = new HttpRequest();
        req.setHeader('Content-Length', '0');
        req.setEndpoint('https://www.kit19.com/ComposeSMS.aspx?username='+ user +'&password='+ pass +'&sender='+ send +'&to=' + num + 
                        '&message=' + EncodingUtil.URLENCODE(message,'UTF-8')  + '&priority=1&dnd=1&unicode=0');
        req.setMethod('POST');
        system.debug('EndPoint========'+req);
        system.debug('Sent========');
        Http http = new Http();
        //if (test.isRunningTest()) Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
        
        try{
            HTTPResponse res = http.send(req);
            system.debug('response' + res);
        }
        catch(Exception e){
            system.debug('Exception e' + e);
        }
        return null;
    }
    global String sendPersonalizedMessage(String numbers, Id templateId){
        return null;
    }
}
AND(
ISPICKVAL(  Status__c  ,"Document Callected"),
OR(ISBLANK( PAN__c ),
AND(ISBLANK( Aadhar__c ),ISBLANK( Cheque_Passbook__c ))),
OR(
RecordType.DeveloperName = 'Documents Collected',
trigger updatestageoncontact on Interview__c(after insert, after update){
 list<Id> contIds = new list<Id>();
 list<Contact> Contacts = new list<Contact>();
 for(Interview__c inte:trigger.new){
  contIds.add(inte.Candidate__c);
 }
 for(contact con:[select Id, Stage__c from contact where Id IN :contIds]){
  for(Interview__c inter:trigger.new){
   if(inter.Status__c=='Scheduled'){
    con.Stage__c='Interview Scheduled';
    Contacts.add(con);
   }
  }
 }
    update contacts;
}


How to write test class this trigger

I am trying to insert an image onto my VF page.

 

here is what i have:

 

<IMG src="C:\Documents and Settings\*****\My Documents\My Pictures\test.gif" ALT= "alternate_text" />

 

i also tried

 

<IMG src="test.gif" ALT= "alternate_text" />

 

both ways i ended up with the same result, the image didnt display, the image box only displayed the alternate text. please help thanks.