Thursday 17 September 2015

MBO Date Formats

Sometimes we need to filter the MboSet records based on dates.
  • By using MXFormat.dateToSQLString(Date d) you can get the date format as "yyyy-MM-dd".

For example:
MboSetRemote mboSetRemote = getMboSet("ASSET");
mboSetRemote.setWhere(MXFormat.dateToSQLString(getDate("STATUSDATE")));

Here MXFormat.dateToSQLString will return date as string and format is '2015-09-17' (with single quotes).

  • If your database is using different date format, then update it in system properties mxe.db.format.date and use SQLFormat.getDateFunction(Date d)

For example:
MboSetRemote mboSetRemote = getMboSet("ASSET");
mboSetRemote.setWhere(SQLFormat.getDateFunction(getDate("STATUSDATE"));

Here SQLFormat.getDateFunction will return date as string in two ways:

1. If mxe.db.format.date is not null/blank then it will return string with given date format in this property.
for example: If mxe.db.format.date is dd-MM-yyyy, then return string will be '17-09-2015' (with single quotes)
2. If mxe.db.format.date is null/blank, then it will return same as MXFormat.dateToSQLString method, i.e. '2015-09-17' (with single quotes).

Hope it helps :)

Wednesday 9 September 2015

BMXAA6002E - You cannot save object JOBPLAN : Job Plan=TESTJP1 Organization=ORG1 Site=SITE1 Revision=0 because of the data security restrictions. If you save the object, it becomes read-only and hidden

Error: BMXAA6002E - You cannot save object JOBPLAN : Job Plan=TESTJP1 Organization=ORG1 Site=SITE1 Revision=0 because of the data security restrictions. If you save the object, it becomes read-only and hidden

Environment: Maximo 7.6.0.1

Steps to reproduce above error:

1. Create a job plan and save it with DRAFT status.
2. Create a condition expression "status <> 'DRAFT'".
3. Create a global data restriction --> Object restriction --> Object JOBPLAN , app JOBPLAN , READONLY and add condition created in step 2.
4. Create a new user and associate a security group which has access job plan application (not maxadmin group).
5. Login with new user and go to job plans application.
6. Change status of job plan created in step 1 to ACTIVE and save the record.
7. Above error will occur.

Note: These steps will reproduce error in Maximo 7.6.0.1. In Maximo 7.1, job plans are editable even status is ACTIVE. So above steps will not reproduce errors in Maximo 7.1.

Cause: Out of box Job plan mbo is flagged to readonly when status is ACTIVE or INACTIVE. In our case, condition again trying to flag it readonly for the same mbo, hence this error occurs.

Solution: No need to put condition for Job plan to make it READONLY when status is ACTIVE or INACTIVE.

These are just my findings, if anyone have different approach, please provide your inputs in comments.

Friday 4 September 2015

Maximo restore database error in SQL Server

System.Data.SqlClient.SqlError: RESTORE cannot process database '<DbName>' because it is in use by this session. It is recommended that the master database be used when performing this operation.

While restoring database, faced above issue.

Even though all services stopped, still restore database given error that “Database is in use by this session”

Solution:

Connect to Sql server management studio:

Expand Security à Login à Right click on “maximoà Click Properties

 Default database:” value = <your database name>. Change it to “master”.

Maximo SOAPUI error javax.xml.ws.WebServiceException

SOAPUI error while sending payload to below url (in cluster environment) http://localhost:9080/meaweb/services/MXASSET Error : <f...