• dawnzdy
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 24
    Replies

Hi Everyone,
 
   I am trying to display error msg on visualforce page when a var may cause exception.          Using <ApexPages.addMessage>  in the controller, and  <Apex:pageMessages/> on the page  is working fine when I check the value first like this.
   
    

i = 0;

if (i==0){

ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'works in if'));

return null;

}

return 5/i;

 


 
     But what I really want is to catch the exception and display this message instead of checking value first.
 
    

i = 0;

try{

return 5/i;

}catch(Exception ex){

ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'why not working here?'+ex));

return null;

}

 

 

 

      Seems this is not working, and I still get the standard error msg page complaining divided by 0. Did I miss anything here or this is how visualforce page error msg should work?

 

Thanks,

Dawn 

Message Edited by dawnzdy on 11-23-2009 07:40 PM

Hi all,

 

    I have a trigger to do a field update on another object(salesforecast) when opportunity owner is changed. It turns out it works only when the opportunity owner is changed manually. When the owner is changed due to the account transfer,  the trigger won't be triggered.

 

    Although the owner change will always show up in the I couldn't create trigger upon the OpportunityFieldHistory.

 

    Any work around for this? 

 

Thanks,

Dawn

  • September 08, 2009
  • Like
  • 0

Hi,

 

     I had a visualforce page with "save" & "cancle" buttons, it works very well using most profile settings, but when I tried with a certain profile,  the "save" button didn't  show up on the page.

 

     I have checked the security setting for both visualforce page and the apex class, and they all granted access to that profile.

 

     Any idea?

 

Thanks,

Dawn

Hi All,

 

 

   I thought there is a new feature in the Spring release which enabled us to set up workflow rule and specify the object to update. I know this only applies for Master/Child relation objects.

 

   However I encoutered the same thing as the poster listed below. I have a child object with Opportunity as the master object, but I couldn't see the drop down object select list to choose opportunity when I try to define the field update workflow rule.

 

   http://community.salesforce.com/sforce/board/message?message.uid=120423

 

 

   In the Sprint'09 release the "CROSS-OBJECT WORKFLOW FOR CUSTOM OBJECTS " section mentioned some setup is required but didn't say in details. What kind of setup?

 

   Any idea?

 

Thanks,

Dawn

Message Edited by dawnzdy on 06-11-2009 01:04 PM
Message Edited by dawnzdy on 06-11-2009 02:10 PM

Hi, I am trying to save the visualforce page (rendered as PDF) as document and attachment. I was able to insert them but have problem opening the link.

 

 

When I try the document, it says: File does not begin with '%PDF-'

When I try the attachment, it says: unable to process request, please try again later. Any suggestions?

 

I have read through this link and was using the similar code, not sure why doesn't work.

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=13549#M13549

 

 

 

Thanks for your help and reply!

 

Dawn

Message Edited by dawnzdy on 06-05-2009 01:31 PM

This is actually not a visualforce development question.

 

I added the visualforce page to Account page in the page layout editor, but it seems there is a limit of the length.

This page is a tab like thing to show the related contacts on this account.

 

If there are too many records on the visualforce page, only the first few (around 12) will show up. There's no "more" link and no scroll bar. Some times it even only show the upper half line of the record.

 

Anyone have encountered this? 

 

Thanks in advance!

Trigger and workflow rule kept updating in a loop and reached SOQL limit. Introducing global static var but lead to test failure.

 

 

The problem is the workflow rule to update a field on the record is fired right after the execution of a update trigger. And this will result in another firing of the trigger.  And the initial value of the record in the second firing of trigger is the original value instead of the updated value after first firing.

 

We used to do one more database query to determine whether the update/insert in the trigger should take effect, but this will increase the SOQL queries. This will only prevent the record to be updated/inserted multiple times, but the trigger will still be fired more than twice, and the number of SOQL queries will be doubled even trippled.

 

Then  I have posted on the board,and thanks for Wilmer to give me the solution:

 http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=14853 

 

