Search This Blog

Thursday, June 22, 2023

MAXIMO : Reset user password from backend

There are sometimes situations like lower environments like DEV , TEST ,TRAINING etc. gets refreshed from Production and all users get inactivated , password reset to default values and in some situations default values gets changes without notice and you had to wait for onshore counter part to be available to share details .


This can be dealt with updating you user's password from backend , generally developers have such access in development environments.

Below are details how to do this in different flavors of databases : 

First of all, get the encrypted password string of maxadmin user, where  for e.g. password is 'maxadmin'

SQL> Select userid, password from maxuser where userid = 'MAXADMIN'


output :
USERID PASSWORD
--------- --------------------------------
MAXADMIN x'10FE6F4650B2ACB49A2121D7E6133E64'

Now update user's password with this string, so that the password would be same like maxadmin's password

Oracle:
UPDATE maxuser
SET PASSWORD = '10fe6f4650b2acb49a2121d7e6133e64'    --
WHERE userid = 'XXXX' --user

SQL Server:
UPDATE maxuser
SET PASSWORD = 0x10fe6f4650b2acb49a2121d7e6133e64    --0x
WHERE userid = 'XXXXX' --user

DB2:
UPDATE maxuser
SET PASSWORD =x'10fe6f4650b2acb49a2121d7e6133e64'    --x''
WHERE userid = 'XXXX' --user


Reference: http://www-01.ibm.com/support/docview.wss?uid=swg21645570

Monday, June 19, 2023

MAXIMO : Automation Script to invoke external URL without Publish Channel or Invocation Channel

Maximo integration capabilities like Publish Channels , Invocation Channels provide way for invoking external service via HTTP calls.


But there are sometimes needs where external API needs to be triggered during processing logic within user interaction and continuation of user activity through API call return/processing.

Get Data from External API Call:

So we can use ScriptService class and its method httpgetasjson to get the data from external API call and then continue maximo operation using the data requested from external api by user's activity.

 service.httpgetasjson(<url>, <userid>, <headers>, <password>)

Here we can call API "URL" and pass connection and header parameters.


Here is sample code snippet :

from com.ibm.json.java import JSONObject, JSONArray

# Invoking an URL

url = "https://www.external-api.com/" userid = api-user passwd = api-pwd # Invoke URL response = service.httpgetasjson(url, userid, None, passwd) status = response.getStatusLine().getStatusCode() obj = JSONArray.parse(response.getEntity().getContent()) if status == 200: # OK else: # error


Push Data to External API :

So we can use ScriptService class and its method httppostasjson to post the 

data from maximo to external API call.

service.httppostasjson(<url>,<userid>,<password>, <headers>, <json>)

Here is sample code snippet

from com.ibm.json.java import JSONObject, JSONArray

# create a JSON object jsonObject = JSONObject() jsonObject.put("equipment", mbo.getString("ASSETNUM")) jsonObject.put("description", mbo.getString("DESCRIPTION")) # Invoking an URL url = "https://www.external-api.com/" userid = api-user passwd = api-pwd # Invoke URL response = service.httppostasjson(url, userid, passwd, None, jsonObject) status = response.getStatusLine().getStatusCode() obj = JSONArray.parse(response.getEntity().getContent()) if status == 200: # OK else: # error

MAXIMO : Automation Script to Route Workflow

Workflow is key feature in IBM Maximo for automating business processes like Workroder lifecycle , Purchase Order cycle etc. 

There are many situations where it would need to trigger specific Workflow process if there are multiple active processes on object as only one process can be enabled for auto initiation. 

Below I will discuss few methods how we can achieve specific workflow process using Automation Scripts : 

 *****WorkFlowService class***** 
 Here in this approach a workflow needing to route with a certain business logic:
***** ScriptService class***** 

 Another approach is to utilize ScriptServiceclass:
Additionally to stop a Workflow Instance: 

We can stop an active workflow instance using WorkFlowService class and its method stopWorkflow.

Friday, June 2, 2023

MAXIMO : Automation Script - Execute SQL for data correction without having DB access

Here is an example of an automation script that can be used to for any data correction situation where it needs to execute update/SQL scripts on backend database directly and it can be done without having direct DB access to execute SQLs using DB client tools. 

For example we are needing to correct PO details such that PO have corrupt status and receipts completion and need back end correction. 

We will need to update latest revision status to APPR and previous revision status to REVISD along with marking receipts complete on latest revision by running SQL Update , Insert statements using automation Script. High level steps :

 1.  We will need to create automation script without any launchpoint. 
 2.  We will have to pass required values in request parameters for identification records to be updated  
      e.g. PONUM , SITED in this case. 
3.   We will call the automation script as rest call passing parameter values and script code will run 
      required SQL statements 
     
 e.g. Update PO details for revisions , insert status history records in POSTATUS etc.

 ****************Code snippet*************************

Using this script we will make a POST request call for Maximo REST API.
The request will be authenticated using your login session or require username and password can be passed in parameters as like any REST API call. 

Automation script is fetching connection key and other details using MXserver references and calling SQL statements 

e.g. Update PO statuses for revisions and insert status history details over the connection established using MXServer.