• cathy369
  • NEWBIE
  • 45 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 16
    Replies
I've created a nightmare for myself.  I used SeeAllData=true in a test class, and the data has changed.  All my system asserts are failing.

I can change it in the sandbox to be appropriate or to actually put the records in the test class, but when I validate it in production, it fails on that test.

Part of the reason I used it in the first place was due to failing for govern limits.

Help please!!   It would be so gratefully appreciated.
I've got a very simple trigger that retrieves a unique order number from a custom object.  The reason for the trigger is the Order Number is used by 2 different objecsts.  Below is the trigger and associated class... As you can see, the object only has one record named "ORDER", which is how I retrieve it.  It works fine in test, but I'm not sure how to write my test class.  If I create a record in the object, then it will have 2 'ORDER' records.
I'm kind of at a loss.
Any help would be greatly appreciated...Thanks much.
trigger getOrdNum on Opportunity (before insert) {

    for (Opportunity o : Trigger.new){
       o.Test_SF_Ord_Num__c = orderNumber.getOrderNumber();
    }
}

________________________________________
Class:

public class orderNumber {

   public static decimal getOrderNumber(){
  
      List<Order_Number__c> ListOrderNum = [SELECT Order_Num__c FROM Order_Number__c WHERE Name = 'ORDER'];
   
      if( ListorderNum.size() > 0 )
      {
        ListorderNum[0].Order_Num__c += 1;
        update ListOrderNum[0];
        return ListOrderNum[0].Order_Num__c;
      }  
      return 0;
   }
}
okay... we are adding a new object that we want to which we want to assign an order number... we already have an order number on the opportunity object, and we do not want duplicate order numbers between the 2 objects.

i have created a 3rd object, Order_number and written a simple trigger & class to get the next order number... it works in test when I add records individually, but when I run a test class i receive the following error:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, getOrdNum: execution of BeforeInsert

caused by: System.QueryException: List has no rows for assignment to SObject

Class.orderNumber.getOrderNumber: line 5, column 1
Trigger.getOrdNum: line 4, column 1: []

here is the trigger & class...

any help at all would be greatly appreciated!
trigger getOrdNum on Opportunity (before insert) {

    for (Opportunity o : Trigger.new){
       o.Test_SF_Ord_Num__c = orderNumber.getOrderNumber();
    }
}

--------------------------------------------------
public class orderNumber {

   public static decimal getOrderNumber(){
  
      Order_Number__c orderNum = [SELECT Order_Num__c FROM Order_Number__c WHERE Name = 'ORDER'];
   
      orderNum.Order_Num__c += 1;
     
      update orderNum;
   
      return orderNum.Order_Num__c;

   }
}

 
In my opportunity, I have fields where they can schedule machines for jobs.  The machine is a custom object that has a maximum qty that can be scheduled in a rolling 9 day period.  I'm trying to keep them from over scheduling the machine so I need to select all opportunities in the 9 day range that are still open and are scheduled on the same machine as the new opportunity. 

