• MUSFAR KT 6
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
how to use fieldset in lightning component for creation of  form edit and view in the account object
public class UpdateOTP{
    public static void saveData(String email) {
        List<Account> accsToUpdate = new List<Account>();
       for ( Account a : [SELECT Id,OTP__c,Email__c  from Account WHERE Email__c =:email]) {
            if(a.OTP__c == null) {             
                Integer len = 5;
                Blob blobKey = crypto.generateAesKey(128);
                String key = EncodingUtil.convertToHex(blobKey);
                String pwd = key.substring(0,len);
                System.debug('OTP**** '+pwd); 
                     a.OTP__c = pwd;               
                    }
           
             accsToUpdate.add(a);
            update accsToUpdate;
                  
        }
       
    }
    }
trigger Update_city_Acc on Account (after update) {
    set<id> ids=new set<id>();
    for(account a :trigger.new){
        
        if(a.city__c!=trigger.oldmap.get(a.id).city__c){
            ids.add(a.id);
            
        }
    }
List<opportunity>opp=[select id,City__c,Accountid from opportunity where accountid IN:ids];
    for(opportunity op:opp){
        op.City__c=trigger.newmap.get(op.accountid).city__c;
    }
    
}

unit test time its not working.
trigger Prefix_Dr on Lead (before insert,before update) {
    for(lead L:trigger.new){
       L.FirstName='Dr.'+L.FirstName;
        }
}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@istest
public class Prefix_Dr_test {
    testmethod static void test(){
        Lead L=New Lead();
        L.FirstName='Dr.Midul';
        L.LastName='ahmed';
        L.Company='sfdc';
        L.Status='Working-contacted'; 
        insert L;
        
        Lead Le=[select Id,firstname,lastname from lead where company='sfdc'];
       System.assertEquals(Le.FirstName.ContainsIgnoreCase('Dr.'),'Dr.');
           
    }


here test class is showing error
how to use fieldset in lightning component for creation of  form edit and view in the account object
trigger Prefix_Dr on Lead (before insert,before update) {
    for(lead L:trigger.new){
       L.FirstName='Dr.'+L.FirstName;
        }
}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@istest
public class Prefix_Dr_test {
    testmethod static void test(){
        Lead L=New Lead();
        L.FirstName='Dr.Midul';
        L.LastName='ahmed';
        L.Company='sfdc';
        L.Status='Working-contacted'; 
        insert L;
        
        Lead Le=[select Id,firstname,lastname from lead where company='sfdc'];
       System.assertEquals(Le.FirstName.ContainsIgnoreCase('Dr.'),'Dr.');
           
    }


here test class is showing error
​I keep getting

Challenge Not yet complete... here's what's wrong: 
The 'Top Laptop Industry' lens was not found. Please follow the requirements and ensure everything is setup correctly


I have named the Lens as step 2 - Enter D01 - Laptops Salespeople - Wall of Fame as the title AND/OR result set Top Laptop Industry

Neither seem to work. I have refresed the screen, even cleared cookies and rebooted the computer. 

Hi everyone,

 

I just started using couple months ago and now have just started exploring triggers.

I am looking to create new lead records after case has been closed if it fulfills certain criterias.

Hope someone could help me out here; details are as below.

 

To create new Lead record when from Case object:-

 

Status=Closed

and

Receive_survey_form_future_promotions__c=True

and

(E_mail_c or SuppliedEmail)!=null

 

The Lead record field name mapping for insertion are as follows:-

From Case object ==> To Lead object

Name_c or SuppliedName ==> LastName

E_mail_c or SuppliedEmail ==> Email

Contact_Number__c ==> MobilePhone

 

Lead status will always be New.

Lastly, the lead will only be created if a search based on the email from (E_mail_c or SuppliedEmail) isn't existant in any Lead records.

 

Hope to hear from someone and thanks in advance.

 

P.S. Just wondering, can an email message be triggered to a particular default email if the Lead record isn't created due to its existance in Lead already?

 

Regards,

Ravin

  • February 21, 2012
  • Like
  • 0