• srikanth11
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 52
    Questions
  • 82
    Replies

i am inserting 4 tasks at a time and when they are inserted i want the max date in four of them to populate in the placement object plz help me how to do this 

i have 2 queries and i bought the id of the two queries into two variables now i want them both in one variable how can i do that 

 

 

   workItemListstep = [Select  p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstancestep p where p.ProcessInstance.TargetObjectId = :ID ];         
     workItemListitem = [Select  p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstanceworkitem p where p.ProcessInstance.TargetObjectId = :ID ];     
     
     
     set<id> ff=new set<id>();
     for(ProcessInstancestep workItemListstep1:workItemListstep)
     {
     ff.add(workItemListstep1.id);
       }
       
     set<id> ff1=new set<id>();
     
     for(ProcessInstanceworkitem workItemListitem1:workItemListitem)
     {
    
   
     ff1.add(workItemListitem1.id);    
     }
here i bought the id's into two different sets now i want all these id's into 1 set how can i do that plz help

 

i have written two queries now i want to bring all the queries into a lst array plz help how to do that

 

 workItemListstep = [Select  p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstancestep p where p.ProcessInstance.TargetObjectId = :ID ];         
     workItemListitem = [Select  p.ProcessInstance.TargetObjectId,p.ProcessInstanceId,p.OriginalActorId,p.Id,p.ActorId,p.Actor.name From ProcessInstanceworkitem p where p.ProcessInstance.TargetObjectId = :ID ]; 

this is the controller i have written and plz help me how to write test case
Public class Remarkscontroller {
public Appointment__c[] blockedappts {get; set;}
String m_param;
String y_param;
Date Di = system.today();
Public Integer monthc {get;set;}
public  Integer Year{get; set;} 
Public string monthname {get;set;}
  

public Remarkscontroller(Dev_Appt_Calendar_Repeat controller) {
m_param = System.currentPageReference().getParameters().get('br');
y_param = System.currentPageReference().getParameters().get('dr');

Monthc = di.month();
Year= di.year();
if(Monthc == 12){
monthname = 'December';
}
if(Monthc == 11){
monthname = 'November';
}
if(Monthc == 10){
monthname = 'October';
}
if(Monthc == 9){
monthname = 'September';
}
if(Monthc == 8){
monthname = 'August';
}
if(Monthc == 7){
monthname = 'July';
}
if(Monthc == 6){
monthname = 'June';
}
if(Monthc == 5){
monthname = 'May';
}
if(Monthc == 4){
monthname = 'April';
}
if(Monthc == 3){
monthname = 'March';
}
if(Monthc == 2){
monthname = 'Febuary';
}
if(Monthc == 1){
monthname = 'January';
}

//blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:month AND branch__c =: m_param AND Doctor__c=:y_param];
blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:Monthc AND branch__c =: m_param AND Doctor__c=:y_param];



}






}
this is the test case i havew written and the error is saying the constructor is not defined
@isTest
private class Remarkscontroller_TC
{
static testmethod void TestController()
{

Remarkscontroller rc= new Remarkscontroller();
}
}
 

 

hi all this is the query i used in the trigger and i want ot convert the lstar aggregate value in to integer value plz help how to do that

 

 

lstAR = [select Sum(Quantity_remaining__c)am from Inventory_Transaction__c where item__c=:ifl.item__c and warehouse__c=:ifl.warehouse__c  ]; 

 

 

hi i want the am value into a integer variable and also this is a trhgger so tell me the code part in view of a trigger

 

this is the controller i have written and plz help me how to write test case

