Friday, August 29, 2025

Download and zip multiple attachments - via automation script

  • Maximo attachments upload and download attachemnts one at a time.
  • There is no out of the Box option to select multiple attachments and download at once.
  • Here is a way to achive this via cusom dialog and automation sctipt.

Add custom dialog:

  • Modify or clone the View attachments dialog
  • Add a checkbox in the dialog to select the documents.

Type: Event

Event: toggleselectrow

  • Add a 'Download' custom action button at the footer of dialog.

Automation Script:
  • Create an action launch point for the button and write below code

from psdi.util import MXApplicationException;
from java.io import FileOutputStream;
from java.io import FileInputStream;
from java.nio.file import Paths;
from java.nio.file import Files;
from java.util.zip import ZipOutputStream;
from java.util.zip import ZipEntry;
from java.io import File;

if launchPoint=='<>':
    session=service.webclientsession()
    docTable=session.getDataBean("<dialog_id>")
    docVector=docTable.getSelection()
    
    filePaths=[]
    for doc in docVector:
        file=doc.getString("URLNAME")
        filePaths.append(file)
    
    downLoadPath="C:\\Users\\Public\\Downloads\\";
    fullPath=downLoadPath+"<FileName>.zip";
    fos = FileOutputStream(fullPath);
    zipOut = ZipOutputStream(fos);
  
    try:
        for filePath in filePaths:
            fileToZip = File(filePath);
            fis = FileInputStream(fileToZip);
            zipEntry = ZipEntry(fileToZip.getName());
            zipOut.putNextEntry(zipEntry);
            bytes = Files.readAllBytes(Paths.get(filePath));
            zipOut.write(bytes, 0, len(bytes));
            fis.close();
        zipOut.close();
        fos.close();
        print ("Compressed the Files to " +str(fullPath));        
																   
    except MXApplicationException as me:
        print ("Maximo Error : " + str(e));
    except Exception as e :
        print ("Error : " + str(e));

Sunday, June 29, 2025

Querying Maximo Status Tables

  • Maximo status tables are used to track the status changes and helpful to understand business flow in various modules like workorder, procurement etc.
  • Querying the status tables for specific record is simple, that by using record key as parameter (WONUM, PONUM, INVOICENUM etc.)
  • However, retrieving the previous/next status of specific status for  bulk of records can be tricky.
  • Here are few queries, that can be helpful in such cases.

Saturday, April 26, 2025

Excel Formulas - Helpful in BIRT Reports

 

  • BIRT reports are widely used in Maximo and sometimes require to build reports with many columns and field mapping.
  • I’ve been using excel formulas to generate scripts for Open, Fetch method
  • These are simple text formulas, yet useful for working with reports with many columns.

Open Method:

To Convert 'Select Query' for Open Method

Enter the SQL query as multiple lines in Excel sheet. Example: column A

Apply the formula in column B as below.

For First row only:

=CONCAT("var sqlText=""",A1,"""")

For other rows:

=CONCAT("+ "" ",A2,"""")

=CONCAT("+ "" ",A3,"""")

=CONCAT("+ "" ",A4,"""")

..

...


Note: The above formula does not add/append the params["where"] or other parameters. Manually edit before using it.



Fetch Method:

To Generate Fetch method field mapping scripts.

Copy the BIRT report dataSet field names to column A in excel sheet

Copy the Select Query Field names from 'Open method' to column B in excel sheet

Enter the formulas in Column C as below to generate Script of Fetch method

=CONCAT("row[""",A2,"""] = maximoDataSet.getString(""",B2,""");")

=CONCAT("row[""",A3,"""] = maximoDataSet.getTimestamp(""",B3,""");")

=CONCAT("row[""",A4,"""] = maximoDataSet.getInteger(""",B4,""");")




Extract 'Select Query' from 'Open Method’ sqlText:

Copy the value of sqlText Variable from Open method to 'A1' cell in column in excel sheet.

Apply the below formula in another cell. This will convert the sqlText to executable query.

=SUBSTITUTE(SUBSTITUTE(A1,"+ """,),"""",)






Saturday, March 22, 2025

Unlock the Maximo Start Center template via SQL

Maximo Start centers are useful to view different types of user data such as Workflow assignments, Result sets and other portals like Favourite applications, Bulletin board etc.

Each Start center is assigned to specific 'Security group' and Users can be granted 'access to edit' the portal themselves.

·    When a user opens the start center template to edit, a record will be inserted in SCCONFIG table with ‘groupnname as NULL’


·      If any other user tries to edit the same template, will get an error message as below.

·   Start center become locked for other user to edit and must wait until the main user Finish/Cancel the changes

·   In case, the main user is not reachable, or intermittently blocked access, it becomes impossible for others to edit.

·   There is a workaround to this by removing the entries in SCCONFIG, LAYOUT and other portal tables such as RSCONFIG, INBXCONFIG etc.


Here are the detailed steps.

1.  Query the SCCONFIG as below and get the layoutid

select scconfigid,* from scconfig (nolock) where sctemplateid=1601 and groupname is null;

2.  Query the SCCONFIG and LAYOUT tables using inner join to fetch related portal details.

select lo.scconfigid,layoutid,portletid,* from scconfig sc

inner join layout lo on sc.scconfigid=lo.scconfigid

where sc.sctemplateid=<>and sc.groupname is null and portletid<>'BBOARD'

Note: Bulletin board is not editable and no table for BBOARD. Hence it is excluded in the results.


Copy the LayoutIDs of each portal table.


 

3.  Generate and Execute the "Deletion Scripts' to remove entries from SCCONFIG, LAYOUT and Other Portal tables by using scconfigidlayoutid copied from above step.

delete from SCCONFIG where sctemplateid=<> and groupname is null and scconfigid=<scconfigid>;
delete from LAYOUT where scconfigid=<scconfigid>;
delete from ACTIONSCFG where layoutid=<layoutid>;
delete from FACONFIG where layoutid=<layoutid>;
delete from RSCONFIG where layoutid=<layoutid>;
delete from RSCONFIG where layoutid=<layoutid>; 
delete from INBXCONFIG where layoutid=<layoutid>;

Execute the script.

    Now, try opening the star center template, it will be editable.


Download and zip multiple attachments - via automation script

Maximo attachments upload and download attachemnts one at a time. There is no out of the Box option to select multiple attachments and downl...