+ Start a Discussion
j_r_roj_r_ro 

Message not being added to ApexPage messages

Hi all,

I have a piece of code that was previously working up until winter14. I am trying to add a Message to ApexPage messages, where the message reports that a salesforce field could not be updated.

Note Salesforce is also adding their own exception to the page messages so the expected output is 2 error messages - 1 with the custom message, the other with the salesforce message.

 

this is the exception, which is caught and added to page messages:

 

throw new COMMON_EX_Exceptions.DocumentGenerationException('Document delivery has succeeded but post generation field update has failed for document setting: "' +docSettingList[0].Name +
+'". Contact your administrator to review this message and resolve the issue.\nError message: ' + e.getMessage());

 

where e.getMessage is 'Update failed. First exception on row 0 with id 003E000000eegPUIAY; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Required test]: [Required test]'.

 

The second error message (reported by salesforce) is just the string "Required fields are missing: [Required test]".

 

Our custom message is not being added to page messages, where the salesforce one is still working correctly. If I alter the error message so the matching portions of the strings are different, it works and reports both messages.

 

Is anyone aware of any changes in 14 that would cause any message containing some duplicate string to only be added to page messages once?

 

Thanks.

 

KevinPKevinP
I don't know of anything in winter14 that would have caused this change. 'course, I'm not privy to all the bits. 

do you have unit tests that prove the message is being added to the array? I'm wondering if the logic putting it on the array is failing. Can you post more of your code? does placing the apex:messages in a different location in the markup affect results?