• JohannesBorrman
  • 55 Points
  • Member since 2009

  • Chatter
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
  • 33

I am trying to unit test an Apex class that I've written but I am having a lot of trouble with the "standard price"


Below is the code and the error I am recieving: 


Pricebook2 standardPb = [SELECT Id, Name from Pricebook2 WHERE isStandard=true];

 PricebookEntry standardpbEntry = new PricebookEntry(unitPrice=0, useStandardPrice=true, Product2Id=testProduct.Id,Pricebook2Id=standardPb.Id );




System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: UnitPrice (unit price not equal to standard price): [UnitPrice]


I have no idea how the standardPrice got set, or where to find it so I can use the correct unit price.


Any help would be very much appreciated



  • May 14, 2009
  • Like
  • 0

Hi all,


maybe I'm missing something but when creating users via API or updating existing ones it seems Salesforce is ignoring my boolean "false" values for

ReceivesInfoEmails, ReceivesAdminInfoEmails ... I only can untick the two via the user-pref page in SF but that's exactly what I didn't want to do.


There is no error thrown while updating it (via the eclipse anonymous window)


Any thoughts? :)

Hi all,


is there a way to lookup for portal users vis the standard lookup dialogue?

I only retrieve standard platform users. Am i missing something?


Regards, Johannes

It's me again :)


Is there a way for portal users to create events and use calendar functionality like a regular salesforce user?

My first impression is that a portal user only can be an event-attendee and decline or accept meeting invitations.


Regards, Johannes

hi all,


maybe someone knows: from where can i quickly add portal users when not wanting them to do this by themselfs.


Cheers, Johannes

For testing i've programmed a vf page which inserts some data into a custom object. So far so good ...


I've tried to make the site visible only via authentification via portal login. Auth works well but when i opened the site url it gave me access without login even when there were no pages assigned in the site config page (Site Visualforce Page and Site Standard Pages settings without any page assignment).


Is this the wanted behaviour? I thought the site could stay active. In my case i don't need any public space on my site only the authenticated area but i'm a bit confused now as i'm follwed the instructions in the Force.com Developer Guide (page 453, 5. ...) ...





Hi all,


probably a dumb question - when editing a portal user's profile there are only standard objects listed.

my impression is now (which is hopefully wrong) that no access to custom objects is possible.

imagine a self-written app which inserts entries through a vf page into a custom object. that should be possible, shouldn't it?


Regards, Johannes

Hi all,


i'm confused - my Salesforce accountmanager told me that there is an unlimited number of users who can authenticate on SF-sites. Now the support tells me "no" - to activate a customer portal paid licences are needed. That sounds like each portal user will cause costs. There seems to be no easy to find help on those questions. Even the premiere support seems a bit overstrained by my questions. We run Enterprise Ed.


Regards, Johannes

how can I add a custom object in the advanced search scope.




The following simple tabPanel doesn't work in our full sandboxes in FF 3.6.2, Chrome 5, or IE 7.  In my developer sandbox, the code works fine (and I have a much more complex set of tabs).



<apex:page standardController="Account" showHeader="true" tabStyle="account">

<!-- Create Tab panel -->

<apex:tabPanel switchType="server" selectedTab="name1" id="AccountTabPanel">

<apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>

<apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>




Clicking an inactive tab doesn't work - actually, the error is thrown before click at mouseover.  Here is the error that is reported by IE:

Line: 106
Error: Object doesn't support this property or method

In FF, FireBug reports "element.hasClassName is not a function" on load and on hover, "elementClassName is undefined".

Anybody else having this problem? Once again, both our full sandboxes have this issue, but a developer sandbox works fine.  All 3 sandboxes are on Spring 10.


This seems similar to this post, but is affecting multiple browsers and is a much newer release: 

tabPanel broken in IE7


Thank you. 


Message Edited by empiimp11 on 03-31-2010 05:14 PM
Message Edited by empiimp11 on 03-31-2010 05:14 PM



I have a function where if certain conditions are met I need to display an error message to the end user in red text. Kind of like the standard error message by salesforce, but instead I get the very verbose one.


Any ideas how I can throw error messsage on the user's screen?


Here is my code snippet:



public static void checkChangeAssetSubscribers(Change_Asset__c[] chgAssets) {

for (Change_Asset__c cass:chgAssets) {

if(isAssetsDup(cass, chgAssets)){
System.debug('Duplicate Assets detected!');
cass.Assets__c.addError('This Asset is already associated with the Change.');
//throw new CustomException('You cant do that!!!');






Thank you

Message Edited by kminev on 10-23-2009 08:03 AM
  • October 23, 2009
  • Like
  • 0
I'm getting this error:

System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Subject: data value too large: Review final judgement; Teleconference with opposing counsel to correct Final Judgement (max length=80): [Subject]

Why is this error occurring, how can I fix these errors? Do I have to manually put a Check for Field length in APEXclasses when saving records? If so, That would be very tedious :( .. is there amny better idea to fix this issue? :)
  • August 13, 2009
  • Like
  • 0

Hi all,


is there a way to lookup for portal users vis the standard lookup dialogue?

I only retrieve standard platform users. Am i missing something?


Regards, Johannes

I have a table on a Visualforce page where the first two columns have buttons that can edit or delete the corresponding rows. Both buttons use essentially the same code and call very similar APEX code. However, one works, and the other does not:







<apex:commandbutton action="{!edit}" value="Edit" rerender="itemList">

<apex:param name="editid" value="{!rowitem.Id}"/>






public PageReference edit() {

String editid = getParam('editid');

editItem = [SELECT id, Name,Total_Price__c,Quantity__c, Description__c,Agreed_Carriage__c,Agreed_Price__c,Reference__c,Purchase_Order__c FROM SFDC_Purchase_Requisition__c WHERE Id=:editid];

return null;







<apex:commandbutton action="{!del}" value="Del">

<apex:param name="delid" value="{!rowitem.Id}"/>






public PageReference del() {

try {

String delid = getParam('delid');

SFDC_Purchase_Requisition__c item = [SELECT Id FROM SFDC_Purchase_Requisition__c WHERE Id=:delid];

delete item;

} catch (Exception e) {



return null;



 The error I get is a standard "List has no rows for assignment to SObject", due to the fact that it seems to think that "delid" is a null string.


I have added debug logs to each instance of Apex that output the current page. In the sample that works, the parameter "editid "can be seen and is correctly formed within the url of the current page.


Oddly, when debugging the code that doesn't work, it seems that the parameter isn't correctly passed into the url. I was able to find the {!rowitem.id} but it isn't linked to the name "delid". Instead it seems to be linked to what must be a Salesforce code name which looks something like:



j_id0%3Aj_id28%3Aj_id44%3Aj_id46%3A0%3Aj_id66=a0qR0000000JBkNIAW // a0qR0000000JBkNIAW is the rowitem id


I've also put in other test parameters and found a similar occurance. 


The table is formed from nested  <tr> and <td> tags and in all other ways performs as expected. I was just wondering if anybody knew of a reason behind this?



Message Edited by Big Ears on 07-14-2009 09:50 AM

If you create a Product (Product2), enable scheduling and define a default revenue schedule, when you add that product to an Opportunity, a schedule will be created.


For instance, if my default revenue schedule is defined as:

  • Revenue schedule type = Repeat Amount for each installment
  • Revenue Installment Period = monthly
  • Number Of Revenue Installments = 12

And then I add this product to an opportunity with a quantity of 1 and a price of $500, I'll see 12 schedule entries (OpportunityLineItemSchedule records), $500 each, and occurring every month.

If I add this same product to an opportunity through Apex and specify quantity=1 and price=500, the product (OpportunityLineItem) will be added, but no schedule entries will be created.


Here's my code:


Product2 search_product = [select Id from Product2 where ProductCode='Budget_T1_LP_Call_Proxy']; Pricebook2 pricebook = [SELECT Id, Name FROM Pricebook2 WHERE isStandard=true AND isDeleted=false AND isActive=true]; PricebookEntry pbentry=null; try { pbentry = [select Id from PricebookEntry where Pricebook2Id=:pricebook.Id and Product2Id=:search_product.Id and isActive=true and UnitPrice=0 and UseStandardPrice=false]; } catch (System.Queryexception e) { pbentry = new PricebookEntry(Pricebook2Id=pricebook.Id,Product2Id=search_product.Id,isActive=true,UnitPrice=0,UseStandardPrice=false); insert pbentry; } OpportunityLineItem opp_product = new OpportunityLineItem(OpportunityId=io.Opportunity__c,PriceBookEntryId=pbentry.Id,Quantity=1, UnitPrice=io.monthly_budget__c, ServiceDate=io.Monthly_budget_bill_date__c ); insert opp_product;


My guess is that Salesforce wrote code to create the schedule outside of the standard controller and it is not executed when you simply add the product through Apex.


Thoughts? Can anyone confirm this?



For some background, see these posts:

  1. Revenue scheduling unit test not working
  2. Can't test product scheduling
  • March 16, 2009
  • Like
  • 0

I am having issue with DatePicker not popping up automatically. In fact, it does not pop up at all. My input field is definitely a date field. Firebug reports problem like this :-

this.div is null
Line 22568

this.div is null
iframeShim(null)library.js (line 22568)
DatePicker()library.js (line 7537)
pickDate()(true, "j_id0:j_id1:j_id134:j_id135:j_id215:j_id216:j_id220:0:j_id224", false, undefined)library.js (line 7795)
onfocus(focus )IPPage—i...FLg%3D%3D (line 2)
[Break on this error] if (this.div.currentStyle) {

 Could anyone help me?


I hope someone can help me.  I have a VF page that includes 4 tabbed sections.  One of them is a custom search tab.  When the user types their criteria (an account name) into the inputtext box, and clicks my search button, everything works great.  If the user types in their criteria, then presses "Enter",  the page refreshes and takes the user back to the first tab (my search tab is the fourth tab).
How can I get pressing enter to be the same as clicking the button?

Thanks in advance!!

  • August 27, 2008
  • Like
  • 1

I need to do a query in SOQL like this in SQL:

Select SUM(field1), field2 From Table Where condition Group By field2

I Know that It isn't posible, but is there a way to do something seemed?

I would like do something not to calculate this "SUM" by code.

  • August 03, 2007
  • Like
  • 0