Finally Rest API in Maximo :)

Hello;

IBM introduced Rest Api documentation finally. As you know Rest api was being used since TSRM 7.2. Now users can use and enhance it according to their needs..

You can get data as XML or JSON format (JSON is a great format if you’re dealing with javascript ) (More info about JSON: http://en.wikipedia.org/wiki/JSON)

You can find documentation at here.

Have a great day..

make a comment

Great Blog About Maximo

Hi!
I discovered this great blog about Maximo. There are really good documents in it:

https://www.ibm.com/developerworks/mydeveloperworks/blogs/a9ba1efe-b731-4317-9724-a181d6155e3a/?lang=en&follow=true

 

Have a great reading:)

make a comment

Jython Example

Hello;

Here is an example of Jython script. You can see the basic usage of jython scripts in Maximo…

from psdi.security import UserInfo
from psdi.mbo import MboServerInterface
 
mboServer = scriptHome.getMboServer();
user = scriptHome.getUserInfo();
PO=scriptHome
if(PO.getMboSet("POLINEAST").count()>0):
	#Create Workorder
	woSet= mboServer.getMboSet("WORKORDER", user)
	wo=woSet.addAtEnd()
	wo.setValue("APPNAME", "PO");
	wo.setValue("DESCRIPTION", PO.getString("DESCRIPTION")+" Teslim Alma Istegi")
	wo.setValue("DESCRIPTION_LONGDESCRIPTION",PO.getString("PONUM")+" numarali satinalma emri ile alinan malzemeler icin teslim alma is istegi")
	wo.setValue("GENERATEDFORPO",PO.getString("PONUM"))
	wo.setValue("SCHEDSTART", PO.getDate("VENDELIVERYDATE"))
 
	#Custom Set 
	iswocustomSet=mboServer.getMboSet("ISWOCUSTOM", user)
	iswocustom =iswocustomSet.addAtEnd()
	iswocustom.setValue("WORKORDERID", wo.getInt("WORKORDERID"))
 
	#Create Activity for each POLINE
 
	activitySet= wo.getMboSet("WOACTIVITY")
	num=PO.getMboSet("POLINEAST").count()
	for i in range(num) :
 
		activity = activitySet.addAtEnd()
		poLine=PO.getMboSet("POLINE").getMbo(i)
		kisi=""
		if(poLine.getMboSet("RL2").count()==1) :
			kisi=poLine.getMboSet("RL2").getMbo(0).getString("DISPLAYNAME") +" teslim alacaktir."
		activity.setValue("DESCRIPTION", PO.getString("DESCRIPTION")+" satinalma emri " + poLine.getMboSet("ITEM").getMbo(0).getString("DESCRIPTION") +" icin Teslim Alma Aktivitesi")
		activity.setValue("SCHEDSTART", poLine.getDate("VENDELIVERYDATE"))
		wo.setValue("SCHEDSTART", poLine.getDate("VENDELIVERYDATE"))
		activity.setValue("APPNAME", "ASSETSTD")
		iswocustom2 =iswocustomSet.addAtEnd()
		iswocustom2.setValue("WORKORDERID", activity.getInt("WORKORDERID"))
		iswocustom2.setValue("ITEMNUM", poLine.getString("ITEMNUM"))
		iswocustom2.setValue("POLINEID", poLine.getString("POLINEID"))
 
	wo.getThisMboSet().save()
	iswocustomSet.save()
	iswocustomSet.cleanup()

make a comment

Create Complex Web Services in Maximo

Hello;

As you know there are standart web services in Maximo for WORKORDER,TICKET, etc.. You can change status of a ticket or workorder or something else with these web services..

But sometimes these web services are not enough. For example assume you want to calculate some data in Maximo according to that you will assign workorder to a user then change the status of workorder.

In this case, you can create your own web services with a couple lines of code…

First of all, you should extend Maximo Service Class (for WORKORDER example com.ibm.ism.pmcom.PmComWOService (in my case), for you this class can be psdi.app.workorder.WOService)
You can learn which class to extend from Database Configuration.

