Versions Compared

Key

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

...

Code Block
themeEclipse
languagejava
titleCRMUILicenseBean.java
collapsetrue
		InfoMessage infoMsg = new InfoMessage(getCRMSession(),
                "LOGOUT_INFO_MSG", 
                new String[]{"Payment"},
                getCRMSession().getRealPath(), 
                getOrganisationID());
        showInfoMessage(infoMsg);

 Below

, the InfoMessage method is implemented, extends the Exception and it also has the parameters, which are mentioned beforeOnce again, the code of the warning message must be defined in messages of metadata file whilst the expression key must also be mentioned in labels file, as follows.

 

Code Block
themeEclipse
languagejava
titleInfoMessage Exceptionmessages.xml
collapsetrue
package com.crm.process;
import com.crm.businessobject.CRMSession;
import com.crm.framework.metadata.Message;
import com.crm.framework.metadata.MetadataUtil;
import com.crm.framework.util.StringUtil;

public class InfoMessage {	<message>
        <code>LOGOUT_INFO_MSG</code>
        <expression>key_logout_info_msg</expression>
 private String message;     <description>Logout to apply the changes</description>
public InfoMessage(CRMSession crmSession, String code, String[] msgParams, String context, String mpID) throws Exception {
        
        super();
        
        Message infoMsg = MetadataUtil.getMessage(context, mpID, code);
        
        if (infoMsg!=null)
        {
            this.message = crmSession.getTranslation(infoMsg.getExpression());
        }
        
        if (msgParams!=null && msgParams.length>0)
        {
            for (int i=0;i<msgParams.length;i++)
            {
                String msgParameter = "%" + (i+1);
                if(msgParams[i].startsWith("key_"))
                    this.message = StringUtil.replace(this.message, msgParameter, crmSession.getTranslation(msgParams[i]));
                else
                    this.message = StringUtil.replace(this.message, msgParameter, msgParams[i]);
            }
        }
    }
    public String getMessage() {
        return message;
    }
    
}

 

...

</message>
Code Block
themeEclipse
languagejava
titletranslation_eng.properties
collapsetrue
	<entry key="key_logout_info_msg">Please logout and login again so the changes will be applied.</entry>

 

Then, on the following screen is illustrated the warning message, when a field is been changed.

...