Public class Remarkscontroller {
public Appointment__c[] blockedappts {get; set;}
String m_param;
String y_param;
Date Di = system.today();
Public Integer monthc {get;set;}
public  Integer Year{get; set;} 
Public string monthname {get;set;}
  

public Remarkscontroller(Dev_Appt_Calendar_Repeat controller) {
m_param = System.currentPageReference().getParameters().get('br');
y_param = System.currentPageReference().getParameters().get('dr');

Monthc = di.month();
Year= di.year();
if(Monthc == 12){
monthname = 'December';
}
if(Monthc == 11){
monthname = 'November';
}
if(Monthc == 10){
monthname = 'October';
}
if(Monthc == 9){
monthname = 'September';
}
if(Monthc == 8){
monthname = 'August';
}
if(Monthc == 7){
monthname = 'July';
}
if(Monthc == 6){
monthname = 'June';
}
if(Monthc == 5){
monthname = 'May';
}
if(Monthc == 4){
monthname = 'April';
}
if(Monthc == 3){
monthname = 'March';
}
if(Monthc == 2){
monthname = 'Febuary';
}
if(Monthc == 1){
monthname = 'January';
}

//blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:month AND branch__c =: m_param AND Doctor__c=:y_param];
blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:Monthc AND branch__c =: m_param AND Doctor__c=:y_param];



}






}
this is the test case i havew written and the error is saying the constructor is not defined

@isTest
private class Remarkscontroller_TC
{
static testmethod void TestController()
{

Remarkscontroller rc= new Remarkscontroller();

}
}

 

this is the controller i have written and plz help me how to write test case

 

 

Public class Remarkscontroller {
public Appointment__c[] blockedappts {get; set;}
String m_param;
String y_param;
Date Di = system.today();
Public Integer monthc {get;set;}
public  Integer Year{get; set;} 
Public string monthname {get;set;}
  

public Remarkscontroller(Dev_Appt_Calendar_Repeat controller) {
m_param = System.currentPageReference().getParameters().get('br');
y_param = System.currentPageReference().getParameters().get('dr');

Monthc = di.month();
Year= di.year();
if(Monthc == 12){
monthname = 'December';
}
if(Monthc == 11){
monthname = 'November';
}
if(Monthc == 10){
monthname = 'October';
}
if(Monthc == 9){
monthname = 'September';
}
if(Monthc == 8){
monthname = 'August';
}
if(Monthc == 7){
monthname = 'July';
}
if(Monthc == 6){
monthname = 'June';
}
if(Monthc == 5){
monthname = 'May';
}
if(Monthc == 4){
monthname = 'April';
}
if(Monthc == 3){
monthname = 'March';
}
if(Monthc == 2){
monthname = 'Febuary';
}
if(Monthc == 1){
monthname = 'January';
}

//blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:month AND branch__c =: m_param AND Doctor__c=:y_param];
blockedappts = [select id,appt_date__c,Calander_Day__c,Appt_remarks__c,Block_the_Entire_Day__c  from Appointment__c where Block_the_Entire_Day__c=TRUE AND Recordtypeid=:'01290000000YnZw' AND CALENDAR_YEAR(Appt_date__c) =:Year AND CALENDAR_MONTH(Appt_date__c)=:Monthc AND branch__c =: m_param AND Doctor__c=:y_param];



}






}
this is the test case i havew written and the error is saying the constructor is not defined

@isTest
private class Remarkscontroller_TC
{
static testmethod void TestController()
{

Remarkscontroller rc= new Remarkscontroller();

}
}

 

these are the two trigger splz help me bulkify them

 

trigger Auto_Populate_salesteam_create_splits on Opportunity (after insert) 
{
for(opportunity o:trigger.new)
{
//GET ALL ACCOUNT TEAM MEMBERS EXCEPT THE OWNER OF THE OPPORUNITY
integer comm =0;
opportunityteammember[] otm = [select id,UserId from opportunityteammember where opportunityid=:o.id];
Integer otmcount = otm.size();
system.debug('otmcount:'+otmcount);
splits__c spl4oppowner = new splits__c();
spl4oppowner.opportunity__c = o.id; 
spl4oppowner.user__c = o.ownerid; 
spl4oppowner.Split__c = (100/(otmcount+1));
insert spl4oppowner;

for(opportunityteammember otm1:otm){

comm =  (otmcount);
splits__c spl = new splits__c();

spl.opportunity__c = o.id;
spl.user__c = otm1.userid;
spl.Split__c = (100/(comm+1));
insert spl;
//comm= comm+1;

}
}

}
trigger 2:
trigger Auto_Populate_salesteam on Opportunity (after insert) 
{
public list<opportunityteammember> o1 {get;set;}
o1 =new list<opportunityteammember>();
for(opportunity o:trigger.new)
{
//GET ALL ACCOUNT TEAM MEMBERS EXCEPT THE OWNER OF THE OPPORUNITY

accountteammember[] atm=[select id,UserId,TeamMemberRole from accountteammember 
where userid!=:o.ownerid AND(accountid=:o.Primary_Agency_Buyer__c or accountid=:o.brand__c or accountid=:o.Accountid)];
for(accountteammember atm1:atm)
{
//if(o.ownerid!=atm1.userid){
//FOR EACH ACCOUNT TEAM MEMBER CREATE A NEW OPPORTUNITY TEAM MEMBER ON OPPORTUNITY
opportunityteammember otm = new opportunityteammember();
otm.userid=atm1.userid;
otm.opportunityid=o.id;
otm.TeamMemberRole = atm1.TeamMemberRole;
o1.add(otm);
//}
}
insert o1;
}
}

 

 

