• Galeeb SK
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 21
    Replies
I have one main vf page and i want to display all the vf pages which are availabale, into main vf page as tabs.then how to achieve this scenario,any one can help me.Any suggestion will be appreciate.

Best Regards
Galeeb
Hi
I am tried to update the count of Records,But it's not working Properly.Tell me where can make the Mistake,
Scenario:
I have two objects Position,Job Application.JobApplication has the Status field it contans picklist values Open,New,Closed.when i create record in JobApplication,I need  only 'Closed ' records count that should be update in Position .
Apart from that  i have 5 Closed Records ,5 Open  Records then how can i display the count individually in same Trigger.
Tell me Please.
My Code Is:

trigger countupdate on Job_Application__c (before insert,before update){

set<ID>sid=new set<ID>();

list<Position__c> PosRec=new list<Position__c>();

for(Job_Application__c job :trigger.new)
{
//sid.add(job.Position__c);


list<Position__c>Pos =[SELECT ID,Count__c,(SELECT ID,Status__c FROM Job_Applications2__r) FROM  Position__c WHERE ID =:job.id];

for(Position__c P:Pos){

if(job.Status__c=='Closed')
{
P.Count__c=P.Job_Applications2__r.size();
}
else{
//P.Count__c=P.Job_Applications2__r.size();
P.Count__c=0;
}

PosRec.add(P);
}
}
update PosRec;
}
Thanks
Galeeb SK
Hi
I am wrote a trigger to display no of holidays like sun days,saturdays etc in the year.But iam fail to display proper out put.Incase we defining any thing in company information like holiday,business hours,fiscal year etc.tell me where can i make a mistake, my code is 

APEX CLASS:

public class calculateWorkingDaysBetweenTwoDates{

public static void  WorkingDaysBetweenTwoDates(Date date1,Date date2 , id holidayId){


               List<Holiday__c> holidays=[Select Name, Start_Date__c,End_Date__c From Holiday__c ];
               
                set<date> holidayslist = new set<date>();
                
                                for (Holiday__c h : holidays){
                                
                                holidayslist.add(h.End_Date__c );
                                
                                }
                Integer allDaysBetween = date1.daysBetween(date2 );
                
                Integer allWorkingDays=0;
                
                for(Integer k=0;k<allDaysBetween ;k++ ){
                
                    if(holidayslist.add(date1.addDays(k))){
                    
                        allWorkingDays++;
                    } 
                }
                Holiday__c hh = new Holiday__c();
                
                hh.id= holidayId;
                
                hh.Working_Days__c = allWorkingDays;
                
                update hh;
                

      }
}
APEX TRIGGER:
trigger days on Holiday__c (after insert) {


 if(trigger.isInsert){
 
 for(Holiday__c hh:trigger.new){
 
    date date1 = date.today();
    
    date date2 = date.today().addMonths(11);
    
    calculateWorkingDaysBetweenTwoDates.WorkingDaysBetweenTwoDates(date1, date2,hh.id);
    
    system.debug('hh.Working_Days__c:: '+hh.Working_Days__c);
 }

}
}
Thanks 
Galeeb
Hi ,
I am tried to send a mail to case owner, next day  the case are closed, if user has multiple cases/case records have mulptiple owners he need to get only one email.How to achieve this ,please tell me with one exapmle.
Thanks
Galeeb
Hi,
Iam tried to display old and new values using trigger.if we update the values new values replace instead of old values.but i want to display both old and new values, how?for example if update Text A instead of  Text B so we display both Text A and Text B.Tell me with example.
Thank you
galeeb
Hi,
i have to display no of holidays in a month/year through apex triggers .i am failed to display holidays .Tell me where can i make a mistake in class or trigger.please tell me the solution.
Thanks
Galeeb SK

apex class:

public class calculateWorkingDaysBetweenTwoDates{

public Integer WorkingDaysBetweenTwoDates(Date date1,Date date2){

               List<Holiday> holidays=[Select h.StartTimeInMinutes, h.Name, h.ActivityDate From Holiday h];

                Integer allDaysBetween = date1.daysBetween(date2);
                Integer allWorkingDays=0;
                for(Integer k=0;k<allDaysBetween ;k++ ){
                    if(checkifItisWorkingDay(date1.addDays(k),holidays)){
                        allWorkingDays++;
                    } 
                }

                return allWorkingDays;

      }

public boolean checkifItisWorkingDay(Date currentDate,List<Holiday> holidays){
                 Date weekStart  = currentDate.toStartofWeek();
                for(Holiday hDay:holidays){
                        if(currentDate.daysBetween(hDay.ActivityDate) == 0){
                                 return false;
                        }
                }
               if(weekStart.daysBetween(currentDate) ==0 || weekStart.daysBetween(currentDate) == 6){
                       return false;
                } else 
                       return true;
  }
  }

