• ascuccimarra
  • NEWBIE
  • 25 Points
  • Member since 2009

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

I'm new here,please help me. 

While doing a  math operation,like 1+1 million times,how can I get the  time spent running this code? In php there's a microtime() function to do this, is there a samilar funciton in Apex?

  • March 10, 2010
  • Like
  • 0

Hi All,

 

I have Visualforce controller class. There is called @future method from Save method. And I need to show error message from @future method on the same page where "Save" button were pressed, similar to ApexPages.addMessage().

Is it possible?

 

Thank you!

 

 

 

  • June 14, 2010
  • Like
  • 0

I'm new here,please help me. 

While doing a  math operation,like 1+1 million times,how can I get the  time spent running this code? In php there's a microtime() function to do this, is there a samilar funciton in Apex?

  • March 10, 2010
  • Like
  • 0

I have a test class of a trigger with many if (exactly 12).

 

When I do "run test class" SF give me this error:

 

 

Too many Email Invocations: 11

 if I write this line, I solve the problem but I cannot test other "if" inside:

 

if (limits.getemailinvocations()> limits.getLimitEmailInvocations()){
if fieldX = y send email

if fieldz = w send email

if fieldk = e send email

...

}

How Can I test the last 3 if condition ??

Is there a way to reset limits.getemailinvocations and continue the test?

I try to do this but doesn't work 

limits.getemailinvocations() = null

 

The solution is create 2 trigger with 2 test class but it is for a beginner boy :)


 Thanks

 

 

 

 

I have a trigger which needs to query more than 1000 records. I would like to convert it to use @future in order to work around the governor limit.

 

Do I have to move the logic out of the trigger to a class?

Do you have an example of how I would use @future in this case?

 

Thanks

Pierre

  • March 09, 2010
  • Like
  • 0

Hi all,

 

I'm trying to write my first trigger and am running into some errors.  It is probably baby stuff, but we all have to start somewhere.  Can someone please help with the error?

 

I'm trying to pull a field (text) from the Associated Account to a separate field (picklist) on the Opportunity.

 

Thanks for the help/lesson in advance!

 

 

trigger setXCenter on Opportunity (before insert, before update) { for(Opportunity oppObject : trigger.new) { Account acctObject = [Select Default_X_Center__c from Account where id = :oppObj.Account]; oppObject.Cost_Center__c = acctObject.Default_X_Center__c; }

 I'm getting this error:

 

 Error: Compile Error: No such column 'Default_X_Center__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 19 column 29

 

Thanks 

 

  • March 08, 2010
  • Like
  • 0

 

 

Where is Mapping of picklist values to a particular RecordType defined?

I couldn't find it in the API.

 

 

 

 

  • March 04, 2010
  • Like
  • 0

Current documents has no example on how to schedule apex jobs every 10 mins. I tried with unix cron job syntax style (like 0,10,20,30,40,50 slots), that doesn't work.

 

Any help would be appreciated.

 

Thanks

  • February 17, 2010
  • Like
  • 0

Hi,

I have a test class that create a new Opportunity to work with. The problem is that some customers have their own validation rules in some of the Opportunity object, and cause the insert fail.

 

 

Opportunity newOppty = new Opportunity(StageName='Qualification', Probability=10, Amount=100.00, Type='Existing Customer - Downgrade', LeadSource='Web', IsPrivate=false, Name='John Bess Oppty', ForecastCategoryName='Pipeline', CloseDate=Date.today());
insert newOppty;

 

 There is a way to know if there are any validation rule on the opportunity fields before the insert and create a valid Opportunity?? What is the best practice in this case?, because I can't what the users can have differents validations depend of each Org. 

 

Thanks

J.

Hi, I have activated translation workbench in my org and set some of the picklist values translations.

Then i've created a package and added the "Language Transaltion". I try to install it in other org and the translation workbench is installed automatically with the package, but the translation of the picklist values are gone...

I'm missing something?? Any suggestions??

 

Thanks in advance

 

Juan. 

I am using the Pattern and Matcher classes to search text from an email.  Sometimes, I get an exception that says Regex too complicated.  I can't find any information on this.  Does anyone know what can cause?  I get the premise of the exception but don't know what to do to fix it.  If I put my regular expression and sample text into the tester on this site, http://www.fileformat.info/tool/regex.htm.  It works fine and returns what I want.  From what I understand Salesforce uses similar functionality as Java which the above site is using.  Any ideas?  Thanks.

I'm trying to create new EmailServicesFunction and EmailServicesAddress via Apex, but I'm getting the error
"Save error: DML not allowed on EmailServicesFunction".  Does anyone know how to accomplish this?

 

Thanks,

Jon

I've got two fields side by side, both picklists.  One is a regular Salesforce picklist field, the second is a picklist I'm explicitly tagging so that I can restrict further the values that will eventually be placed in the underlying field on this particular page.

 

I want them to behave exactly the same:  both have a title, both be required, both default to "-None-" option (which errors when left on -None-).  All of this happens with the first field, and none of it with the second: no title, no red mark for required, no enforcement of the required propertly.

 

I've put this:

 

<apex: pageBlockSection id="Section1" columns="2">

 

  <apex:inputField value="{!PSCase.Route_To__c}" required="true"/>

 

 

  <apex:selectList size="1" title="Setup Type" value="{!PSCase.Reason}" required="true"

     <apex:selectOption itemLabel="-None-"/>

     <apex:selectOption itemValue="Trial Setup" itemLabel="Trial"/>

     <apex:selectOption itemValue="Subscription Setup" itemLabel="Subscription"/>

  </apex:selectList>

 

</apex: pageBlockSection>

Message Edited by RDN_LHR on 02-26-2009 05:05 AM
Hi experts,
I found a Salesforce object named OpportunityContactRole by using the IDE (Eclipse) and I want to add a new trigger for this object but I got the following Error message when try to save the new created trigger:
    Save error: SObject type does not allow triggers: OpportunityContactRole
I really need to add the special processing to this object before updating, do any experts have any idea how to fix this issue?
Best regards!
Boi Hue


Message Edited by boihue on 12-09-2008 11:02 AM

Message Edited by boihue on 12-09-2008 11:02 AM
  • December 09, 2008
  • Like
  • 0
Our triggers add great new functionality but as of now none are system critial. So for each trigger I have try/catch statements that catch standard exceptions and adds it to a custom built exception log I've created. http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=978\

The problem I've run into is covering the catch code with test coverage.  It seems like a Catch 22. If my test throws an exception it fails, but I somehow need it to throw an exception to cover the catch statement. Even with the catch code not covered we still have 90% code coverage but I'd like to cover as much as possible.

-Thanks
Jason
  • September 05, 2007
  • Like
  • 0