Go to Database Configuration.
Click Select Action Menu and find the service you want to extend. (You can create your own services here)

Then open eclipse and here is the code:)

package custom.services;
 
import java.rmi.RemoteException;
 
import javax.jws.WebMethod;
 
import psdi.iface.webservices.action.WSMboKey;
import psdi.server.MXServer;
import psdi.util.MXException;
 
import com.ibm.ism.pmcom.PmComWOService;
 
import custom.app.workorder.WOExtRemote;
 
public class WOService extends PmComWOService {
 
	/**
	 * 
	 */
	private static final long serialVersionUID = -157829023628868467L;
 
	public WOService() throws RemoteException {
		super();
		// TODO Auto-generated constructor stub
	}
	//WOService(MXServer mxServer) method must exist, otherwise service does not start
	public WOService(MXServer mxServer) throws RemoteException {
		super(mxServer);
		// TODO Auto-generated constructor stub
	}
	@WebMethod
	public void testWebService(){
		System.out.println("Hello Maximo Web Services()"+getURL());
 
	}
//Don't forget @WebMethod annotations..
	@WebMethod
	public void testWebService2(@WSMboKey("WORKORDER") WOExtRemote wo,String owner) throws RemoteException, MXException{
		System.out.println("Hello Maximo Web Services2()");
		wo.setValue("OWNER", owner);
	}
}

Now deploy code then write your own class in Database Configuration.. Then Restart..

Deploy Web Services.. (If deployed, undeploy and deploy..)
Now you can see your new methods in WSDL and you can try your new web services…

Have a good day….

read comments here

Create Incident with PHP via Web Services

Hi!;

It’s been a long time since my last post. I couldn’t write because I completed my military service :)

Now I will try to continue where I was:)

Here is an example of code how to call web services with PHP…

Have a great day…

<?php
  $client = new SoapClient("https://maximoserver/meaweb/wsdl/EXTSYS1_VRINCIDENTSRV.wsdl", array('login' => "maxadmin", 'password' => "maxadmin"));
 
$paramsChild->ENVIRONMENT = "Production";
$paramsChild->REPORTEDBY = "MAXADMIN";
$paramsChild->AFFECTEDPERSON = "MAXADMIN";
$paramsChild->CLASSIFICATIONID = "TESTCLASSIFICATION";
$paramsChild->CLASSSTRUCTUREID = "13495";
$paramsChild->IMPACT = "4";
$paramsChild->URGENCY = "3";
$paramsChild->DESCRIPTION = "soap test php";
$paramsChild->DESCRIPTION_LONGDESCRIPTION = "soap php Long Description";
$paramsChild->ISCURRENTQUEUE = "TESTQUEUE";
 
$paramsParent->INCIDENT = $paramsChild;
 
$params->VRINCIDENTSet = $paramsParent;
 
  try{
    $incident = $client->CreateVRINCIDENT($params);    
    $ticketid = $incident->INCIDENTMboKeySet->INCIDENT->TICKETID->_;
    echo "Incident Number:" . $ticketid;
  }
  catch (Exception $exc){
  echo "Soap Error: " . $exc->getMessage();
  }
?>

Thanks to Sercan Keskin for this code example…

make a comment

Turkish Language Support for TSRM

Finally Turkish language is officially supported by IBM. You can install Turkish pack with 7.1.1.7 MBS.

Thanks IBM for supporting Turkish.. I will finally able to use Maximo in my own language..

read comment here

Link for ResultSet

Hello;