The global static variable does help, and it works fine without increasing SOQL queries. But the now the problem is, the test method can not pass. In the test we do multiple update, the insert/update database action in the trigger will only execute the first time, and the assertion for the following update all failed.

 

It seems the global static variable won't be refreshed after each DML.

 

Now I am really in a dilemma: how to decrease the number of SOQL while ensuring the test coverage.

 

Any suggestions? 

 

Thanks in advance.

 

Hi,

 

     I have a trigger on opportunity update which will update the opportunity line items  accordingly.

 

     Through the debug log I found the trigger is triggered twice, even though I specify it will only be triggered if there is a stage change from sA to sB. 

 

     From the discussion board, I found the reason is due to certain workflow rule did field update right after the trigger. But the funny thing is after the first firing, the previous stage of the opportunity is still considered as sA instead of sB, while the opportunity line items data did accumulated after the firing.

 

     In the end, the number of line items doubled.  Although I have ways to prevent the line items from the second round of accumulation, I am just curious how to deal with the second fire of trigger?

 

 

     Btw, I found the governer limit of SOQL in sandbox increased from 20 to 100! Good news!

 

 

Thanks,

Dawn

Message Edited by dawnzdy on 04-15-2009 12:23 PM

Hi,

 

    I want to trigger a workflow rule 1 on object A, with the Evaluation Criteria as "Every time a record is created or edited".

 

    I have another time-based workflow rule 2 which will updatea filed on Object A.

 

    So at a certain time, the field on Object A should be updated by workflow rule 2 and then workflow rule 1 will be triggered.

 

    However, the result turns out to be the field was updated but  workflow rule 1 was not triggered at all. If I  manually update that field, then I can see the expected result.

 

    Any ideas about this? I know the update of formula filed won't be considered as a edit action but this field is just a text field.

 

    Thanks in advance!

 

 

Hello,

 

    I have a trigger and corrseponding test class, they used to be working fine. But today, when I run the test, it comes up with this error:

 

     System.Exception: Assertion Failed: Insert failed. First exception on row 0; first error: LICENSE_LIMIT_EXCEEDED, license limit exceeded

 

    In the test case, I used System.runAs(newUser).

 

    Any idea on this?

 

Thanks!

Hi,

 

    We have a trigger activated after update of account manager on account. In the trigger, it queries the old manager and put it to remove list. So when we do a bulk update of AM using Apex data uploader, error will occur when the update records is more than 20. Then we can only do it 20 at a time.

    I know there is a limitation of 20 SOQL queries trigger. But we do need to do the bulk update now and than. Do you have any solution to this?

 

    Thanks!


We just started using VF email template and it is very helpful.

But the problem is the layout on blackberry is unreadable.

We have defined the plain text but it seems the blackberry kept using the HTML version.

Anyone know how to make it possible on blackberry? Thanks!


Hi,

   I have a before insert trigger to execute when a case is logged from selfservice portal.
   It works fine but I have a problem of passing the test.
   
   In the trigger:
 
   ID contactId = [select contactId from SelfServiceUser where username=:UserInfo.getUserName()].contactId;

   Then in the testmethod how to prepopulate the value to UserInfo.getUserName(), so the test can pass?
Hi,

    - I want to check "Assign using active assignment rules" when create a case  in Apexcode, but I didn't find a way to access it.
    Is this one editable in the code?

    - By the way, can we call standard Apex functions in Visualforce page? It seems some doesn't work.

Thanks!
   


Message Edited by dawnzdy on 01-02-2009 02:09 PM
I am trying to write a trigger to get the account information when a case is logged in through selfservice portal.

But I found neither the accountid nor the contactid of case is populated "after insert".

Anyone know which fields are available?

Thanks.

Hi, I am new to the Google Visualization API.

I followed the instruction page and tried with the Timeline example, and it's pretty cool.

Then I tried to create a new visualforce page using component BarChart and the same "SalesController"(used in timeline), but this time there's a error when I run visualforce page: "An internal server error has occurred".

I didn't find much information about this message in the debug log.

I appreciated of your help. Thanks!

Dawn


