• kpeters
  • NEWBIE
  • 110 Points
  • Member since 2011

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 20
    Replies

The javascript code on a list button below no longer works in winter 12.

 

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

alert("hello");

 

 

Do you have similar issues?

Hi ,

 

I have a test class where i need to be able to create a quotelineitem.

 

Can someone please help me with the code to create a quotelineitem for a test class?

 

Thanks!

I am getting the above error message on a trigger. I have stripped the trigger way way down to make it easier to diagnose the problem.

 

Here is the complete trigger

 

 

trigger tryi on Contact (before update) {
    string gCode;
    string en;
    en='Segal';
    gCode=LEFT(en,2);
  }

 

and here is the complete error:

Error: Compile Error: Method does not exist or incorrect signature: LEFT(String, Integer) at line 5 column 11

 

But I know that LEFT exists, and I know that 'Segal' is a string, and I know that 2 is an integer. So what am I missing?

 

Thanks.

 

I'd like to re-open the discussion of SortOrder on the OpportunityLineItem object. A thread from 3.5 years ago can be located here:
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=3154

Looks like people from SF were going to look into it but obviously nothing has come to fruition. The reason I have put this in the Visualforce board is that we have have a few VF applications that could really take advantage of access to this field. Visualforce has also opened up new possibilities to UI design where the ability to manage SortOrder could be useful.

Also, no offense to salesforce.com, but the tool for sorting OpportunityLineItems is not that useful when there are multiple products with the same name. I have actually built a pretty slick sorting application but this is currently useless.

A lot of the concerns were about error handling. What happens if you have 3 line items but sort order is defined as, 1, 2, 2. Or 1, 2, 4. How about just throwing a sortOrder exception and force the developers to write good code?

Ideas? Thoughts?
http://ideas.salesforce.com/article/show/10092062/OpportunityLineItem_SortOrder_to_be_CreatableUpdatable

-Jason


Message Edited by TehNrd on 09-05-2008 01:22 PM
  • September 03, 2008
  • Like
  • 1

I know I can use an actionStatus to disable a specific button or input field during an action/rerender.  However, I would like to disable all user inputs (check boxes, date inputs, etc.) during a rerender that is triggered by just one input.  Basically, I'd like an actionStatus that all of the inputs are listening on so that they all disable themselves until the the action is complete. 

HI,

 

Need help with insering the Oppline Item. There are lot of discussions in this board about this and i even followed them but still couldnt insert the Opportunity Line Item The error i get is 

 

FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry is in a different pricebook than the one assigned to the opportunity): [PricebookEntryId]

 

Pricebook2 pb= [select Id from PriceBook2 where IsStandard=True limit 1];


Product2 product = new Product2();
product.Name='Test Product';
product.IsActive=true;
insert product ;

// Create a pricebook entry for custom pricebook
PricebookEntry pbe = new PricebookEntry();
pbe.UseStandardPrice = false;
pbe.Pricebook2Id=pb.id;
pbe.Product2Id=product.id;
pbe.IsActive=true;
pbe.UnitPrice=99;

insert pbe;

 

Opportunity objOpp1= new Opportunity();
objOpp1.Name = 'Testing12';
 objOpp1.StageName = 'Upside';
 objOpp1.CloseDate = System.Today();
 insert objOpp1;


OpportunityLineItem NewRec = new OpportunityLineItem();
NewRec.TotalPrice=99;
NewRec.Quantity=1;
NewRec.OpportunityId=objOpp1.Id;
NewRec.PricebookEntryId=pbe.id;
insert NewRec;

 

Thanks

The javascript code on a list button below no longer works in winter 12.

 

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

alert("hello");

 

 

Do you have similar issues?

