• srikanth11
  • NEWBIE
  • 0 Points
  • Member since 2011

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

hi all 

 

i have created a custom button on invoice . when i click the button it will display the record of item fulfilment and user gives the values and save it now my requirement is i want three rows of item fulfilements when i click the buttton and the user gives different values in the three rows and when he save all the three item fulfilements should be saved how can i do that plz help me

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

 

 i am getting dml statements for this trigger pleaseh help resolve the issue

trigger Auto_Populate_salesteam_create_splits on Opportunity (after insert) 
{
public List<splits__c> spl1{get;set;}  
   spl1 = new List<splits__c>();


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;
spl1.add(spl);
}
insert spl1;
}

}

 

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();

}
}

 

Hi all

 

 

 i have written a search criteria where in trhe user gives a class and the trainers names for that class are displayed . now plz help me i have to select one of the trainers i retrieved and place the id in a another page trainer field plz give an idea how can i do this

Hi all 

 

How to add look up filters for look up fields in another objects plz help us how to do it.

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;
}
}

 

 

hi this is the trigger i have written

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;

}
}

}
this is the test case i have written AND I AM GETTING 64 PERCENT PLZ HELP ME GET 100%
@istest
private class Auto_Populate_salesteam_create_splits_TC
{
static testmethod void validateabc()
{
account a =new account();
a.name='sdsd';
insert a;


user u =[select id from user where isactive=true limit 1];



opportunity o= new opportunity();
o.name='sadsd';
o.StageName='100% - Order In House';
o.CloseDate=date.ValueOf('2011-09-21');
o.Accountid=a.id;
o.Unit_Size__c='PG 4C';
o.Ad_Type__c='Classified';
o.Campaign_End_Date__c=date.ValueOf('2011-12-07');
o.Campaign_Start_Date__c=date.ValueOf('2011-12-07');
o.recordtypeid='012A0000000ufHv';
insert o;
accountteammember a1=new accountteammember();
a1.userid=u.id;
a1.accountid=o.AccountId;
insert a1;

opportunityteammember otm=new opportunityteammember();
otm.userid=u.id;
otm.opportunityid=o.id;
insert otm;


}
}

 

 

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

Hi all

 

 

this is my task.

 

actually i have to write a trigger to generate an error mesage the error message should be generated for following conditions

 

trigger error on Booking__c (after insert ,after update) 
{
for(booking__c b:trigger.new)
{

Booking__c[] b1=[select id,To__c,From__c from Booking__c where From__c=:b.from__c and To__c =:b.to__c and room__c=:b.Room__c and Trainer__c=:b.trainer__c ];
booking__c[] b3=[select id,To__c,From__c from Booking__c where date__c=:b.date__c ];
for(Booking__c b4:b3)
{
for(Booking__c b5:b1)
{
if(b1.size()>1||b.from__c<b4.to__c)
{
b.addError('No more time slot to book this Appointment');
}
}
}
}
}
this is the trigger i have written actually the error message should be generated when the from time of the record i am going to insert should be less than the previous record to time and again if the same record is inserted twice again it should throw the error plz the trigger i have written is not working plz help me in this issue

 

 

how to add header and footer to the visual force page the output should be a word document 

hi i am working on customer portal and i have written this code for login and password details actually i am new to this plz check my code and some plz help me with some code how to make this work

/**
 * An apex page controller that exposes the site login functionality
 */
global class SiteLoginController {
    global String username {get; set;}
    global String password {get; set;}

    global PageReference login() {
        String startUrl ;//= System.currentPageReference().getParameters().get('startURL');
if (startUrl == null)
   startURL = (Site.getPrefix() != null ? '' : Site.getPrefix()) + '</home/home.jsp>'; 
   
        return Site.login(username, password, startUrl);
        //return page.page;
    }
    /*global SiteLoginController () {}
    
    global static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = 'test@salesforce.com';
        controller.password = '123456'; 
                
        System.assertEquals(controller.login(),null);                           
    }  */
      
}

 

hi all i have wqritten a controller and i am getting this error

 

 

Class.Group_Renewal.checkpdf: line 173, column 9 External entry point\

System.DmlException: Update failed. First exception on row 0 with id 006V00000029g8gIAA; first error: STORAGE_LIMIT_EXCEEDED, storage limit exceeded: [] 

 

this is my controller and i am getting the error at checkpdf() method update op plz can some one tell what exactly is this error

 

