Versions Compared

Key

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

CRM Session holds information about the logged in user, the server, the database and the general and formatting settings.

What does this section cover?

Table of Contents

Retrieve CRM Session

To retrieve the current CRM Session object you have to use getCRMSession() method which is implemented in com.crm.businessobject.CRMBase super class. Note that all CRMBO, CRMUI, CRMProcess and CRMAPIBean classes extend CRMBase.

Code Block
titleRetrieve CRM Session
collapsetrue
 public CRMDO copy(CRMDO dto)
{
	CRMSession session = getCRMSession();
	...
}

 

Use CRM Session

 

Code Block
titleExample 1
collapsetrue
 public CRMDO copy(CRMDO dto)
{
	CRMSession session = getCRMSession();
	if( dto instanceof CUSTOMCRMDORentalTypeProduct)
	{
		CUSTOMCRMDORentalTypeProduct oldProduct = (CUSTOMCRMDORentalTypeProduct) dto;
		CUSTOMCRMDORentalTypeProduct newProduct = (CUSTOMCRMDORentalTypeProduct)oldProduct.clone();
		newProduct.setCreatedDate(getCurrentDate());
		newProduct.setCreatedByUnit(session.getUnit());
		newProduct.setCreatedByUser(ejbSession.getLoggedUser());
		newProduct.setUpdatedByUnit(null);
		newProduct.setUpdatedByUser(null);
		newProduct.setUpdatedDate(null);
	}
}