this is the clas i have written some one help me how to write the test case

public with sharing class files1 
 {

    


    public files1() {
s1=new file__c();
 s2=new file__c();
 s3=new file__c();
 s4=new file__c();
 s4=new file__c();
 s5=new file__c();
 
    }


   
    
 public files1(ApexPages.StandardController controller) 
 
 {
 
  }
 public file__c s1 {get; set;}
 public file__c s2 {get; set;}
 public file__c s3 {get; set;}
 public file__c s4 {get; set;}
 public file__c s5 {get; set;}
 
 public PageReference saveall() {
 insert s1;
 insert s2;
 insert s3;
 insert s4;
 insert s5;
        return null;
    }
 
 
 
 
 }

 

hi all i have written this trigger and it is working for one insert and update of a record at a time but when i am bulk inserting records 50 or 60 at a time its not working some one plz check my code and help me how to change my trigger to bulkify it. this is my trigger

trigger updatefundtotal on opportunity(after insert, after update)
 {
   Decimal id2num =0.0;

 for(opportunity o:trigger.new)
 {
 fund__c f=[select id ,Current_AUM__c from fund__c where id=:o.fund__c];
 opportunity[] opp=[select ID,Name,amount,Fund__r.Current_AUM__c from opportunity where fund__c=:f.ID  and stagename='booked'];
for(opportunity opp1:opp)
          {
         
         id2num  =opp1.amount + id2num;
          f.Current_AUM__c = id2num ;        
                  
        } update f;
          
          }   

 }

 

can some one please tell me what exactly is bulkification of trigger

i have written this trigger on appointments and when i am saving bulk records i am getting too many soql errors plz help me

 

 

}

 

trigger Dev_Appt_Max_slot_Error on Appointment__c (before insert,before update) 
{
    Set<Id> doctorId = new Set<Id>();
    Set<Id> branchId = new Set<Id>();
    Set<Date>  appDate = new Set<Date>();
    set<string> appampm = new set<string>();
    set<string> apphour = new set<string>();
    set<string> appmin =new set<string>();
        for(appointment__c a:trigger.new)
    {
        doctorId.add(a.doctor__c);
        branchId.add(a.branch__c);
        appDate.add(a.Appt_Date__c);
        appampm.add(a.Appt_AM_PM__c);
        apphour.add(a.Appt_Hour__c);
        appmin.add(a.Appt_Minute__c);
    }
     branch__c b=[select id,Dev_Check_Branch_Has_Max_Appt_Book_Slot__c   from branch__c where id in: branchId];
    List<appointment__c> a1 =[select  id,Dev_Maximum_Book_Slot__c from appointment__c where doctor__c in: doctorId and branch__c in: branchId and Appt_Date__c in: appDate and Cancelled__c=false and Appt_AM_PM__c in:appampm and Appt_Hour__c in:apphour and Appt_Minute__c in:appmin];
    for(appointment__c a:trigger.new)
    {
        
       if(a1.size()>a.Dev_Max_Appt_Book_Slot_for_Blocking__c && a.Dev_Check_Appt_is_Blocked_for_Max_Slot__c =='TRUE' &&b.Dev_Check_Branch_Has_Max_Appt_Book_Slot__c=='TRUE')
        {
            a.addError('The maximum booking slot limit is exceeded');

        }



    }