I've written the below trigger, but I don't know how to format the List or Map to get the collection of Opportunities I need - I get an error, Error: Compile Error: expecting a colon, found 'o.Mfg_Machine__c' at line 28 column 66 (I've bolded the offending List statement below).

Any help would be greatly appreciated!

trigger oppMachineSchd on Opportunity (before update, before insert) {

   Map<Opportunity> oppMfgNew = new Map<id,Opportunity>();
   List<Opportunity> oppsOnMachine = new List<Opportunity>();
   Set<Id> machId = new Set<Id>();

   for (Opportunity opp:System.Trigger.new){
      if (opp.isWon && opp.Manufacturing_Due_Date_F__c != null && Manufacturing_Complete_D__c == null){
         system.debug('in new: ' + opp.Machine__c + ' ' + opp.Manufacturing_Due_Date_F__c);
         oppMfgNew.add(opp);  
         machId.add(opp.Mfg_Machine__c);
      }
   }
   
   if (OppMfgNew.size() > 0){
      Map<Id, Machine__c> mach = new Map<Id, Machine__c>(
        [SELECT Id, Name, Max_7_Day_Qty__c 
           FROM Machine__c 
           WHERE id in :machId]);

// get all open             
      for (Opportunity o:oppMfgNew){
         BeginDate = o.Manufacturing_Due_Date_F__c.addDays(-9);
         system.debug('working on: ' + o.Name + ' ' + o.Manufacturing_Due_Date_F__c + ' ' + BeginDate);
         List<Opportunity> oppsOnMachine = [SELECT Name, Mfg_Machine__c, Manufacturing_Due_Date_F__c, Quantity__c
                                           FROM Opportunity 
                                           WHERE Mfg_Machine__c = o.Mfg_Machine__c AND Manufacturing_Complete_D__c = null AND Manufacturing_Due_Date_F__c >= BeginDate 
                                                 AND Manufacturing_Due_Date_F__c <= o.Manufacturing_Due_Date_F__c]; 
        

         for (Opportunity oom:oppsOnMachine){
            system.debug('oom: ' + Name + ' ' + oom.Mfg_Machine__c + ' ' + oom.Quantity__c);
            totQty += oom.Quantity__c;
         }
        
         totQty += o.Quantity__c;
         Machine__c mQty = mach.get(o.Machine__c);
         if (totQty > mQty.Max_7_Day_Qty__c){
            o.addError('Machine is overscheduled; Please select a later date');
         }
      }
   }
}       
 
I've created a custom clone button set to execute JavaScript, but for some reason when i try to set a field to value of the original CloseDate, I receive an "undefined" error...as you can see in the code i am trying to set Previous_Order_Date__c to CloseDate, but receive the undefined error.. when i set it to new Date(), it's fine... not sure what to try... thanks much for any help...
 
try{ 

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} 

// ** EDIT THIS QUERY TO LIST THE FIELDS YOU WANT TO COPY ** 

var result = sforce.connection.query("Select o.StageName, o.AccountId, o.Adhesive_Seal__c, o.Priced_Per__c, o.Adjustable_Die__c, o.CloseDate, o.Artwork_Furnished_Via__c, o.Back_PMS_1__c, o.Back_PMS_2__c, o.Back_PMS_3__c, o.Back_PMS_4__c, o.Black_Back__c, o.Black_Front__c, o.Box__c, o.Carton__c, o.Cost_M__c, o.Cut_Sheets_To__c, o.DPE_Inventory__c, o.Envelope_Die_New__c, o.Envelope_Height_inches__c, o.Envelope_Style__c, o.Envelope_Width_inches__c, o.Film__c, o.Flap_Style__c, o.Flexo__c, o.Outside_PMS_1__c, o.Outside_PMS_2__c, o.Form__c, o.Front_PMS_1__c, o.Front_PMS_2__c, o.Front_PMS_3__c, o.Front_PMS_4__c, o.Grain__c, o.Internal_Notes_Materials_Etc__c, o.No_of_Bleeds_Back__c, o.No_of_Bleeds_Front__c, o.No_of_Colors_Back__c, o.No_of_Colors_Front__c, o.No_of_Negatives__c, o.No_of_PMS__c, o.No_of_Shipments__c, o.No_of_Total_Jobs__c, o.Number_Out__c, o.Offset__c, o.Other_Die_Specify__c, o.Other_Envelope_Style_Specify__c, o.Other_Packaging__c, o.Other_Paper_Weight_Specify__c, o.Packaging__c, o.Paper_Stock_Description__c, o.Paper_Type__c, o.Paper_Weight__c, o.Print_Stock_Desc_Free_Form__c, o.Print_Stock_Source__c, o.Standard_Product__c, o.Qty_per_Box__c, o.Qty_per_Carton__c, o.Stock_Source_Product__c, o.Stock_Source_Desc_Free_Form__c, o.Stock_Source__c, o.Run_Factor__c, o.Sample__c, o.Security_Tint__c,o.SheetSize__c, o.Special_Instructions__c, o.Special_Instructions_Prt__c, o.Split_Bill__c, o.Stacking_Instructions__c, o.Tint_PMS__c, o.Custom_Tint_Description__c, o.Window_1_Orientation__c, o.Window_Die__c, o.Window_Die_Sublist__c, o.Window_1_Distance_from_Bottom__c, o.Window_1_Distance_from_Left__c, o.Window_1_Height__c, o.Other_Window_Die_Specify__c, o.Window_1_Width__c, o.Window_2_Orientation__c, o.Window_2_Die__c, o.Window_2_Die_Sublist__c, o.Window_2_Distance_from_Bottom__c, o.Window_2_Distance_from_Left__c, o.Window_2_Height__c, o.Window_2_Other_Die_Specify__c, o.Window_2_Width__c, o.Exact_Repeat__c, Customer_Ship_To__c, Shipping_Street__c, Shipping_City__c, Shipping_State__c, Shipping_Zip_Postal_Code__c, Freight_Zip_Code__c, Delivery_Route__c, Will_Call__c, Ship__c From Opportunity o WHERE o.Id = '{!Opportunity.Id}'"); 

var newOpp = result.getArray("records"); 
var recType = sforce.connection.query("select name, id from recordtype where name='Print & Mfg Quote - Rate'"); 
var records = recType.getArray("records"); 
var user = sforce.connection.getUserInfo(); 

// Reset the Opp Id and reset fields to default values 

newOpp[0].Id = ''; 

// ** EDIT THESE FIELDS TO SET DEFAULT ANY VALUES ** 
newOpp[0].Name = "{!Opportunity.Name}"; 
newOpp[0].CloseDate = new Date(); 
newOpp[0].StageName ="Quote Sent"; 
newOpp[0].Cloned_From__c = "{!Opportunity.SF_Order_Number__c}"; 
newOpp[0].Quoted_By__c = sforce.connection.getUserInfo().userId; 
newOpp[0].Clone_Check__c=true; 
newOpp[0].Previous_Order__c = "{!Opportunity.SF_Order_Number__c}"; 
//newOpp[0].Previous_Order_Date__c = "{!Opportunity.CloseDate}"; 
newOpp[0].Previous_Order_Date__c = new Date(); 
newOpp[0].Exact_Repeat__c=true; 
newOpp[0].RecordTypeId='012C0000000MTQG'; 

var saveResult = sforce.connection.create(newOpp); 

if (saveResult[0].getBoolean("success")) { 
newOpp[0].id = saveResult[0].id; 
alert("*** Quote Created ***"); 
} 
else { 
alert("*** Failed to create Quote: " + saveResult[0]); 
} 

// Refresh the page to display the new oppportunity 
window.location = newOpp[0].id; 
} 
catch (err) { 
alert (err.description ); 
}

 
again, i think i have some things regarding sObjects, methods, classes etc, figured out and apparently I don't... i have one class that loops through a sObject list, and based on criteria, will return the one record i need....  i receive the following error:

Error: Compile Error: Illegal assignment from SObject to SOBJECT:Mfg_Run_Charges_Rate__c at line 38 column 7

CLASS THAT RETURNS RECORD:

public class mfgRunChgRateRec{