apex trigger:

trigger days on Holiday__c (after insert) {

//for(Holiday__c h2 : trigger.new){

 if(trigger.isInsert){
 
calculateWorkingDaysBetweenTwoDates.WorkingDaysBetweenTwoDates();


}
}
Hi , i am  try to share the records using ''apex sharing '' but sharing can't be possible .please guide me how to share the records using Apex with one Example
Thanks
Galeeb SK
Hi 
i wrote a factory trigger for insert the records and updating  the records.The class should be calling in Trigger ,it saves.But inserting and updating can't be done.My Code is 

Apex Class:

public with sharing class MultipleTriggers
{
public static void execute()
{

if(trigger.isBefore){

list<Position__c> pos = new list<Position__c>();

for(Position__c p : pos){

        if(p.Priority__c=='Critical'&&
        
           p.Department__c=='IT'){
           
        if(p.Max_Pay__c <500000){
        
           p.Pay_Grade__c='IT-100';
           }
        else if(p.Max_Pay__c>500000 && p.Max_Pay__c<1000000){ 
        
                p.Pay_Grade__c='IT-200';
                }
        else if(p.Max_Pay__c>1000000 &&p.Max_Pay__c<1500000){
        
                p.Pay_Grade__c='IT-300';
                
                }
                
                else{
                
                p.Pay_Grade__c='IT-400';
             }
           }
        }
       }
      
       }
       
       public static void Handler()
       
       {
       
      if(trigger.isAfter) {
      
      list<Position__c> posi=new list<Position__c>();
      
    List<Job_Application__c> jobAppReclistToBeupdated=new List<Job_Application__c>();

    
     for(Position__c posRec:posi){
     
         if(posRec.Status__c=='Closed'){
         
list<Job_Application__c> joblist=new list<Job_Application__c>();

            joblist=[SELECT Id,Status__c,Position__c FROM Job_Application__c];
            
         for(Job_Application__c jobAppRec:joblist){
         
                    jobAppRec.Status__c='Closed';
                    
                 jobAppReclistToBeupdated.add(jobAppRec);
              
                        }
         }
        }
    update jobAppRecListToBeupdated;
}
}
/*public static void galeebs()
{

if(trigger.isDelete)
{

for(Position__c psk : trigger.old)
{
*/

}

Trigger:

trigger Factory on Position__c (before insert,before update,after update) {

if(trigger.isInsert)
{
MultipleTriggers.execute();
}
if(trigger.isUpdate)
{
MultipleTriggers.Handler();
}
}
Tell me the reason why it can't perform action

Regards
Galeeb SK
Hi 
How to share the records to specified users using Visualforce Pages.Tell me the resonable answer with proper code

Thanks
Galeeb SK
Hi,
Iam trying delete some records and display/stored those deleting records in another folder.Tell me how to approach this scenario

Regards
Galeeb SK
Hi,
iam trying to delete the records using vf pages but can't delete.It not display any errors but no result.Tell me the suitable Answer

My code is
VF Page:
<apex:page standardController="contact" extensions="deletemultiplecont" recordSetVar="contacts" >
    <apex:form id="frm">
          <apex:pageblock id="pgblk">
         
           <table class="list " border="0" cellpadding="0" cellspacing="0">
           <tr class="headerRow" >
              
              <th class="headerRow"> Action </th>
              <th class="headerRow"> Name </th>
              <th class="headerRow"> MailingCity </th>
              <th class="headerRow"> Phone </th>
           </tr>
          <th> <apex:repeat value="{!contacts}" var="cont">
           <tr class="dataRow">
               
                <td class="dataCell"> <apex:commandlink value="delete" action="{!delmultplerec}" oncomplete="location.reload();">
                   <apex:param value="{!cont.id}" name="Id"/> 
                 </apex:commandLink> </td>
               
              <td class="dataCell"> <apex:outputText value="{!cont.Name}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.MailingCity}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.phone}"/> </td>  
             
           </tr>
           </apex:repeat> </th>
           
        </table>
                 
      </apex:pageblock>
    </apex:form>

</apex:page>

Controller Class:

