• Rajat Bhatt 4
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Hi,
I am new to Salesforce and i facing problem in making a test class for this trigger.
Any help would be appreciated.
Thanks in advance

trigger PreventContactDeletion on Contact (before delete) {

    Id id1 = userinfo.getProfileId();
    
    String  profileName = [select name from profile where id=:id1].Name;   
        
    for(Contact con : Trigger.old)
    {
        if(profileName =='Sales' & con.Contact_Type__c=='Billing')
        {
            con.addError('Contact with type Billing cannot be deleted');
        }
    }

}
Hi,
I am new to salesforce and i am facing an issue my Trigger is not working properly.
I want the trigger to check whether the all Shipping Address field is filled or not , and if not the display the error message.
Any help will be appreciated.
Thanks.
trigger shippingAddress on Account (before insert,before update)
{

    List<Account> accList=new List<Account>();
    
    for(account accObject:trigger.new)
    {
        if(accObject.ShippingStreet !=null && accObject.ShippingCity!=null &&
           accObject.ShippingState!=null && accObject.ShippingPostalCode!=null && 
           accObject.ShippingCountry!=null)
        {
           accList.add(accObject);
        
        }
        
        else
        {
        
            accObject.addError('All Shipping Fields are required');
            
        }

    }
    
    insert accList;
}

 
Hi, I am new to salesforce and i am facing a problem in retrieving an account name.
I have a String which contains the account id , and i want to fetch the account name  using SOQL so that i can store it in the field?

Thanks in advance.
Hi, I am new to salesforce i am finding difficulty in writing trigger.
I have 2 fields named 'Claim' on Account and Contract Object. Account is the parent record(Lookup Relationship).
How to automatically update the claim field of Account object with the Contract claim field using trigger.
Thanks in advance.
Hi,
I am new to Salesforce and i facing problem in making a test class for this trigger.
Any help would be appreciated.
Thanks in advance

trigger PreventContactDeletion on Contact (before delete) {

    Id id1 = userinfo.getProfileId();
    
    String  profileName = [select name from profile where id=:id1].Name;   
        
    for(Contact con : Trigger.old)
    {
        if(profileName =='Sales' & con.Contact_Type__c=='Billing')
        {
            con.addError('Contact with type Billing cannot be deleted');
        }
    }

}
Hi,
I am new to salesforce and i am facing an issue my Trigger is not working properly.
I want the trigger to check whether the all Shipping Address field is filled or not , and if not the display the error message.
Any help will be appreciated.
Thanks.
trigger shippingAddress on Account (before insert,before update)
{

    List<Account> accList=new List<Account>();
    
    for(account accObject:trigger.new)
    {
        if(accObject.ShippingStreet !=null && accObject.ShippingCity!=null &&
           accObject.ShippingState!=null && accObject.ShippingPostalCode!=null && 
           accObject.ShippingCountry!=null)
        {
           accList.add(accObject);
        
        }
        
        else
        {
        
            accObject.addError('All Shipping Fields are required');
            
        }

    }
    
    insert accList;
}

 
Hi, I am new to salesforce and i am facing a problem in retrieving an account name.
I have a String which contains the account id , and i want to fetch the account name  using SOQL so that i can store it in the field?

Thanks in advance.
Hi, I am new to salesforce i am finding difficulty in writing trigger.
I have 2 fields named 'Claim' on Account and Contract Object. Account is the parent record(Lookup Relationship).
How to automatically update the claim field of Account object with the Contract claim field using trigger.
Thanks in advance.