...
- Create the Exception class.
...
- All exception classes must extend com.crm.exception.CRMValidationException.
- All exception methods should have
...
- a com.crm.exception.CRMValidationException object as an input parameter and use setMessage method of com.crm.exception.CRMException class
...
...
- .
- To create the exception method:
- Use com.crm.businessobject.CRMSession object as an input parameter and any other String input parameters needed.
- Put all String input parameters in a String ArrayList.
- Use setMessage method of com.crm.exception.CRMException class to construct the exception message.
- To create the exception method:
- .
Code Block | ||||
---|---|---|---|---|
| ||||
public class AccountTerminationException extends CRMValidationException { /** * You are not allowed to terminate the Accounts Receivable %1. This is only allowed for Active or Suspended accounts. * * @param crmSession - the session object * @param value - the exception value * @throws Exception */ public AccountTerminationException(CRMSession crmSession, String value) throws Exception { super(); ArrayList<String> parameters = new ArrayList<String>(); parameters.add(value); try { setMessage(this.getClass().getName().toUpperCase(), crmSession, parameters); } catch (Exception e) { e.printStackTrace(); } } } |
...
3. Define the question code in metadata messages file.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<message> <code>CONFIRM_FINANCIAL_TRANSACTION_SAVED_AS_POSTED</code> <expression>key_confirm_financial_transaction_saved_as_posted</expression> <description>Confirm Action</description> </message> |
...