Public with sharing class deletemultiplecont
{
  public string Name{set;get;}
  public string Phone{get;set;}
  public string MailingCity{get;set;}
  public string asgn{get;set;}
  public contact cdel = new contact();
 
 public deletemultiplecont(apexpages.standardsetcontroller setcon)
  {
  
  }
  
  Public pagereference delmultplerec()
  {
        Id contactId = apexpages.currentpage().getParameters().get('Id');
        system.debug('hidden val is..!!' +asgn);
        try
            {
            
            cdel = [select id from contact where id =: contactId];
            system.debug('delete rec is..!!' +cdel);
            delete cdel;            
            return NULL;
            }
             catch(exception e)
             {
                System.debug('The following exception has occurred: ' + e.getMessage());
                return NULL;
             } 
  }
}

Regards
Galeeb SK
Hi,
Sorry SRK,My complete Scenario is
i have one scenario like this ,i have 3 objects like A,B,C.C is the junction object of both A and B .i assign the two records of B to A (like mapping), AND also assign those  same two records to C(like mapping). Inthat case when iam assigning those same two records to C,I want to  display  an Error  like this ' inserting duplicate records' . How to achieve this with APEX CODE? Please Tell me?

Regards
Galeeb SK
 
i have one scenario like this ,i have 3 objects like A,B,C .i assign the two records of B to A (like mapping), AND also assign those  same two records to C. Inthat case when iam assigning those same two records to C, it display  an Error duplicate records like this. How to achieve this with APEX CODE?Please Tell me?

Regards
Galeeb SK
Hi ,
iam tried to Update Parent Record Status,My scenario is 

when  ''all'' the  child records status is 'Closed'  then its corresponding Parent record status is also 'Closed'.iam trying but fail because iam changing the  one child record status  is closed its corresponding parent record is also changed this not good,please help me.. My code is

trigger StatusChangePostion on Job_Application__c (after insert,after update) {

list<Position__c> pslist=new list<Position__c>();

list<ID> listids=new list<ID>();

for(Job_Application__c  jb:trigger.new){

listids.add(jb.Position__c);
}
pslist=[select id,Name,(select id,Status__c from Job_Applications2__r)from Position__c where id IN:listids];

for(Position__c p:pslist){

Boolean setToApproved=true;

for(Job_Application__c ja:p.Job_Applications2__r){

/*if(ja.Status__c=='Open'){

//p.Status__c='Closed';


setToApproved=false;

break;
}
if(ja.Status__c=='Approved'){

setToApproved=false;

break;
}*/

if(ja.Status__c=='Closed'){



p.Status__c='Closed';
}
}
update pslist;
}
}

Regards 
Galeeb SK
Hi

what is Bulkifying Trigger in  salesforce?

According to my knowledge Bulkifying Trigger means to combine two or more triggers into one trigger ,is it right (or) wrong tell me the resonable Answer

Regards
Galeeb SK
Hi,i have one scenario in vf page i can try it but it not working my scenario is

I have couple of pages in an application
Says as page1 ,page2,page3,page4,page5.All the five pages are having same content as footer and header??
when i add some sentences on page 1 ,it should appear in all the pages .How can u achieve this??
Using Visualforce Pages.

''tell me the proper solution with code and also tell me where we can find example programmes/scenarios in Triggers,BatchApex&Visualforce Pages''
Regards
Galeeb SK
Hai ,could tell me where we can find trigger example scenarios as best practises in google tell me the links
Regards
Galeeb SK
Question 1:
Hai ,i have a batch apex of size 200,it can be divided into 4 batches each batch is 50.if batch1 is executed ,if it commit to the database? incase if all batches i.e 4 batches are executed after that it commit to the database? Tell me resonable Answer.....if all batchs are executed first after that it commit to the database ok,in that if first batch is executed, where it be stored before  commit to the database?Tell me suitable Answer.... 
Another Question 2:
   if i have 4 batches ,if they are commited to database in that  an error is raised in batch 3,if only batch 3 eliminated OR all batches are eliminated into the database? Tell me with proper scenario with proper code
Hai, i tried to insert records through batch apex but it can't ,tell me ,my code is