   public static sObject getMfgRunChgRateRec(boolean noWin,
                                             boolean punchWin,
                                             boolean stdWin,
                                             boolean spcWin,
                                             boolean dblWin,
                                             boolean furnBlank,
                                             boolean furnPrePrint,
                                             string priceCode,
                                             List<Mfg_Run_Charges_Rate__c> mfgRCR){
                  
      Mfg_Run_Charges_Rate__c mrcrRec = new Mfg_run_Charges_Rate__c();           
     
      for (Mfg_Run_Charges_Rate__c M : mfgRCR){
         if (M.Pricing_Code__c == priceCode){
            if (noWin){
               if (furnBlank){
                  if (M.Window__c == 'N/A' && (M.Furnished__c == 'Blank' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else if (furnPrePrint){
                  if (M.Window__c == 'N/A' && (M.Furnished__c == 'PrePrint' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else{
                  if (M.Window__c == 'N/A' && M.Furnished__c == 'N/A'){
                     mrcrRec = M;
                     break;
                    }
                  }
            } else if (stdWin){
               if (furnBlank){
                  if (M.Window__c == 'Standard Window' && (M.Furnished__c == 'Blank' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else if (furnPrePrint){
                  if (M.Window__c == 'Standard Window' && (M.Furnished__c == 'PrePrint' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else{
                  if (M.Window__c == 'Standard Window' && M.Furnished__c == 'N/A'){
                     mrcrRec = M;
                     break;
                  }
               }
            }
         }
      }
      return mrcrRec;
   }
}
------------------------------------
CLASS THAT RECEIVES COMPILE ERROR WHEN USING THE ABOVE CLASS:
public class MOChargeRate{

   public static decimal[] getMOChargeR(boolean noWin,
                                        boolean stdWin,
                                        boolean spcWin,
                                        boolean MOWinDie,
                                        boolean punchWin,
                                        boolean dblWin,
                                        boolean furnBlank,
                                        boolean furnPrePrint,
                                        decimal wrkPerMQty,
                                        decimal wrkQty,
                                        List<Mfg_Run_Charges_Rate__c> mfgRCR){

      decimal[] MOCharge = new decimal[]{0,0};
      decimal punchChgAmt = 0.0;
      decimal winP = 0;
      decimal furnP = 0;
      decimal smallQtyP = 0;
      decimal sizeP = 0;
      decimal runQty = 0;
      decimal runRate = 0;
      decimal setUp = 0;
      decimal basicRun = 0;
      string priceCode;
      Mfg_Run_Charges_Rate__c MO = new Mfg_Run_Charges_Rate__c();
     
      system.debug('**MO params: ' + noWin + ' ' + MOWinDie + ' ' + punchWin  + ' ' +
                   dblWin + ' ' + furnBlank + ' ' + furnPrePrint + ' ' + wrkPerMQty + ' ' +
                   wrkQty);
                  
      if (wrkQty < 50000){
         priceCode = 'MO';
      }else{
         priceCode = 'MO-50M';
      }
     
      MO = mfgRunChgRateRec.getMfgRunChgRateRec(noWin, punchWin, stdWin, spcWin,
                                                dblWin, furnBlank, furnPrePrint,
                                                priceCode, mfgRCR);
      runQty = MO.Run_Qty__c;
      runRate = MO.Run_Rate__c;
      setUp = MO.Set_Up__c;
      winP = MO.Window_Penalty__c;
      sizeP = MO.Size_Penalty__c;

      if (furnBlank){
         furnP = furnBlankPenalty.getFurnBlankPenalty(wrkQty, MO);
      }else{
         furnP = furnPrePrintPenalty.getFurnPrePrintPenalty(wrkQty, MO);
      }
     
      if (wrkQty < 50000){
        smallQtyP = smallQtyPenalty.getSmallQtyPenalty(wrkQty, MO);
      }

      basicRun = (setUp/wrkPerMQty) + (runRate/(runQty/1000));
      smallQtyP *= basicRun;
      winP *= basicRun;
      sizeP *= basicRun;
      furnP *= basicRun;
      MOCharge[0] = (basicRun + sizeP + smallQtyP + winP) * wrkPerMQty;
      MOCharge[1] = furnP * wrkPerMQty;
      return MOCharge;
   }
}

thank you in advance for any help.
i get the below error when i try saving CLASS 1 below...the second class that is the problem is also below. I obviously don't understand objects or apex well, so any help would be greatly apprciated...

Error: Compile Error: Method does not exist or incorrect signature: [Decimal].getSmallQtyPenalty(Decimal, SOBJECT:Mfg_Run_Charges_Rate__c) at line 27 column 42

CLASS 1:

public class MOChargeRate{

public static decimal getMOChargeR(boolean noWin, boolean MOWinDie, boolean punchWin, boolean dblWin, boolean furnBlank, boolean furnPrePrint, decimal wrkPerMQty, decimal wrkQty, List mfgRCR){

  decimal MOCharge = 0.0;
  decimal punchChgAmt = 0.0;
  decimal winPenalty = 1;
  decimal punchUpchg = 0;
  decimal furnPenalty = 1;
  decimal smallQtyPenalty = 1;

  for (Mfg_Run_Charges_Rate__c MO : mfgRCR){
     if (wrkQty < 50000){
         if (MO.Pricing_Code__c == 'MO'){
           if (MOWinDie){
              if (furnBlank){
                 if (MO.Window__c == 'Special Window' &2& (MO.Furnished__c == 'Blank' || MO.Furnished__c == 'Both')){
                    smallQtyPenalty =smallQtyPenalty.getSmallQtyPenalty(wrkQty, MO );
                    winPenalty = MO.Window_Penalty__c;
                    break;
             }
           }
        }
     }
   }
  }
  return MOCharge;
)

SECOND CLASS:

public class smallQtyPenalty{

public static decimal getSmallQtyPenalty(decimal qty, Mfg_Run_Charges_Rate__c m){

  decimal smQtyPnlty;
  if (qty >= m.Small_Qty_1_Min__c && qty <= m.Small_Qty_1_Max__c){
     smQtyPnlty = m.Small_Qty_1_Penalty__c;
  } else if (qty >= m.Small_Qty_2_Min__c && qty <= m.Small_Qty_2_Max__c){
     smQtyPnlty = m.Small_Qty_2_Penalty__c;
  } else if (qty >= m.Small_Qty_3_Min__c && qty <= m.Small_Qty_3_Max__c){
     smQtyPnlty = m.Small_Qty_3_Penalty__c;
  } else if (qty >= m.Small_Qty_4_Min__c && qty <= m.Small_Qty_4_Max__c){
     smQtyPnlty = m.Small_Qty_4_Penalty__c;
  }
  return smQtyPnlty;
} }
I have a trigger on opportunity that update fields based on another object.  I want to be able to refire trigger against several opportuntity records at will... I really don't know where to start, but it seems as if it should be easy to send select a group of opportunity records and basically resave them.

hopefully this makes sense and any help would be greatly appreciated

this should be so simple, but as i'm not any kind of OOP developer, and do not know java, c++ and/or apex, i have no idea what the issue might be... i get Compile Error: Invalid type; baseMOCharge at line 27....

 

any help is greatly appreciated.

public class MOCharge{

   public static decimal[] getMOCharge(boolean stdWin, 
                                       boolean spcWin, 
                                       boolean dblWin,
                                       boolean noWin,
                                       boolean MOWinDie,
                                       decimal wrkPerMQty,
                                       decimal wrkQty,
                                       decimal closureCharge,
                                       List<Mfg_Run_Charges__c> mrcRC1){

      decimal[] charges = new decimal[]{0,0};
      decimal baseMOCharge = 0.0;
      
      for(Mfg_Run_Charges__c MO : mrcRC1) {
         if (MO.Process_Code__c=='MO' && MO.Min_Qty__c <=wrkQty && MO.Max_Qty__c >=wrkQty){
            baseMOCharge = (MO.Set_Up_Cost__c / WrkPerMQty) + (MO.Run_Rate__c / (MO.Qty_per_Hour__c / 1000) );
            if ((noWin) || (stdWin && MOWinDie)){
               charges[0] = baseMOCharge + closureCharge;
            }else{
               if (dblWin){
                  if (!MOWinDie){
/// BELOW LINE IS WHERE THE INVALID TYPE ERROR OCCURS....
                     charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty); 
                     charges[1] = MO.Miscellaneous_Charge__c;
                  }else{
                     charges[0] = (((baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty))+ ClosureCharge) * MO.Special_Window__c; 
                  }
               }else{
                  if (SpcWin){
                     if (!MOWinDie){
                        charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty) + ClosureCharge; 
                        system.debug('SpcWin - No MO Die: ' + charges[0] + ', ' + MO.Per_M_Charge__c + ', ' + MO.Punch_Patch_Setup__c + ', ' + MO.Punch_Patch_M__c);
                     }else{
                        system.debug('before charges[0]: ' + charges[0]);
                        charges[0] = ((baseMOCharge) + ClosureCharge ) * MO.Special_Window__c;
                        system.debug('wtf??? charges[0],ClsrChg,MO.SpclWin,: ' + charges[0] + ', ' + closureCharge + ', ' + MO.Special_Window__c);
                     }
                  }else{
                        charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty); 
                  }    
               }
            }
         break;
         }
      }
    return charges;
    }
 }

 

while this trigger works on individual records, bulk processing processes all new records instead of the intended records... i've tried several different ways to change this, but am failing miserably... any help would be greatly appreciated... i know the issue is the second "for (Opportunity o: System.Trigger.new)"... but I don't know what the format should be...

 

anyways, thanks for any help!

 

Trigger mfgPriceQuote on Opportunity (before insert, before update) {

// only update 'Print & Mfg Quote' records

  Id recId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print & Mfg Quote').getRecordTypeId();
  Id recId2 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print Quote').getRecordTypeId();
  system.debug('redId: ' + recId + '    recId2:  ' + recId2);

//set up maps for mfg run charges... 

  Map<Id, Opportunity> oppQuotes = new Map<Id,Opportunity>();
  
  for (Opportunity opp: System.Trigger.new){
     if (opp.RecordTypeId == recId || opp.RecordTypeId == recId2){
         if (opp.Stock_Source__c != null) {
            if (opp.Number_Out__c == null || opp.Number_Out__c == 0){
               opp.addError(' Number Out must be greater than Zero for Manufacturing Quote - Please ReEnter');
            }else{
               if (opp.StageName.contains('Lost')){
                  system.debug('*** in should be Lost: ' + opp.StageName);
                  continue;
               }else{
                  oppQuotes.put(opp.id,opp);
               }
            }
        }else{
           opp.Mfg_Run_Price_1__c = 0.00;
           opp.Mfg_Size_Penalty_1__c = 0.00;
           opp.Other_Charges_1__c = 0.00;
           opp.Tinting_Charges_1__c = 0.00;
           opp.Mfg_Stock_Price_1__c = 0.00; 
        }
     }
  }
  
  if (oppQuotes.size() > 0){
  
     List<Mfg_Run_Charges__c> mrcRC = new List<Mfg_Run_Charges__c>
        ([SELECT Process_Code__c,
               X10_Reg__c,X10_Spcl_Win__c,X10_Std_Win__c,Double_Window__c,Max_Qty__c,Min_Qty__c,
               Non_10_Reg__c,Non_10_Spcl_Win__c,Non_10_Std_Win__c,Size_Penalty_Announcement__c,Size_Penalty_Announcement_M__c,
               Size_Penalty_Large__c,Size_Penalty_Small__c,Special_Window__c,Furnished_Penalty__c,Furnished_Penalty_PrePrin__c,
               Per_M_Charge__c, X14_and_Smaller_M_charge__c,Punch_Patch_Setup__c, Punch_Patch_M__c, Setup_Charge__c,
               Tint_9_and_Smaller__c, Tint_10_and_Larger__c, Miscellaneous_Charge__c
          FROM  Mfg_Run_Charges__c]);

     Map<Id,Envelope_Die__c> env = new Map<Id,Envelope_Die__c>();
  
     for(Envelope_Die__c ed : [SELECT id, X10_Commercial_Flap__c,X14_and_Smaller__c,
                                      X9_and_Smaller__c,Commercial_Size__c,Name,OE_214__c,
                                      OE_57__c,OS_658__c,OS_34__c,OS_534__c,Smaller_than_614__c
                               FROM Envelope_Die__c]){ 
        env.put(ed.id,ed);
     }
     
//****  I KNOW THIS IS MY ISSUE, BUT DON'T KNOW HOW TO FORMAT PROPERLY
     for (Opportunity o: System.Trigger.new){
        boolean mfgEnvYes = false;
        if (o.Envelope_Die_New__c != null){
            mfgEnvYes = true;
        }
        o.Mfg_Run_Price_1__c = 0.00;
        o.Mfg_Size_Penalty_1__c = 0.00;
        o.Other_Charges_1__c = 0.00;
        o.Tinting_Charges_1__c = 0.00;
        o.Mfg_Stock_Price_1__c = 0.00;  
.
.
.
}

 

i've reached the field limit on the opportunity object... does anyone have any suggestions?  my coding skills are limited, and i'm thinking i will have to use a custom object, and visualforce?  not sure that's best, and i'm trying to avoid having to learn visualforce, as i'm not very knowledgeable in html, css or javascript...

 

anyways, any suggestions would be greatly appreciated.......

i'm trying to update an opportunity record based on a custom field, order number, that is unique, but defined as a formula field.

 

i have a trigger that creates a keyset and then does a for loop selecting records that match the order number, so it potentially accesses all records... i'm approaching governor limits due to the number of opportunity records...

 

is there a way to define a field as a "key" so not all records will have to be accessed?  will a unique id field work?

 

thanks very much for any input.

while my tag is not "newbie" any longer, i am not a developer... in particular, not an apex, java or any OOP developer so am greatly in need of advice (most of the time!!).... 

 

anyways, i have a custom object, RunCharges, that contains 230 records.  depending on value of some fields on custom object, i need to access up to 5 of these records and associated values in a trigger, potentially up to 20 times... 

 

is it more efficient to do create a LIST, perform one SELECT for all records and iterate thru this list up to 20 times, or to do a SELECT statement with the specific criteria, i.e. process and qty range (causing a potential of 20 SELECT statements)??

 

or, i could do 5 SELECT statements for each type of process, and iterate through the 20 or so records until i find my quantity range? 

 

any advice is more than welcoome... thanks very much.

i have a page rendered as PDF... i'm trying to use the value of one custom field based on the value of another custom field.. here's what i have:

 

<td align="center" width="150" class="text9" ><apex:outputField rendered="{!NOT(ISNULL(Opportunity.Jet_0_Due_Date__c))}" value="{!Opportunity.Jet_0_Due_Date__c}" /></td>

 

<td align="center" width="150" class="text9" ><apex:outputField rendered="{!ISNULL (Opportunity.Jet_0_Due_Date__c)}" value="{!Opportunity.Printing_Due_Date_F__c}" /></td>

 

basically, i want the value of Printing_Due_Date_F__c to print if there is no value in Jet_0_Due_Date__c... it works except my fonts are not working properly...i think because i have the 2 fields in the same position... if there is not a value in Jet_0_Due_Date, everything looks good, but if there is a value, the field appears in very small font... any help would be greatly appreciated.

i have a text field that i'm trying to convert to numeric.. it is a window size field that includes height and width...

 

example:  

 

window:  1/2 X 1 5/8

  convert to:  

height:     .5

width:1.625

 

i'm not really a coder, and i'm trying to use the .split method,  which works to divide the height and width, but once divided, i may have a whole number with no fraction, a whole number with a fraction or a fraction only.... i guess i could use split again, but not sure if this is the best way....

 

any help would be appreciated!

i have a custom object, mfg cost, that has 80 records... each record has a process, min qty, max qty and cost.... to calculate the mfg cost, several records must be retrieved for the various processes required.... this mfg cost is a custom field on the opportunity that i want to populate with trigger prior to insert or update...

 

i don't understand lists, sets, etc very well, and am concerned that if i do a select for each process type, i will run into govern limits....

 

a couple of example records in custom object:

 

PROCESS      MIN QTY    MAX QTY     COST

LO                    1                    499               3.50

LO                   500                999               3.00

TN                   1                     499               1.50

TN                    500               750                1.30

 

etc..... in one example, i may need to get the cost from record 1 and 3, and in another, 2 and 4.... anyways, currently, i am doing 2 different selects rather than doing a list or set (again, i don't really understand how to utilize them)...

 

any suggestions would be greatly appreciated....thanks much in advance.

i'm no apex, html or SF expert, and i'm trying to modify an existing visualforce page that prints a job ticket from the opportunity object.  it currently prints in an 8 1/2 x 11 format, but i would like to increase this to 9 x 12... i've tried a couple of things, but don't know if i'm stepping on myself, or if what i've tried doesn't work... any help would be GREATLY appreciated!!!  thanks much....

what i've tried:
1.  setting all margins to 0 to gain a little additional space:

body {
    font-family: Arial, Helvetica, sans-serif;
    margin-left: 0px;
    margin-right: 0px;
    margin-top:0;
    margin-bottom:0;
}
______________________________
2.  using @page:
@page {
  size: 23cm 28cm;
}

______________________________

i'm at a loss... thanks again....

i'm a tad new to SF, and am attempting to export report detail into csv file without header line or footer info, just the actual detail data.  Is there an easy way to do this?

 

Thanks very much.

 

Cathy 

okay... we are adding a new object that we want to which we want to assign an order number... we already have an order number on the opportunity object, and we do not want duplicate order numbers between the 2 objects.

i have created a 3rd object, Order_number and written a simple trigger & class to get the next order number... it works in test when I add records individually, but when I run a test class i receive the following error:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, getOrdNum: execution of BeforeInsert

caused by: System.QueryException: List has no rows for assignment to SObject

Class.orderNumber.getOrderNumber: line 5, column 1
Trigger.getOrdNum: line 4, column 1: []

here is the trigger & class...

any help at all would be greatly appreciated!
trigger getOrdNum on Opportunity (before insert) {

    for (Opportunity o : Trigger.new){
       o.Test_SF_Ord_Num__c = orderNumber.getOrderNumber();
    }
}

--------------------------------------------------
public class orderNumber {

   public static decimal getOrderNumber(){
  
      Order_Number__c orderNum = [SELECT Order_Num__c FROM Order_Number__c WHERE Name = 'ORDER'];
   
      orderNum.Order_Num__c += 1;
     
      update orderNum;
   
      return orderNum.Order_Num__c;

   }
}

 
In my opportunity, I have fields where they can schedule machines for jobs.  The machine is a custom object that has a maximum qty that can be scheduled in a rolling 9 day period.  I'm trying to keep them from over scheduling the machine so I need to select all opportunities in the 9 day range that are still open and are scheduled on the same machine as the new opportunity. 

I've written the below trigger, but I don't know how to format the List or Map to get the collection of Opportunities I need - I get an error, Error: Compile Error: expecting a colon, found 'o.Mfg_Machine__c' at line 28 column 66 (I've bolded the offending List statement below).

Any help would be greatly appreciated!

trigger oppMachineSchd on Opportunity (before update, before insert) {

   Map<Opportunity> oppMfgNew = new Map<id,Opportunity>();
   List<Opportunity> oppsOnMachine = new List<Opportunity>();
   Set<Id> machId = new Set<Id>();

   for (Opportunity opp:System.Trigger.new){
      if (opp.isWon && opp.Manufacturing_Due_Date_F__c != null && Manufacturing_Complete_D__c == null){
         system.debug('in new: ' + opp.Machine__c + ' ' + opp.Manufacturing_Due_Date_F__c);
         oppMfgNew.add(opp);  
         machId.add(opp.Mfg_Machine__c);
      }
   }
   
   if (OppMfgNew.size() > 0){
      Map<Id, Machine__c> mach = new Map<Id, Machine__c>(
        [SELECT Id, Name, Max_7_Day_Qty__c 
           FROM Machine__c 
           WHERE id in :machId]);

// get all open             
      for (Opportunity o:oppMfgNew){
         BeginDate = o.Manufacturing_Due_Date_F__c.addDays(-9);
         system.debug('working on: ' + o.Name + ' ' + o.Manufacturing_Due_Date_F__c + ' ' + BeginDate);
         List<Opportunity> oppsOnMachine = [SELECT Name, Mfg_Machine__c, Manufacturing_Due_Date_F__c, Quantity__c
                                           FROM Opportunity 
                                           WHERE Mfg_Machine__c = o.Mfg_Machine__c AND Manufacturing_Complete_D__c = null AND Manufacturing_Due_Date_F__c >= BeginDate 
                                                 AND Manufacturing_Due_Date_F__c <= o.Manufacturing_Due_Date_F__c]; 
        

         for (Opportunity oom:oppsOnMachine){
            system.debug('oom: ' + Name + ' ' + oom.Mfg_Machine__c + ' ' + oom.Quantity__c);
            totQty += oom.Quantity__c;
         }
        
         totQty += o.Quantity__c;
         Machine__c mQty = mach.get(o.Machine__c);
         if (totQty > mQty.Max_7_Day_Qty__c){
            o.addError('Machine is overscheduled; Please select a later date');
         }
      }
   }
}       
 
again, i think i have some things regarding sObjects, methods, classes etc, figured out and apparently I don't... i have one class that loops through a sObject list, and based on criteria, will return the one record i need....  i receive the following error:

Error: Compile Error: Illegal assignment from SObject to SOBJECT:Mfg_Run_Charges_Rate__c at line 38 column 7

CLASS THAT RETURNS RECORD:

public class mfgRunChgRateRec{

   public static sObject getMfgRunChgRateRec(boolean noWin,
                                             boolean punchWin,
                                             boolean stdWin,
                                             boolean spcWin,
                                             boolean dblWin,
                                             boolean furnBlank,
                                             boolean furnPrePrint,
                                             string priceCode,
                                             List<Mfg_Run_Charges_Rate__c> mfgRCR){
                  
      Mfg_Run_Charges_Rate__c mrcrRec = new Mfg_run_Charges_Rate__c();           
     
      for (Mfg_Run_Charges_Rate__c M : mfgRCR){
         if (M.Pricing_Code__c == priceCode){
            if (noWin){
               if (furnBlank){
                  if (M.Window__c == 'N/A' && (M.Furnished__c == 'Blank' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else if (furnPrePrint){
                  if (M.Window__c == 'N/A' && (M.Furnished__c == 'PrePrint' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else{
                  if (M.Window__c == 'N/A' && M.Furnished__c == 'N/A'){
                     mrcrRec = M;
                     break;
                    }
                  }
            } else if (stdWin){
               if (furnBlank){
                  if (M.Window__c == 'Standard Window' && (M.Furnished__c == 'Blank' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else if (furnPrePrint){
                  if (M.Window__c == 'Standard Window' && (M.Furnished__c == 'PrePrint' || M.Furnished__c == 'Both')){
                     mrcrRec = M;
                     break;
                  }
               } else{
                  if (M.Window__c == 'Standard Window' && M.Furnished__c == 'N/A'){
                     mrcrRec = M;
                     break;
                  }
               }
            }
         }
      }
      return mrcrRec;
   }
}
------------------------------------
CLASS THAT RECEIVES COMPILE ERROR WHEN USING THE ABOVE CLASS:
public class MOChargeRate{

   public static decimal[] getMOChargeR(boolean noWin,
                                        boolean stdWin,
                                        boolean spcWin,
                                        boolean MOWinDie,
                                        boolean punchWin,
                                        boolean dblWin,
                                        boolean furnBlank,
                                        boolean furnPrePrint,
                                        decimal wrkPerMQty,
                                        decimal wrkQty,
                                        List<Mfg_Run_Charges_Rate__c> mfgRCR){

      decimal[] MOCharge = new decimal[]{0,0};
      decimal punchChgAmt = 0.0;
      decimal winP = 0;
      decimal furnP = 0;
      decimal smallQtyP = 0;
      decimal sizeP = 0;
      decimal runQty = 0;
      decimal runRate = 0;
      decimal setUp = 0;
      decimal basicRun = 0;
      string priceCode;
      Mfg_Run_Charges_Rate__c MO = new Mfg_Run_Charges_Rate__c();
     
      system.debug('**MO params: ' + noWin + ' ' + MOWinDie + ' ' + punchWin  + ' ' +
                   dblWin + ' ' + furnBlank + ' ' + furnPrePrint + ' ' + wrkPerMQty + ' ' +
                   wrkQty);
                  
      if (wrkQty < 50000){
         priceCode = 'MO';
      }else{
         priceCode = 'MO-50M';
      }
     
      MO = mfgRunChgRateRec.getMfgRunChgRateRec(noWin, punchWin, stdWin, spcWin,
                                                dblWin, furnBlank, furnPrePrint,
                                                priceCode, mfgRCR);
      runQty = MO.Run_Qty__c;
      runRate = MO.Run_Rate__c;
      setUp = MO.Set_Up__c;
      winP = MO.Window_Penalty__c;
      sizeP = MO.Size_Penalty__c;

      if (furnBlank){
         furnP = furnBlankPenalty.getFurnBlankPenalty(wrkQty, MO);
      }else{
         furnP = furnPrePrintPenalty.getFurnPrePrintPenalty(wrkQty, MO);
      }
     
      if (wrkQty < 50000){
        smallQtyP = smallQtyPenalty.getSmallQtyPenalty(wrkQty, MO);
      }

      basicRun = (setUp/wrkPerMQty) + (runRate/(runQty/1000));
      smallQtyP *= basicRun;
      winP *= basicRun;
      sizeP *= basicRun;
      furnP *= basicRun;
      MOCharge[0] = (basicRun + sizeP + smallQtyP + winP) * wrkPerMQty;
      MOCharge[1] = furnP * wrkPerMQty;
      return MOCharge;
   }
}

thank you in advance for any help.
i get the below error when i try saving CLASS 1 below...the second class that is the problem is also below. I obviously don't understand objects or apex well, so any help would be greatly apprciated...

Error: Compile Error: Method does not exist or incorrect signature: [Decimal].getSmallQtyPenalty(Decimal, SOBJECT:Mfg_Run_Charges_Rate__c) at line 27 column 42

CLASS 1:

public class MOChargeRate{

public static decimal getMOChargeR(boolean noWin, boolean MOWinDie, boolean punchWin, boolean dblWin, boolean furnBlank, boolean furnPrePrint, decimal wrkPerMQty, decimal wrkQty, List mfgRCR){

  decimal MOCharge = 0.0;
  decimal punchChgAmt = 0.0;
  decimal winPenalty = 1;
  decimal punchUpchg = 0;
  decimal furnPenalty = 1;
  decimal smallQtyPenalty = 1;

  for (Mfg_Run_Charges_Rate__c MO : mfgRCR){
     if (wrkQty < 50000){
         if (MO.Pricing_Code__c == 'MO'){
           if (MOWinDie){
              if (furnBlank){
                 if (MO.Window__c == 'Special Window' &2& (MO.Furnished__c == 'Blank' || MO.Furnished__c == 'Both')){
                    smallQtyPenalty =smallQtyPenalty.getSmallQtyPenalty(wrkQty, MO );
                    winPenalty = MO.Window_Penalty__c;
                    break;
             }
           }
        }
     }
   }
  }
  return MOCharge;
)

SECOND CLASS:

public class smallQtyPenalty{

public static decimal getSmallQtyPenalty(decimal qty, Mfg_Run_Charges_Rate__c m){

  decimal smQtyPnlty;
  if (qty >= m.Small_Qty_1_Min__c && qty <= m.Small_Qty_1_Max__c){
     smQtyPnlty = m.Small_Qty_1_Penalty__c;
  } else if (qty >= m.Small_Qty_2_Min__c && qty <= m.Small_Qty_2_Max__c){
     smQtyPnlty = m.Small_Qty_2_Penalty__c;
  } else if (qty >= m.Small_Qty_3_Min__c && qty <= m.Small_Qty_3_Max__c){
     smQtyPnlty = m.Small_Qty_3_Penalty__c;
  } else if (qty >= m.Small_Qty_4_Min__c && qty <= m.Small_Qty_4_Max__c){
     smQtyPnlty = m.Small_Qty_4_Penalty__c;
  }
  return smQtyPnlty;
} }
I have a trigger on opportunity that update fields based on another object.  I want to be able to refire trigger against several opportuntity records at will... I really don't know where to start, but it seems as if it should be easy to send select a group of opportunity records and basically resave them.

hopefully this makes sense and any help would be greatly appreciated

this should be so simple, but as i'm not any kind of OOP developer, and do not know java, c++ and/or apex, i have no idea what the issue might be... i get Compile Error: Invalid type; baseMOCharge at line 27....

 

any help is greatly appreciated.

public class MOCharge{

   public static decimal[] getMOCharge(boolean stdWin, 
                                       boolean spcWin, 
                                       boolean dblWin,
                                       boolean noWin,
                                       boolean MOWinDie,
                                       decimal wrkPerMQty,
                                       decimal wrkQty,
                                       decimal closureCharge,
                                       List<Mfg_Run_Charges__c> mrcRC1){

      decimal[] charges = new decimal[]{0,0};
      decimal baseMOCharge = 0.0;
      
      for(Mfg_Run_Charges__c MO : mrcRC1) {
         if (MO.Process_Code__c=='MO' && MO.Min_Qty__c <=wrkQty && MO.Max_Qty__c >=wrkQty){
            baseMOCharge = (MO.Set_Up_Cost__c / WrkPerMQty) + (MO.Run_Rate__c / (MO.Qty_per_Hour__c / 1000) );
            if ((noWin) || (stdWin && MOWinDie)){
               charges[0] = baseMOCharge + closureCharge;
            }else{
               if (dblWin){
                  if (!MOWinDie){
/// BELOW LINE IS WHERE THE INVALID TYPE ERROR OCCURS....
                     charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty); 
                     charges[1] = MO.Miscellaneous_Charge__c;
                  }else{
                     charges[0] = (((baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty))+ ClosureCharge) * MO.Special_Window__c; 
                  }
               }else{
                  if (SpcWin){
                     if (!MOWinDie){
                        charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty) + ClosureCharge; 
                        system.debug('SpcWin - No MO Die: ' + charges[0] + ', ' + MO.Per_M_Charge__c + ', ' + MO.Punch_Patch_Setup__c + ', ' + MO.Punch_Patch_M__c);
                     }else{
                        system.debug('before charges[0]: ' + charges[0]);
                        charges[0] = ((baseMOCharge) + ClosureCharge ) * MO.Special_Window__c;
                        system.debug('wtf??? charges[0],ClsrChg,MO.SpclWin,: ' + charges[0] + ', ' + closureCharge + ', ' + MO.Special_Window__c);
                     }
                  }else{
                        charges[0] = (baseMOCharge) + MO.Punch_Patch_Setup__c + (MO.Punch_Patch_M__c * WrkPerMQty); 
                  }    
               }
            }
         break;
         }
      }
    return charges;
    }
 }

 

while this trigger works on individual records, bulk processing processes all new records instead of the intended records... i've tried several different ways to change this, but am failing miserably... any help would be greatly appreciated... i know the issue is the second "for (Opportunity o: System.Trigger.new)"... but I don't know what the format should be...

 

anyways, thanks for any help!

 

Trigger mfgPriceQuote on Opportunity (before insert, before update) {

// only update 'Print & Mfg Quote' records

  Id recId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print & Mfg Quote').getRecordTypeId();
  Id recId2 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Print Quote').getRecordTypeId();
  system.debug('redId: ' + recId + '    recId2:  ' + recId2);

//set up maps for mfg run charges... 

  Map<Id, Opportunity> oppQuotes = new Map<Id,Opportunity>();
  
  for (Opportunity opp: System.Trigger.new){
     if (opp.RecordTypeId == recId || opp.RecordTypeId == recId2){
         if (opp.Stock_Source__c != null) {
            if (opp.Number_Out__c == null || opp.Number_Out__c == 0){
               opp.addError(' Number Out must be greater than Zero for Manufacturing Quote - Please ReEnter');
            }else{
               if (opp.StageName.contains('Lost')){
                  system.debug('*** in should be Lost: ' + opp.StageName);
                  continue;
               }else{
                  oppQuotes.put(opp.id,opp);
               }
            }
        }else{
           opp.Mfg_Run_Price_1__c = 0.00;
           opp.Mfg_Size_Penalty_1__c = 0.00;
           opp.Other_Charges_1__c = 0.00;
           opp.Tinting_Charges_1__c = 0.00;
           opp.Mfg_Stock_Price_1__c = 0.00; 
        }
     }
  }
  
  if (oppQuotes.size() > 0){
  
     List<Mfg_Run_Charges__c> mrcRC = new List<Mfg_Run_Charges__c>
        ([SELECT Process_Code__c,
               X10_Reg__c,X10_Spcl_Win__c,X10_Std_Win__c,Double_Window__c,Max_Qty__c,Min_Qty__c,
               Non_10_Reg__c,Non_10_Spcl_Win__c,Non_10_Std_Win__c,Size_Penalty_Announcement__c,Size_Penalty_Announcement_M__c,
               Size_Penalty_Large__c,Size_Penalty_Small__c,Special_Window__c,Furnished_Penalty__c,Furnished_Penalty_PrePrin__c,
               Per_M_Charge__c, X14_and_Smaller_M_charge__c,Punch_Patch_Setup__c, Punch_Patch_M__c, Setup_Charge__c,
               Tint_9_and_Smaller__c, Tint_10_and_Larger__c, Miscellaneous_Charge__c
          FROM  Mfg_Run_Charges__c]);

     Map<Id,Envelope_Die__c> env = new Map<Id,Envelope_Die__c>();
  
     for(Envelope_Die__c ed : [SELECT id, X10_Commercial_Flap__c,X14_and_Smaller__c,
                                      X9_and_Smaller__c,Commercial_Size__c,Name,OE_214__c,
                                      OE_57__c,OS_658__c,OS_34__c,OS_534__c,Smaller_than_614__c
                               FROM Envelope_Die__c]){ 
        env.put(ed.id,ed);
     }
     
//****  I KNOW THIS IS MY ISSUE, BUT DON'T KNOW HOW TO FORMAT PROPERLY
     for (Opportunity o: System.Trigger.new){
        boolean mfgEnvYes = false;
        if (o.Envelope_Die_New__c != null){
            mfgEnvYes = true;
        }
        o.Mfg_Run_Price_1__c = 0.00;
        o.Mfg_Size_Penalty_1__c = 0.00;
        o.Other_Charges_1__c = 0.00;
        o.Tinting_Charges_1__c = 0.00;
        o.Mfg_Stock_Price_1__c = 0.00;  
.
.
.
}

 

i've reached the field limit on the opportunity object... does anyone have any suggestions?  my coding skills are limited, and i'm thinking i will have to use a custom object, and visualforce?  not sure that's best, and i'm trying to avoid having to learn visualforce, as i'm not very knowledgeable in html, css or javascript...

 

anyways, any suggestions would be greatly appreciated.......

i'm trying to update an opportunity record based on a custom field, order number, that is unique, but defined as a formula field.

 

i have a trigger that creates a keyset and then does a for loop selecting records that match the order number, so it potentially accesses all records... i'm approaching governor limits due to the number of opportunity records...

 

is there a way to define a field as a "key" so not all records will have to be accessed?  will a unique id field work?

 

thanks very much for any input.

while my tag is not "newbie" any longer, i am not a developer... in particular, not an apex, java or any OOP developer so am greatly in need of advice (most of the time!!).... 

 

anyways, i have a custom object, RunCharges, that contains 230 records.  depending on value of some fields on custom object, i need to access up to 5 of these records and associated values in a trigger, potentially up to 20 times... 

 

is it more efficient to do create a LIST, perform one SELECT for all records and iterate thru this list up to 20 times, or to do a SELECT statement with the specific criteria, i.e. process and qty range (causing a potential of 20 SELECT statements)??

 

or, i could do 5 SELECT statements for each type of process, and iterate through the 20 or so records until i find my quantity range? 

 

any advice is more than welcoome... thanks very much.

i have a custom object, mfg cost, that has 80 records... each record has a process, min qty, max qty and cost.... to calculate the mfg cost, several records must be retrieved for the various processes required.... this mfg cost is a custom field on the opportunity that i want to populate with trigger prior to insert or update...

 

i don't understand lists, sets, etc very well, and am concerned that if i do a select for each process type, i will run into govern limits....

 

a couple of example records in custom object:

 

PROCESS      MIN QTY    MAX QTY     COST

LO                    1                    499               3.50

LO                   500                999               3.00

TN                   1                     499               1.50

TN                    500               750                1.30

 

etc..... in one example, i may need to get the cost from record 1 and 3, and in another, 2 and 4.... anyways, currently, i am doing 2 different selects rather than doing a list or set (again, i don't really understand how to utilize them)...

 

any suggestions would be greatly appreciated....thanks much in advance.

I have a custom object where the Detail view, edit, and new pages have all been overriden with visualforce pages. I need to be able to create/override a clone button that works like the standard clone button. So far I have only been able to override the clone button so that when it is clicked the record is created (new record inserted) then the page redirects to the edit page of the new record.

 

How do I make the clone work like the standard clone? In the standard clone when the clone button is clicked the user is redirected to an edit page where the record id in the url is the record you are trying to clone. After the user clicks save is when the new record gets "cloned"

 

Would I have to override the standard save behavior? Just for the clone page?

 

I can post the code I have completed so far if needed.

  • February 12, 2010
  • Like
  • 0