public with sharing class Group_Renewal
{

    public String getUncheck() {
        return null;
    }



public list<AggregateResult> lstAR = new list<AggregateResult>();
public Opportunity userInputAppointment {get; set;}
public List<Opportunity> opp99{get;set;} 
public List<Opportunity> op{get;set;} 
public Account userinputact {get; set;}
public String[] acts {get;set;}
Set<Id> tskNo = new Set<Id>();
public Task[] tsk ;
public string u;
public string countopp{get; set;}
Set<String> temp = new Set<String>();



public list<AggregateResult> lstARdel = new list<AggregateResult>();
public List<Opportunity> opdel{get;set;} 
public String[] actsdel {get;set;}

  
 public Group_Renewal()
{
 
userInputAppointment = new Opportunity();
userinputact = new Account();
 
userInputAppointment.From_Date__c=Date.valueof(ApexPages.currentPage().getParameters().get('fromdate'));
userInputAppointment.To_Date__c=Date.valueof(ApexPages.currentPage().getParameters().get('todate'));
userinputact.Search_By_Name__c=ApexPages.currentPage().getParameters().get('cha');
countopp=ApexPages.currentPage().getParameters().get('countopp');

 //Retrieving the Activities(Tasks)
 tsk=[select  whatid from task  where Priority='Renewal' and ActivityDate>=:userInputAppointment.From_Date__c and  
 ActivityDate<=:userInputAppointment.To_Date__c ]; 
 

for(Task aa: tsk)
{
tskNo.add(aa.whatid);
} 



// Spliting the user input for search cretiria.
u=userinputact.Search_By_Name__c;


String[] result=u.split('\\,');

for( Integer i = 0; i<result.size(); i++)
        {
            temp.add(result[i]+'%');
        }



//Retrieving the opportunities and account fileds
op = [select id,name,Total__c,Account.Name,Account.Director_ID__c,Start_Issue_Qtr__c,Expire_Issue_Qtr__c,Opp_Check_to_PDF__c,
Renewal_Effort__c,Account.Bill_To__r.Name,Account.Bill_To__r.Id from Opportunity where id in:tskNo and
recordType.id=:'012V0000000CgYl' and  Account.Bill_To__r.Name!='' and Account.Bill_To__r.Name LIKE:temp  order by Account.Bill_To__r.Name];


//this query for getting Amount(SUM) on to visual force page after Grouping.
lstAR = [Select Sum(Total__c)am,Account.Bill_To__r.Id ocn,Account.Bill_To__r.Bank_Mailing_PDF__c p from Opportunity  where id in:op and
recordType.id=:'012V0000000CgYl' and Account.Bill_To__r.Name LIKE:temp   Group By Account.Bill_To__r.Id,Account.Bill_To__r.Bank_Mailing_PDF__c];
 

Set<String> stateSet = new Set<String>();
 for(Opportunity a : op)


 stateSet.add(a.Account.Bill_To__r.id);
  //stateSet.add(a.name);
 
   acts = new String[stateSet.size()];
  Integer i = 0;
   
    for (String state : stateSet)
     { 
      acts[i] = state;
      i++;
     }
     acts.sort();
 
   
   
   
   opdel = [select id,name,Total__c,Account.Name,Account.Director_ID__c,Start_Issue_Qtr__c,Expire_Issue_Qtr__c,Opp_Check_to_PDF__c,
Renewal_Effort__c,Account.Bill_To__r.Name,Account.Bill_To__r.Id from Opportunity where id in:tskNo and
recordType.id=:'012V0000000CgYl' and Opp_Check_to_PDF__c=true and  Account.Bill_To__r.Name!='' and Account.Bill_To__r.Name LIKE:temp  order by Account.Bill_To__r.Name];


//this query for getting Amount(SUM) on to visual force page after Grouping.
lstARdel = [Select Sum(Total__c)am,Account.Bill_To__r.Id ocn,Account.Bill_To__r.Bank_Mailing_PDF__c p from Opportunity  where id in:op and
recordType.id=:'012V0000000CgYl' and  Opp_Check_to_PDF__c=true and  Account.Bill_To__r.Name!='' and Account.Bill_To__r.Name LIKE:temp   Group By Account.Bill_To__r.Id,Account.Bill_To__r.Bank_Mailing_PDF__c];
 

Set<String> stateSetdel = new Set<String>();
 for(Opportunity adel : opdel)


 stateSetdel.add(adel.Account.Bill_To__r.id);
  //stateSet.add(a.name);
 
   actsdel = new String[stateSetdel.size()];
  Integer idel = 0;
   
    for (String statedel : stateSetdel)
     { 
      actsdel[idel] = statedel;
      idel++;
     }
     actsdel.sort();
 
     
   
   
   
   
   
}



// for displaying Amount(Sum)
    public list<Opp> getResult()  
    {  
    list<Opp> lstResult1 = new list<Opp>();  
    for (AggregateResult ar: lstAR)  
    {
    opp objOpp= new opp(ar);  
    lstResult1.add(objOpp);  
    }  
    return lstResult1;  
    }  


// for "opp" which is used in above getResult 
class opp
{  
public Double am{ get;set; }
 
public string p{ get;set; }
public string ocn{ get;set; }


public opp(AggregateResult ar)  
{  
am = (Double)ar.get('am');
ocn = (string)ar.get('ocn');  
p = (string)ar.get('p');
}
}


 public PageReference deliverAsPDF()
  {   
        PageReference pdf = new PageReference('/apex/Group_Renewal_PDF');   
        pdf.getParameters().put('p','p');
        return pdf;
  }

 public PageReference checkpdf()
  {   
        update op;
        PageReference pdfdel = new PageReference('/apex/Group_renewal_checkbox');   
        pdfdel.getParameters().put('p','p');
        return pdfdel;
  }
  public void uncheck()
  {
      for(opportunity opps1:op)
      {
      if(opps1.Opp_Check_to_PDF__c==true)
      {
       opps1.Opp_Check_to_PDF__c=false;
       
      }
     
      
          
      }
 
  
   
  } 




}

 


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');

        }



    }