• sfdc development hints
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 9
    Replies

i have a command link called as delete in my vf page , for which i need to have the delete link visible only for system admin and not for other users, how do i restrict that

 

 

Hi,

 

 I have a field called as status in the case object and another field called as substatus(dependent field of status) in my case object, so whenever i assigned the status field to following values such as "Assigned","In Progress" , and "Reopened" , the value of sub status changes to "Pending" for which the following field

 

"UAT Release clock" shoulkd be updated to 1 , if the value of sub status remains same as "Pending" with a period gap of 1 day, if the status is changed to other values apart fom those 3 values then the value of the field "UAT Release clock " should remain 0 ,

 

i tried implementing these logic using a workflow , which was working on the same day , but since my requirenment depends that the change with a period of 8 hours , i need to write a scheduler class for implementing this logic, can anyone help me out with this please...

 can anyone plz tell me  the apex code  to move a CSV file from local machine to an FTP location in Salesforce.......

i , can anyone help me writing a test class for below class

 

 

global class my_case_extensions
 {   
    webservice static void closedcase(ID CaseId)
    {
        List<Case> list_Case = [Select Id,Status from Case where Id=: CaseId];
        
        if(!list_Case.isEmpty())
        {
            list_Case[0].Status = 'Closed';
            update list_Case;
        }
    }
   
}

global class ClsTargetedCalls_ExecuteBatch implements Schedulable
{
   global void execute(SchedulableContext sc) 
   {
        System.debug('Before Execution');
        ClsTargetedCalls objclsTargetedCalls = new ClsTargetedCalls(); 
        System.debug('After Execution');
        database.executebatch(objclsTargetedCalls);       
        
   }
}

sfdc development hints
Posts: 15
 

How to give break statements in a pdf file, for eg

 

antonymichaelcook, i want these names to be displayed as

 

 

antonymichael

cook

 

i tried using nbsp , but still isint working, can anyone please help me out with this...

 

 

below one is my code,

 

i am using thid code
<style type="text/css">
@page {
    margin : 70pt .5in .5in .5in;
    @top-center {
        content :element(header);
        font-size : 10 px;
        color : #808080;
        width : 50 px;
     }
     div.header {
    position : running(header) ;
             }


    @bottom-right
         {
            content: "Page: " counter(page) " of " counter(pages);

            color : #808080;
         }

    @bottom-left {
        content :"Equity Marketing";



        font-size : 10 px;
        color : #808080;
    }

}
</style>
</head>




How to give break statements in a pdf file, for eg

 

antonymichaelcook, i want these names to be displayed as

 

 

antonymichael

cook

 

i tried using nbsp , but still isint working, can anyone please help me out with this...

2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   



2.2.Impacts to Call Visit                           
    The Call Activity object will be added with a new formula field called Channel            
    The formula of this field is based on the value of the Account object's Channel field with a look up on the Account 
    Example, if the Account has a Channel = Doctor then the corre3sponding Call Activity will have the value of Doctor 



 2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   
                                 



I am trying to write a test class for the trigger below as follows,

//Trigger on "enrollpeople" object which allows the field "Booked slots" to be incremented as the "EnrollPeople"is added and also verifying that "Booked slots" should not be greater than "Totalslots" //



trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);
for(Enroll_Candidate__c candidates:coursedetails)
{

Course_Details__c coursess = new Course_Details__c();
coursess = coursedetailsforcandidates.get(candidates.Course_Details__c);


if(coursess.Total_Slots__c >= coursess .Enroll_Candidates__r .size())
      coursess.Booked_Slots__c=coursess .Enroll_Candidates__r .size();
else
        candidates.addError('Booked seats should not exceed Total seats');
}


update coursedetailsforcandidates.values();
}

i have also written the test class as'
@isTest
public class EnrollCandidateTests
 {
 static testMethod void test()
 {

Enroll_Candidate__c ec = new Enroll_Candidate__c(Name ='Test');

insert ec;
}
}
but i am getting an error message "
  
ErrorError: Compile Error: Field is not writeable: Enroll_Candidate__c.Name at line 7 column 55
"because no such field exists also the object has only lookup relationship with other objects, could you plese help m e out with this issue





//Trigger on "enrollpeople" object which allows the field "Booked slots" to be incremented as the "EnrollPeople"is added and also verifying that "Booked slots" should not be greater than "Totalslots" //



trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);
for(Enroll_Candidate__c candidates:coursedetails)
{

Course_Details__c coursess = new Course_Details__c();
coursess = coursedetailsforcandidates.get(candidates.Course_Details__c);


if(coursess.Total_Slots__c >= coursess .Enroll_Candidates__r .size())
      coursess.Booked_Slots__c=coursess .Enroll_Candidates__r .size();
else
        candidates.addError('Booked seats should not exceed Total seats');
}


update coursedetailsforcandidates.values();
}

trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Set<ID> enrollIds= new Set<ID>();
Boolean setError=false;
Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);

for(Enroll_Candidate__c candidates:[Select Id , Course_Details__c FROM Enroll_Candidate__c where  Course_Details__c in:coursedetailsforcandidates.keyset()])
enrollIds.add(candidates.ID);

for(Course_Details__c courses :coursedetailsforcandidates.values())
{
System.debug('The total seats in the map is :' + courses.Total_Slots__c + ' the ids populated is : ' + enrollIds.size());
if(courses.Total_Slots__c >= enrollIds.size())
    courses.Booked_Slots__c=enrollIds.size();
else
    setError = true;
}

if(setError)
     Trigger.new[0].addError('Booked seats should not be the same as the Total seats!!');
    
update coursedetailsforcandidates.values();
}