Hi Everyone,
 
   I am trying to display error msg on visualforce page when a var may cause exception.          Using <ApexPages.addMessage>  in the controller, and  <Apex:pageMessages/> on the page  is working fine when I check the value first like this.
   
    

i = 0;

if (i==0){

ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'works in if'));

return null;

}

return 5/i;

 


 
     But what I really want is to catch the exception and display this message instead of checking value first.
 
    

i = 0;

try{

return 5/i;

}catch(Exception ex){

ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'why not working here?'+ex));

return null;

}

 

 

 

      Seems this is not working, and I still get the standard error msg page complaining divided by 0. Did I miss anything here or this is how visualforce page error msg should work?

 

Thanks,

Dawn 

Message Edited by dawnzdy on 11-23-2009 07:40 PM

Hi all,

 

    I have a trigger to do a field update on another object(salesforecast) when opportunity owner is changed. It turns out it works only when the opportunity owner is changed manually. When the owner is changed due to the account transfer,  the trigger won't be triggered.

 

    Although the owner change will always show up in the I couldn't create trigger upon the OpportunityFieldHistory.

 

    Any work around for this? 

 

Thanks,

Dawn

  • September 08, 2009
  • Like
  • 0

I have a custom object (Eval_Forecast__c) and some email templates.

 

In a trigger, I would like to send an email using those templates populating the dynamic text of the template. I can get the email to send, but the problem is the dynamic text is not populated.

 

When I set the WhatId (which seems to be what I need to do), I get the error:

 

SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.

 

 

Here is the Apex code:

 

Messaging.SingleEmailMessage emailOut = new Messaging.SingleEmailMessage(); if(forecast.Stage__c =='Submitted to Sales Operations') { emailOut.setTemplateId('00XQ0000000QCUo'); } if(forecast.Stage__c =='Sales Order Released') { emailOut.setTemplateId('00XQ0000000QCV3'); } if(forecast.Stage__c =='Closed Cancelled') { emailOut.setTemplateId('00XQ0000000QCV8'); } emailOut.setTargetObjectId(user.Id);

 

Here is a sample of the template code:

 

*** Sales Order Has Been Released *** Eval Forecast Name: {!Eval_Forecast__c.Name} Account Name: {!Eval_Forecast__c.Account_name__c} Sales Order Number: {!Eval_Forecast__c.Sales_Order_Number__c} IMTR Number : {!Eval_Forecast__c.IMTR_Number__c} Note: Your Sales Order has been removed from shipping block and is now elidgible to ship.

 

 thanks,

 

lee

 

 

Hi,

 

     I had a visualforce page with "save" & "cancle" buttons, it works very well using most profile settings, but when I tried with a certain profile,  the "save" button didn't  show up on the page.

 

     I have checked the security setting for both visualforce page and the apex class, and they all granted access to that profile.

 

     Any idea?

 

Thanks,

Dawn

Hi All,

 

 

   I thought there is a new feature in the Spring release which enabled us to set up workflow rule and specify the object to update. I know this only applies for Master/Child relation objects.

 

   However I encoutered the same thing as the poster listed below. I have a child object with Opportunity as the master object, but I couldn't see the drop down object select list to choose opportunity when I try to define the field update workflow rule.

 

   http://community.salesforce.com/sforce/board/message?message.uid=120423

 

 

   In the Sprint'09 release the "CROSS-OBJECT WORKFLOW FOR CUSTOM OBJECTS " section mentioned some setup is required but didn't say in details. What kind of setup?

 

   Any idea?

 

Thanks,

Dawn

Message Edited by dawnzdy on 06-11-2009 01:04 PM
Message Edited by dawnzdy on 06-11-2009 02:10 PM

Hi, I am trying to save the visualforce page (rendered as PDF) as document and attachment. I was able to insert them but have problem opening the link.

 

 

When I try the document, it says: File does not begin with '%PDF-'

When I try the attachment, it says: unable to process request, please try again later. Any suggestions?

 

I have read through this link and was using the similar code, not sure why doesn't work.

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=13549#M13549

 

 

 

Thanks for your help and reply!

 

