Tuesday 18 October 2011

How to make object readonly or editable by using maximo API coding?

To make Object Readonly: setFlag(7L,true);
To make Object Editable: setFlag(7L,false);

Note:
1.If object is readonly, can't make fields editable in that object.
2. If object is readonly, then make object editable using setFlag(7L,false);. Now all the fields will be editable, and make other fields readonly by using setFieldFlag("<attributename>",7L,true);

Tuesday 4 October 2011

How to Initiate Work Flow in maximo 7 through coding?

Step 1: import psdi.server.MXServer;
            import psdi.workflow.WorkFlowServiceRemote;
Step 2: Now write the below code in your method:

            try
             {
                  MXServer mx = MXServer.getMXServer();
                  WorkFlowServiceRemote wfsr = (WorkFlowServiceRemote)mx.lookup("WORKFLOW");

                   RFQRemote  rfq = (RFQRemote)getMbo();
                   wfsr.initiateWorkFlow("<work flow name>",rfq);
              }
              catch(Exception e)
             {
                  e.printStactTrace();
              }

Note: i) In the above sample code, I was initiated work flow of RFQ. So I used RFQRemote. Like that you can use your required application remote class. For example: If you want to initiate PO work flow, then you have to PORemote instead of RFQRemote.
          ii) initiateWorkFlow("<here you have to give WF name which you want to initiate>", <here you have to give MBO name, in the above example "rfq" is the instance of RFQRemote which is storing mbo of RFQ>);

How to add parameters in crontask (maximo 7)?

Step 1. import psdi.app.system.CrontaskParamInfo;
Step 2. import java.rmi.RemoteException;
Step 3:
public class CustomCronTask  extends SimpleCronTask{
 public CrontaskParamInfo[] getParameters() throws MXException,RemoteException
{
   CrontaskParamInfo parameters[] = new CrontaskParamInfo[2];
   parameters[0] = new CrontaskParamInfo();
   parameters[0].setName("Parameter 1");
   parameters[1] = new CrontaskParamInfo();
   parameters[1].setName("Parameter 2");
   return parameters;

}
}
Step 4: ***** This is very important *****
        i) If it is a new crontask, after creating an instance, parameters will display on the screen.
        ii) If you are adding parameters to the existing crontask, then you have to create a new crontaskinstance and save the record. Then parameters will display on the screen.

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...