• IFTHIKAR AHMED 7
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
Trigger : 
trigger CreatePenForStudent on Studentt__c (after insert) {    
       PenForStudent.CreatePen(Trigger.new);
}

Apex: 
public class PenForStudent {
    
    Public Static Void CreatePen (List<Studentt__c> StudentList)
        
    {
        List<Parker__c> NewPen = new List<Parker__c> ();
        
        for(Studentt__c OneStudent : StudentList )
        {
           
           
              Parker__c PenRecord = new Parker__c ();
              PenRecord.Name = OneStudent.Name;
              PenRecord.OwnerId = OneStudent.OwnerId;
              NewPen.add(PenRecord);
           
        }
        
        insert NewPen;
    }

}

getting error for triger : Method does not exist or incorrect signature: void CreatePen(List<Studentt__c>) from the type PenForStudent

pls help me figure out where i am going wrong
 
Hi getting error when trying to delete a recourd wher record owner != logged in user below is my code 

trigger MobDiscount on Mobile__c (before insert,before update,before delete) {
Trigger :     
    if(Trigger.isinsert == true)
    {
        DiscountForMobiles.DiscountNewCoustomer(Trigger.new);
    }
    
    if(Trigger.isupdate == true)
    {
        DiscountForMobiles.DiscountOldCoustomer(Trigger.new);
    }
    
    if(Trigger.isdelete == true && Trigger.isbefore == true)
    {
        DiscountForMobiles.OwnwerAloneCanDelete(Trigger.old);
    }
    
}

Apex Class :

public class DiscountForMobiles {
    
    Public Static Void DiscountNewCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '10 % Discount';
            }
            
            if(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
        }
        
    }

    Public Static Void DiscountOldCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = 'NO Discount';
            }
            
        }
        
    }
    Public Static Void OwnwerAloneCanDelete(List<Mobile__c> CoustomerList)
    {
        
        for(Mobile__c Costomer : CoustomerList)
        {
            If(Costomer.OwnerId != Userinfo.getUserId())
            {
                Costomer.adderror('only owner can delete');
            }
        }
         
    }
      
}
Hi getting below error for the trigger,

Trigger :

trigger MobDiscount on Mobile__c (before insert,before update,before delete) {
    
    if(Trigger.isinsert == true)
    {
        DiscountForMobiles.DiscountNewCoustomer(Trigger.new);
    }
    
    if(Trigger.isupdate == true)
    {
        DiscountForMobiles.DiscountOldCoustomer(Trigger.new);
    }
    
    if(Trigger.isdelete == true && Trigger.isbefore == true)
    {
        DiscountForMobiles.OwnwerAloneCanDelete(Trigger.new);
    }
    
}

Apex class :

public class DiscountForMobiles {
    
    Public Static Void DiscountNewCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '10 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
        }
        
    }

    Public Static Void DiscountOldCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = 'NO Discount';
            }
            
        }
        
    }
    Public Static Void OwnwerAloneCanDelete(List<Mobile__c> CoustomerList)
    {
        
        for(Mobile__c Costomer : CoustomerList)
        {
            If(Costomer.OwnerId != Userinfo.getUserId())
            {
                Costomer.adderror('only owner can delete');
            }
        }
         
    }
      
}

i am trying to delete from the records owner account only.

Pls help
HI All,

1.I am new to salesforce. i created a user and logged in to his account, the UI is of classic experiance . how can i change that to lightning

2.also from my admin account i hve created some tabs and those tabs are not available for the user , even while trying to add those from the add tab option those tab are not listed pls help
app created in classic is not available in lightning experience why ?
HI
while I am trying to do the assignment related to report and dashboard. i am facing a problem and not able to figure it out.

facing error while adding joint report to the dashboard "even though i select the same chart type in the dashboard"

Please find the attachment for the screenshot

User-added image

User-added imageUser-added image
Hi getting error when trying to delete a recourd wher record owner != logged in user below is my code 

trigger MobDiscount on Mobile__c (before insert,before update,before delete) {
Trigger :     
    if(Trigger.isinsert == true)
    {
        DiscountForMobiles.DiscountNewCoustomer(Trigger.new);
    }
    
    if(Trigger.isupdate == true)
    {
        DiscountForMobiles.DiscountOldCoustomer(Trigger.new);
    }
    
    if(Trigger.isdelete == true && Trigger.isbefore == true)
    {
        DiscountForMobiles.OwnwerAloneCanDelete(Trigger.old);
    }
    
}

Apex Class :

public class DiscountForMobiles {
    
    Public Static Void DiscountNewCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '10 % Discount';
            }
            
            if(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
        }
        
    }

    Public Static Void DiscountOldCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = 'NO Discount';
            }
            
        }
        
    }
    Public Static Void OwnwerAloneCanDelete(List<Mobile__c> CoustomerList)
    {
        
        for(Mobile__c Costomer : CoustomerList)
        {
            If(Costomer.OwnerId != Userinfo.getUserId())
            {
                Costomer.adderror('only owner can delete');
            }
        }
         
    }
      
}
Hi getting below error for the trigger,

Trigger :

trigger MobDiscount on Mobile__c (before insert,before update,before delete) {
    
    if(Trigger.isinsert == true)
    {
        DiscountForMobiles.DiscountNewCoustomer(Trigger.new);
    }
    
    if(Trigger.isupdate == true)
    {
        DiscountForMobiles.DiscountOldCoustomer(Trigger.new);
    }
    
    if(Trigger.isdelete == true && Trigger.isbefore == true)
    {
        DiscountForMobiles.OwnwerAloneCanDelete(Trigger.new);
    }
    
}

Apex class :

public class DiscountForMobiles {
    
    Public Static Void DiscountNewCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '10 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
        }
        
    }

    Public Static Void DiscountOldCoustomer(List<Mobile__c> CoustomerList)
    {
        for(Mobile__c SingleCoustomer : CoustomerList ){
            
            If(SingleCoustomer.Brand__c == 'Samsung')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c - SingleCoustomer.Price__c * 10/100;
               SingleCoustomer.Discount_Status__c = '5 % Discount';
            }
            
            If(SingleCoustomer.Brand__c == 'Apple')
            {
                
               SingleCoustomer.Price__c = SingleCoustomer.Price__c * 5/100;
               SingleCoustomer.Discount_Status__c = 'NO Discount';
            }
            
        }
        
    }
    Public Static Void OwnwerAloneCanDelete(List<Mobile__c> CoustomerList)
    {
        
        for(Mobile__c Costomer : CoustomerList)
        {
            If(Costomer.OwnerId != Userinfo.getUserId())
            {
                Costomer.adderror('only owner can delete');
            }
        }
         
    }
      
}

i am trying to delete from the records owner account only.

Pls help
HI All,

1.I am new to salesforce. i created a user and logged in to his account, the UI is of classic experiance . how can i change that to lightning

2.also from my admin account i hve created some tabs and those tabs are not available for the user , even while trying to add those from the add tab option those tab are not listed pls help