Hi , i need to write a trigger on a object called "enroll candidate" which is associated with candidate object and course detail object , where course detail object is a child object of course object, my req is there is a field called as booked slot and totalslot , when total slot is entered, booked slot is calculated automatically , i need to inactivate or stop the condition where bookslot  and automate the field bookslot when it is equal to totalslot and also booked slot should be incremented by ++ through a bulk trigger . can anyone please help me with this ....

trigger ContactSumTriggermodified on Contact (after  delete, after  insert, after update,after undelete)
 {
 
   
     Set<ID>conIds= new Set<ID>();
    
    
    Contact[] cons;
    if (Trigger.isDelete)
        cons = Trigger.old;
    else
        cons = Trigger.new;

    Set<ID> acctIds = new Set<ID>();
    for (Contact con : cons)
    {
            acctIds.add(con.AccountId);
    }
  
  

Map<ID, Account> acctsToUpdate = new Map<ID, Account>([Select Id,Total_no_of_contacts__c ,(Select Id,AccountId from Contacts where AccountId in :acctIds)from Account where Id in :acctIds]);


 
  
  for(Contact con:[Select Id , AccountId from Contact where AccountId in:acctstoupdate.keyset()])
        conIds.add(con.id);
       
    for(Account acct:acctstoupdate.values())      
  {
  
   
 
  if (acct.Total_no_of_contacts__c != conIds.size())
            acct.Total_no_of_contacts__c = conIds.size();                 
  }         
  update acctsToUpdate.values();
                                           
 }

Hi,

 

 I have a field called as status in the case object and another field called as substatus(dependent field of status) in my case object, so whenever i assigned the status field to following values such as "Assigned","In Progress" , and "Reopened" , the value of sub status changes to "Pending" for which the following field

 

"UAT Release clock" shoulkd be updated to 1 , if the value of sub status remains same as "Pending" with a period gap of 1 day, if the status is changed to other values apart fom those 3 values then the value of the field "UAT Release clock " should remain 0 ,

 

i tried implementing these logic using a workflow , which was working on the same day , but since my requirenment depends that the change with a period of 8 hours , i need to write a scheduler class for implementing this logic, can anyone help me out with this please...

i , can anyone help me writing a test class for below class

 

 

global class my_case_extensions
 {   
    webservice static void closedcase(ID CaseId)
    {
        List<Case> list_Case = [Select Id,Status from Case where Id=: CaseId];
        
        if(!list_Case.isEmpty())
        {
            list_Case[0].Status = 'Closed';
            update list_Case;
        }
    }
   
}

How to give break statements in a pdf file, for eg

 

antonymichaelcook, i want these names to be displayed as

 

 

antonymichael

cook

 

i tried using nbsp , but still isint working, can anyone please help me out with this...

2.2.Impacts to Call Visit                           
    The Call Activity object will be added with a new formula field called Channel            
    The formula of this field is based on the value of the Account object's Channel field with a look up on the Account 
    Example, if the Account has a Channel = Doctor then the corre3sponding Call Activity will have the value of Doctor 



 2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   
                                 



trigger enrollcandidatetrigger on Enroll_Candidate__c(after delete, after insert, after update,after undelete)
{

Set<ID> enrollIds= new Set<ID>();
Boolean setError=false;
Enroll_Candidate__c[] coursedetails;
if(Trigger.IsDelete)
coursedetails=Trigger.old;

else
coursedetails=Trigger.new;

Set<ID> CourseId= new set<ID>();

for(Enroll_Candidate__c candidates:coursedetails)
{
CourseId.add(candidates.Course_Details__c);
}

Map<ID,Course_Details__c> coursedetailsforcandidates=new Map<ID,Course_Details__c>([Select Id, Booked_Slots__c, Total_Slots__c, (Select Id from Enroll_Candidates__r ) from Course_Details__c where Id in:CourseId]);

for(Enroll_Candidate__c candidates:[Select Id , Course_Details__c FROM Enroll_Candidate__c where  Course_Details__c in:coursedetailsforcandidates.keyset()])
enrollIds.add(candidates.ID);

for(Course_Details__c courses :coursedetailsforcandidates.values())
{
System.debug('The total seats in the map is :' + courses.Total_Slots__c + ' the ids populated is : ' + enrollIds.size());
if(courses.Total_Slots__c >= enrollIds.size())
    courses.Booked_Slots__c=enrollIds.size();
else
    setError = true;
}

if(setError)
     Trigger.new[0].addError('Booked seats should not be the same as the Total seats!!');
    
update coursedetailsforcandidates.values();
}

trigger ContactSumTriggermodified on Contact (after  delete, after  insert, after update,after undelete)
 {
 
   
     Set<ID>conIds= new Set<ID>();
    
    
    Contact[] cons;
    if (Trigger.isDelete)
        cons = Trigger.old;
    else
        cons = Trigger.new;

    Set<ID> acctIds = new Set<ID>();
    for (Contact con : cons)
    {
            acctIds.add(con.AccountId);
    }
  
  

Map<ID, Account> acctsToUpdate = new Map<ID, Account>([Select Id,Total_no_of_contacts__c ,(Select Id,AccountId from Contacts where AccountId in :acctIds)from Account where Id in :acctIds]);


 
  
  for(Contact con:[Select Id , AccountId from Contact where AccountId in:acctstoupdate.keyset()])
        conIds.add(con.id);
       
    for(Account acct:acctstoupdate.values())      
  {
  
   
 
  if (acct.Total_no_of_contacts__c != conIds.size())
            acct.Total_no_of_contacts__c = conIds.size();                 
  }         
  update acctsToUpdate.values();
                                           
 }