Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create the Exception class. 

      ...

        1. All exception classes must extend com.crm.exception.CRMValidationException. 
        2. All exception methods should have

      ...

        1. com.crm.exception.CRMValidationException object as an input parameter and use setMessage method of com.crm.exception.CRMException class

      ...

       

      ...

        1. .
          1. To create the exception method:
            1. Use com.crm.businessobject.CRMSession object as an input parameter and any other String input parameters needed.
            2. Put all String input parameters in a String ArrayList.
            3. Use setMessage method of com.crm.exception.CRMException class to construct the exception message.
      Code Block
      languagejava
      titleAccountTerminationException.java
       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
      themeEclipse
      languagejava
      titlemessages.xml
      collapsetrue
       	<message>
               <code>CONFIRM_FINANCIAL_TRANSACTION_SAVED_AS_POSTED</code>
               <expression>key_confirm_financial_transaction_saved_as_posted</expression>
               <description>Confirm Action</description>
          </message>

      ...