global class opportunityincrement implements database.batchable<sObject>{
 global database.QueryLocator start(database.batchableContext bc){
  string query='select id,Name,Job_Description__c,Max_Pay__c,Min_Pay__cfrom Position__c';
  return database.getQueryLocator(query);
  }
 global void execute(database.batchableContext bc,list<Position__c>scope){
  system.debug(scope+'bbbbbbbbbbbbbbbbbbb');
 
  list<Position__c> oppty=new list<Position__c>();
   for(Position__c opp:scope){
  
  
   opp.Name='Test';
   opp.Job_Description__c= 'Closed';
   opp.Max_Pay__c= 10000;
    opp.Min_Pay__c= 5000;
   
    oppty.add(opp);
     system.debug(oppty+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
  
   
   }
    insert oppty;
   }
   global void finish(database.batchableContext bc){
   
   }
  }
Hai,iam tried to create some custom object homepage in visualeforce page.i get some issues,please guide me how  to create that one
Hai,iam tried to create some custom object homepage in visualeforce page.i get some issues,please guide me how  to create that one
Hi 
I have an requirement that i need to make different vf pages as tabs for example
i have created 4 vf pages with different components like input&output. I need to make these pages as tabs for a site

Thanks in Advance 
Hi
I am tried to update the count of Records,But it's not working Properly.Tell me where can make the Mistake,
Scenario:
I have two objects Position,Job Application.JobApplication has the Status field it contans picklist values Open,New,Closed.when i create record in JobApplication,I need  only 'Closed ' records count that should be update in Position .
Apart from that  i have 5 Closed Records ,5 Open  Records then how can i display the count individually in same Trigger.
Tell me Please.
My Code Is:

trigger countupdate on Job_Application__c (before insert,before update){

set<ID>sid=new set<ID>();

list<Position__c> PosRec=new list<Position__c>();

for(Job_Application__c job :trigger.new)
{
//sid.add(job.Position__c);


list<Position__c>Pos =[SELECT ID,Count__c,(SELECT ID,Status__c FROM Job_Applications2__r) FROM  Position__c WHERE ID =:job.id];

for(Position__c P:Pos){

if(job.Status__c=='Closed')
{
P.Count__c=P.Job_Applications2__r.size();
}
else{
//P.Count__c=P.Job_Applications2__r.size();
P.Count__c=0;
}

PosRec.add(P);
}
}
update PosRec;
}
Thanks
Galeeb SK
Hi
I am wrote a trigger to display no of holidays like sun days,saturdays etc in the year.But iam fail to display proper out put.Incase we defining any thing in company information like holiday,business hours,fiscal year etc.tell me where can i make a mistake, my code is 

APEX CLASS:

public class calculateWorkingDaysBetweenTwoDates{

public static void  WorkingDaysBetweenTwoDates(Date date1,Date date2 , id holidayId){


               List<Holiday__c> holidays=[Select Name, Start_Date__c,End_Date__c From Holiday__c ];
               
                set<date> holidayslist = new set<date>();
                
                                for (Holiday__c h : holidays){
                                
                                holidayslist.add(h.End_Date__c );
                                
                                }
                Integer allDaysBetween = date1.daysBetween(date2 );
                
                Integer allWorkingDays=0;
                
                for(Integer k=0;k<allDaysBetween ;k++ ){
                
                    if(holidayslist.add(date1.addDays(k))){
                    
                        allWorkingDays++;
                    } 
                }
                Holiday__c hh = new Holiday__c();
                
                hh.id= holidayId;
                
                hh.Working_Days__c = allWorkingDays;
                
                update hh;
                

      }
}
APEX TRIGGER:
trigger days on Holiday__c (after insert) {


 if(trigger.isInsert){
 
 for(Holiday__c hh:trigger.new){
 
    date date1 = date.today();
    
    date date2 = date.today().addMonths(11);
    
    calculateWorkingDaysBetweenTwoDates.WorkingDaysBetweenTwoDates(date1, date2,hh.id);
    
    system.debug('hh.Working_Days__c:: '+hh.Working_Days__c);
 }

}
}
Thanks 
Galeeb
Hi ,
I am tried to send a mail to case owner, next day  the case are closed, if user has multiple cases/case records have mulptiple owners he need to get only one email.How to achieve this ,please tell me with one exapmle.
Thanks
Galeeb
Hi,
Iam tried to display old and new values using trigger.if we update the values new values replace instead of old values.but i want to display both old and new values, how?for example if update Text A instead of  Text B so we display both Text A and Text B.Tell me with example.
Thank you
galeeb
Hi,
i have to display no of holidays in a month/year through apex triggers .i am failed to display holidays .Tell me where can i make a mistake in class or trigger.please tell me the solution.
Thanks
Galeeb SK

apex class:

public class calculateWorkingDaysBetweenTwoDates{

public Integer WorkingDaysBetweenTwoDates(Date date1,Date date2){

               List<Holiday> holidays=[Select h.StartTimeInMinutes, h.Name, h.ActivityDate From Holiday h];

                Integer allDaysBetween = date1.daysBetween(date2);
                Integer allWorkingDays=0;
                for(Integer k=0;k<allDaysBetween ;k++ ){
                    if(checkifItisWorkingDay(date1.addDays(k),holidays)){
                        allWorkingDays++;
                    } 
                }

                return allWorkingDays;

      }

public boolean checkifItisWorkingDay(Date currentDate,List<Holiday> holidays){
                 Date weekStart  = currentDate.toStartofWeek();
                for(Holiday hDay:holidays){
                        if(currentDate.daysBetween(hDay.ActivityDate) == 0){
                                 return false;
                        }
                }
               if(weekStart.daysBetween(currentDate) ==0 || weekStart.daysBetween(currentDate) == 6){
                       return false;
                } else 
                       return true;
  }
  }

apex trigger:

trigger days on Holiday__c (after insert) {

//for(Holiday__c h2 : trigger.new){

 if(trigger.isInsert){
 
calculateWorkingDaysBetweenTwoDates.WorkingDaysBetweenTwoDates();


}
}
Hi,
Iam trying delete some records and display/stored those deleting records in another folder.Tell me how to approach this scenario

Regards
Galeeb SK
Hi,
Sorry SRK,My complete Scenario is
i have one scenario like this ,i have 3 objects like A,B,C.C is the junction object of both A and B .i assign the two records of B to A (like mapping), AND also assign those  same two records to C(like mapping). Inthat case when iam assigning those same two records to C,I want to  display  an Error  like this ' inserting duplicate records' . How to achieve this with APEX CODE? Please Tell me?

Regards
Galeeb SK
 
Hi ,
iam tried to Update Parent Record Status,My scenario is 

when  ''all'' the  child records status is 'Closed'  then its corresponding Parent record status is also 'Closed'.iam trying but fail because iam changing the  one child record status  is closed its corresponding parent record is also changed this not good,please help me.. My code is

trigger StatusChangePostion on Job_Application__c (after insert,after update) {

list<Position__c> pslist=new list<Position__c>();

list<ID> listids=new list<ID>();

for(Job_Application__c  jb:trigger.new){

listids.add(jb.Position__c);
}
pslist=[select id,Name,(select id,Status__c from Job_Applications2__r)from Position__c where id IN:listids];

for(Position__c p:pslist){

Boolean setToApproved=true;

for(Job_Application__c ja:p.Job_Applications2__r){

/*if(ja.Status__c=='Open'){

//p.Status__c='Closed';


setToApproved=false;

break;
}
if(ja.Status__c=='Approved'){

setToApproved=false;

break;
}*/

if(ja.Status__c=='Closed'){



p.Status__c='Closed';
}
}
update pslist;
}
}

Regards 
Galeeb SK
Hi

what is Bulkifying Trigger in  salesforce?

According to my knowledge Bulkifying Trigger means to combine two or more triggers into one trigger ,is it right (or) wrong tell me the resonable Answer

Regards
Galeeb SK
Hi,i have one scenario in vf page i can try it but it not working my scenario is

I have couple of pages in an application
Says as page1 ,page2,page3,page4,page5.All the five pages are having same content as footer and header??
when i add some sentences on page 1 ,it should appear in all the pages .How can u achieve this??
Using Visualforce Pages.

''tell me the proper solution with code and also tell me where we can find example programmes/scenarios in Triggers,BatchApex&Visualforce Pages''
Regards
Galeeb SK
Question 1:
Hai ,i have a batch apex of size 200,it can be divided into 4 batches each batch is 50.if batch1 is executed ,if it commit to the database? incase if all batches i.e 4 batches are executed after that it commit to the database? Tell me resonable Answer.....if all batchs are executed first after that it commit to the database ok,in that if first batch is executed, where it be stored before  commit to the database?Tell me suitable Answer.... 
Another Question 2:
   if i have 4 batches ,if they are commited to database in that  an error is raised in batch 3,if only batch 3 eliminated OR all batches are eliminated into the database? Tell me with proper scenario with proper code
 Hai,There are two fields, if the user populate two field values and if we combine(or concatenate) those values uniqueness should be maintained.(I.e., combination should be unique)

How to achieve this without coding ?