Dawn

Message Edited by dawnzdy on 06-05-2009 01:31 PM

This is actually not a visualforce development question.

 

I added the visualforce page to Account page in the page layout editor, but it seems there is a limit of the length.

This page is a tab like thing to show the related contacts on this account.

 

If there are too many records on the visualforce page, only the first few (around 12) will show up. There's no "more" link and no scroll bar. Some times it even only show the upper half line of the record.

 

Anyone have encountered this? 

 

Thanks in advance!

Hi,

 

     I have a trigger on opportunity update which will update the opportunity line items  accordingly.

 

     Through the debug log I found the trigger is triggered twice, even though I specify it will only be triggered if there is a stage change from sA to sB. 

 

     From the discussion board, I found the reason is due to certain workflow rule did field update right after the trigger. But the funny thing is after the first firing, the previous stage of the opportunity is still considered as sA instead of sB, while the opportunity line items data did accumulated after the firing.

 

     In the end, the number of line items doubled.  Although I have ways to prevent the line items from the second round of accumulation, I am just curious how to deal with the second fire of trigger?

 

 

     Btw, I found the governer limit of SOQL in sandbox increased from 20 to 100! Good news!

 

 

Thanks,

Dawn

Message Edited by dawnzdy on 04-15-2009 12:23 PM

Hi,

 

    I want to trigger a workflow rule 1 on object A, with the Evaluation Criteria as "Every time a record is created or edited".

 

    I have another time-based workflow rule 2 which will updatea filed on Object A.

 

    So at a certain time, the field on Object A should be updated by workflow rule 2 and then workflow rule 1 will be triggered.

 

    However, the result turns out to be the field was updated but  workflow rule 1 was not triggered at all. If I  manually update that field, then I can see the expected result.

 

    Any ideas about this? I know the update of formula filed won't be considered as a edit action but this field is just a text field.

 

    Thanks in advance!

 

 

Hello,

 

    I have a trigger and corrseponding test class, they used to be working fine. But today, when I run the test, it comes up with this error:

 

     System.Exception: Assertion Failed: Insert failed. First exception on row 0; first error: LICENSE_LIMIT_EXCEEDED, license limit exceeded

 

    In the test case, I used System.runAs(newUser).

 

    Any idea on this?

 

Thanks!

We have been experiencing odd behavior with the "Password Never Expires" capability on the profiles and I was wondering if anyone else has experienced the same.
 
We have integrations built that access SFDC through the API.  We created separate user accounts and profiles for these integrations.  The integration profiles have been marked as "API Only" and "Password Never Expires".  We want to preserve the password considering this is an integration account.
 
For our regular users (non integration) we have established the password policies with "password expires 90 days".  Therefore, users are forced to change their passwords every 90 days.
 
Our integration user accounts have been getting the following error when trying to login using our integration or any other api application, such as the data loader:
Web service callout failed: WebService returned ­a SOAP fault:
INVALID_OPERATION_WITH_EXPIRED_PASSWORD: The user’s password has expired, You must call
SetPassword before attempting any other API operations
Faultcode=sf: INVALID_OPERATION_WITH_EXPIRED_PASSWORD
 
Although this error is produced when attempting to login through the integration account -- if the login history is viewed for this specific user, the history displays the login as "Successful".  In addition, we reset the password on the integration user account and the integrations continue to work ... for approx. 90 days then the same thing happens.  The same behavior happens in our sandbox environment.
 
I have contacted SFDC support but they do not seem to know what is causing this issue and their recommendation is to reset the password so they can monitor that account and see if it happens again.  It seems to me that the password policies are not adhering to the "password never expires" on the "API Only" integration accounts.
 
Please let me know if anyone has experienced the same behavior or has any additional information regarding this issue.
 
Thank you

 

 

  • January 12, 2009
  • Like
  • 1
Is it possible to only mail merge certain opportunity product line items? For instance I only want the mail merge doc to include line items from a single product family.

Has anyone done something like this?

Thanks,

Chris

  • December 14, 2007
  • Like
  • 0