It’s been a while since I wrote :( . I am a little busier then ever.. Today I learnt something new that I should share with you..

You can create links to the resultset in Maximo.. Here is an example:

http://maximo1/maximo/ui/?event=loadapp&value=wotrack&additionalevent=sqlwhere&additionaleventvalue=reportedby in (‘MAXADMIN’)

Here: Workorder Tracking (wotrack) will be loaded with SQL (reportedby in (‘MAXADMIN’))

This will give you the all workorders which are reported by MAXADMIN..

You can change wotrack with any application and sql sentence with whatever you want…

Have a good day..

read comments here

New IBM Resources

Hello;

As I noticed yesterday IBM published some new materials for Maximo 7.x
Here is the development guide for Maximo 7:
http://www-01.ibm.com/software/brandcatalog/portal/opal/details?catalog.label=1TW10MA2K

Here is the javadocs for Maximo 7.1.1.5 (Different than 7.1.1.1)
http://www-01.ibm.com/software/brandcatalog/portal/opal/details?catalog.label=1TW10MA1Z

Have a good day…

read comments here

Stop Workflow of a Closed Record

Hello;

Many people have records those are closed automatically via automation tools like Omnibus, or escalations. And these records remain in workflow even they are closed. So there is a little piece of code which can resolve this problems..
First go to the database configuration and create a relationship called “ACTIVEWORKFLOW” which can get you active workflows on the record. An example of ticket should be like this:
Name: ACTIVEWORKFLOW
Child Object: WFINSTANCE
Where Clause: ownerid=:ticketuid and ownertable=:CLASS and active=1
Remarks: Gets the related active workflow instances

Now create the class and rebuild redeploy maximo.ear..
Now all you have to do is to create an escalation which runs every 10 minutes.(Or whatever you want) Make sure you have stated closed records in where clause.. (Write historyflag=1 for workorder or ticket objects)
And make it run…

Note: You can run this code for every object. Because the code is written for Mbo Object.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package custom.common.action;
 
import java.rmi.RemoteException;
 
import psdi.mbo.MboRemote;
import psdi.util.MXException;
import psdi.workflow.WFInstanceRemote;
import psdi.workflow.WFInstanceSetRemote;
 
public class stopWFonClosedRecords implements
psdi.common.action.ActionCustomClass {
 
public void applyCustomAction(MboRemote mbo, Object[] arg1)
throws MXException, RemoteException {
// TODO Auto-generated method stub
WFInstanceSetRemote wfInstanceSet=(WFInstanceSetRemote) mbo.getMboSet("ACTIVEWORKFLOW");
if(!wfInstanceSet.isEmpty()){
for(int i=0;i<wfInstanceSet.count();i++){
WFInstanceRemote wfInst=(WFInstanceRemote) wfInstanceSet.getMbo(i);
wfInst.stopWorkflow("Auto Stop");  // Memo of the transaction...
wfInstanceSet.save();
}
}
 
}
}

make a comment

Route workflow from a table row

Hello;

Sometimes you need to start workflow of child records from the parent record… For example you have a problem record and there are 5 child activities. Normally you have to start workflow by going to the related record. With this piece of code you can start workflow from the Activities table of the parent problem record.
First create a ROUTEWF Button in the table. To do this drop a new tablecol to the table. And select Event as type. Select a route image. And enter ROUTEWF as event name.
Then change the bean class name to your class which you are creating now. (Be careful; I extended Problem activities table bean class here, you should extend whatever you need.)
Write your workflow name to the WFNAME in the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package custom.beans.app.problem;
 
import com.ibm.tsd.pmcom.webclient.beans.PmActivitiesBean;
import psdi.app.workorder.WOActivityRemote;
import psdi.server.MXServer;
import psdi.webclient.system.controller.SessionContext;
import psdi.workflow.WorkFlowServiceRemote;
 
public class problemActivitiesBean extends PmActivitiesBean
{
public int ROUTEWF()
{
MXServer mxs;
try
{
mxs = MXServer.getMXServer();
WorkFlowServiceRemote wsrmt = (WorkFlowServiceRemote)mxs.lookup("WORKFLOW");
 
WOActivityRemote mbo = (WOActivityRemote)getMbo();
wsrmt.initiateWorkflow("WFNAME", mbo);
fireStructureChangedEvent();
refreshTable();
this.sessionContext.queueRefreshEvent();
}
catch (Exception e)
{
e.printStackTrace();
}
return 1;
}
}

You’re good to go now;

Have a good day…

read comments here


Switch to our mobile site