We have Javascript Remoting in use in our Production instance (Summer '11) and it works like a charm. Our Sandbox was just "upgraded" to Winter 12 and now we are getting reference errors on code that has not changed in 2 months. What gives?

I am trying to write a trigger to chang the quotelineitem's sort order by copying the item number, which is a custom field. I am recieving the following error:

 

Compile Error: Field is not writeable: QuoteLineItem.SortOrder

 

Here is my code:

trigger LineItemSortOrder on QuoteLineItem (Before Insert, Before Update) {
    
    QuoteLineItem[] q = trigger.new;

   for (integer i = 0; i < q.size(); i++) {
      QuoteLineItem nquote = q[i];
      nquote.sortorder = integer.valueof(nquote.Item__c);
  
   }    
    
}

 

Is there any way around this error?

 

Thank you,

ckellie

I'm puzzled

 

Running Eclipse Helios and Force.com IDE plug 20.0.1

 

  • On 2011-05-20, our Sandbox was on Spring 11.  If I used the IDE and did Run Tests on class Foo, I got a full debug log of the entire class execution in the Apex Test Runner view
  • On 2011-05-23, after our Sandbox was upgraded to Summer 11, running the exact same test in the IDE on class Foo yields a vastly truncated debug log in the Apex Test Runner view. The log is only about 130KB.

 

I know the code executes to completion because the same Run tests in the Force.com browser Apex Classes | Run Tests yields a debug log of 3300KB using the same log filters.

 

As far as I can tell, it is something about Summer 11 and how the Eclipse IDE version 20.0.1 obtains the debug log.

 

Any ideas greatly appreciated (I'm already filtering the log to LoggingLevel.INFO and thus avoiding the noise; but I need more than 130KB of debug log to analyze my execution).

 

 

Hi ,

 

I have a test class where i need to be able to create a quotelineitem.

 

Can someone please help me with the code to create a quotelineitem for a test class?

 

Thanks!

I am getting the above error message on a trigger. I have stripped the trigger way way down to make it easier to diagnose the problem.

 

Here is the complete trigger

 

 

trigger tryi on Contact (before update) {
    string gCode;
    string en;
    en='Segal';
    gCode=LEFT(en,2);
  }

 

and here is the complete error:

Error: Compile Error: Method does not exist or incorrect signature: LEFT(String, Integer) at line 5 column 11

 

But I know that LEFT exists, and I know that 'Segal' is a string, and I know that 2 is an integer. So what am I missing?

 

Thanks.

 

The business' needs for their custom opprotunity cloning has changed and they need the cloned opportunity to be cloned to edit mode, with the correct Record Type based upon the opportunity name.  I am struggling on how to do this.    This is my code, but it generates errors on the if statement.  Should I be doing this in a different way?  Also, is there a conditional operator "like" that I can use for the opportunity name is like or the opportunity name contains?  Should I be doing 2 select statements?  Thanks for any suggestions.

 

 

public class OppCloneController {  

    private ApexPages.StandardController controller {get; set;}  

    public Opportunity opp {get;set;} 
    public List<OpportunityLineItem> items = new List<OpportunityLineItem>();
 

    // set the id of the record that is created -- ONLY USED BY THE TEST CLASS  

    public ID newRecordId {get;set;}  

     // initialize the controller  

    public OppCloneController(ApexPages.StandardController controller) {  

     //initialize the stanrdard controller  

      this.controller = controller;  

       // load the current record  

         opp = (Opportunity)controller.getRecord();  
     }  

    // method called from the VF's action attribute to clone the opp 

    public PageReference cloneWithItems() {  


          // setup the save point for rollback  

        Savepoint sp = Database.setSavepoint();  

        Opportunity newOP;  


         try {  


          //copy the opportunity - ONLY INCLUDE THE FIELDS YOU WANT TO CLONE  

             opp = [select Id, Name, Account.Name, AccountID, StageName, CloseDate, OwnerID, Type_of_Job__c, 
             Invoice_Requirements__c, Customer_Account__c, Contact_Name__c, Customer_E_mail__c, RecordTypeID,
             Phone__c, fax__c, Pricebook2Id
             from Opportunity where id = :opp.id]; 
 
 			
             newOP = opp.clone(false);  
           //check to see if the opportunity name contains DTV or DirecTV, if so apply the appropriate record type,
           //otherwise use standard record type
                         
             if (opp.Name = 'DirecTv' || 'DTV'){
             	newOpp.RecordTypeID = 'DTV New Standard';
                }else {
             	newOpp.RecordType = opp.RecordTypeId;
             }	
             		

 

 

Hi

 

I have a custom (Delgate__C) that has two lookups to the Contact table. When there was only one lookup I accessed the Contact data via the Contact__R object. Now that there are two, how to I reference the second related contact  and how does Salesforce know which one I am referring to?

 

Thanks in advance

Ross

  • March 24, 2011
  • Like
  • 0

Hi,

 

I'm trying to write a controller extemsion. I want to show a list of records related to a case's specific field.

 

For this I wrote the following:

 

public with sharing class CaseObjectController {



   
    private final Case caseObj;
    transient List<Account_Hot_News__c> caseNews;
     date todaysDate = date.today();
    
    public CaseObjectController(ApexPages.StandardController stdController) {
        this.caseObj = (Case)stdController.getRecord();
    }

    public List<Account_Hot_News__c> getNewsForCases() {
       
        
        if (caseNews == null) {
            
            
                return [
                select   Id, Account_s_Main_SiteID__c, Alert_Message__c,  name, Expires_On__c, Affecting_All_Servers__c, Account_s_Server_Name__c
                from Account_Hot_News__c
                where  (Account_Hot_News__c.Account_s_Main_SiteID__c = :caseObj.Case_Site_ID__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL ) ) OR (Affecting_All_Servers__c = true AND Account_s_Server_Name__c = :caseObj.Account_Server_Name__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL))  ];
                
             
        }
        else {
            return caseNews;
        }
    }

}

 

But me problem is that I don't know how to create the test method for this class.

 

Can anyone help understand how to do it?

 

Thanks

 

Tzuvy

  • March 23, 2011
  • Like
  • 0

I know I can use an actionStatus to disable a specific button or input field during an action/rerender.  However, I would like to disable all user inputs (check boxes, date inputs, etc.) during a rerender that is triggered by just one input.  Basically, I'd like an actionStatus that all of the inputs are listening on so that they all disable themselves until the the action is complete. 

I'd like to re-open the discussion of SortOrder on the OpportunityLineItem object. A thread from 3.5 years ago can be located here:
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=3154

Looks like people from SF were going to look into it but obviously nothing has come to fruition. The reason I have put this in the Visualforce board is that we have have a few VF applications that could really take advantage of access to this field. Visualforce has also opened up new possibilities to UI design where the ability to manage SortOrder could be useful.

Also, no offense to salesforce.com, but the tool for sorting OpportunityLineItems is not that useful when there are multiple products with the same name. I have actually built a pretty slick sorting application but this is currently useless.

A lot of the concerns were about error handling. What happens if you have 3 line items but sort order is defined as, 1, 2, 2. Or 1, 2, 4. How about just throwing a sortOrder exception and force the developers to write good code?

Ideas? Thoughts?
http://ideas.salesforce.com/article/show/10092062/OpportunityLineItem_SortOrder_to_be_CreatableUpdatable

-Jason


Message Edited by TehNrd on 09-05-2008 01:22 PM
  • September 03, 2008
  • Like
  • 1