• Brend
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
I created a checkbox field ‘subscribe__c’ on account object that I want to be updated
base on subscription charge names annual, monthly, quarterly on another object called subscription and charges
  • October 24, 2018
  • Like
  • 0
This code works for my requirement but I need test class please.


trigger NoDeleteonTask on Task (before delete)
{
   String ProfileId = UserInfo.getProfileId(); 
   List<Profile> profiles=[select id from Profile where name='Profile 1' or name='Profile 2'];
 
   if (2!=profiles.size())
   {
      // unable to get the profiles - handle error
   }
   else
   {
       for (Task a : Trigger.old)     
       {           
          if ( (profileId==profiles[0].id) || (profileId==profiles[1].id) )
          {
             a.addError('You can't delete this record');
          }
       }           
   }
}
  • August 30, 2018
  • Like
  • 0
Trigger is working for all profiles instead of only this profile id. Please how do I correct this

trigger accountdelet on Acount (before delete)
 {
String ProfileId = UserInfo.getProfileId(); 
for (Account a : Trigger.old)     
           
IF(ProfileId!='00721100046VB5L')
{
     a.addError('Not permitted');
    
            }
        }
  • August 30, 2018
  • Like
  • 0

Getting the hour from Date/Time field
My present Date/time field is giving me an hour earlier. Example instead of 6.00pm it will show 7.00pm this is in CST. I guess this is due to the time change. Please I need an update on this formula.

Text(CASE(VALUE(MID(TEXT( evt__Event__r.evt__End__c ) , 12, 2)) , 0, 7, 1, 8, 2, 9,3, 10,4, 11,5, 12,6, 1,7, 2,8, 3,9, 4,10, 5,11, 6,12, 7,13, 8,14,9,15, 10,16, 11,17, 12,18, 1,19, 2,20, 3,21, 4,22, 5,23, 6, 24))  

& ":" & MID(TEXT( evt__Event__r.evt__End__c ) , 15, 2)   

& IF(AND(VALUE(MID(TEXT( evt__Event__r.evt__End__c ) , 12, 2)) >= 5, VALUE(MID(TEXT( evt__Event__r.evt__End__c ) , 12, 2)) <= 16), " AM", " PM")
  • November 08, 2017
  • Like
  • 0
I created a checkbox field ‘subscribe__c’ on account object that I want to be updated
base on subscription charge names annual, monthly, quarterly on another object called subscription and charges
  • October 24, 2018
  • Like
  • 0
This code works for my requirement but I need test class please.


trigger NoDeleteonTask on Task (before delete)
{
   String ProfileId = UserInfo.getProfileId(); 
   List<Profile> profiles=[select id from Profile where name='Profile 1' or name='Profile 2'];
 
   if (2!=profiles.size())
   {
      // unable to get the profiles - handle error
   }
   else
   {
       for (Task a : Trigger.old)     
       {           
          if ( (profileId==profiles[0].id) || (profileId==profiles[1].id) )
          {
             a.addError('You can't delete this record');
          }
       }           
   }
}
  • August 30, 2018
  • Like
  • 0
Trigger is working for all profiles instead of only this profile id. Please how do I correct this

trigger accountdelet on Acount (before delete)
 {
String ProfileId = UserInfo.getProfileId(); 
for (Account a : Trigger.old)     
           
IF(ProfileId!='00721100046VB5L')
{
     a.addError('Not permitted');
    
            }
        }
  • August 30, 2018
  • Like
  • 0