Showing posts with label Non-persistent. Show all posts
Showing posts with label Non-persistent. Show all posts

Monday, 15 November 2021

Bulk Update any Attribute from List View | Maximo

Update multiple records or even the child records from the list view.
for instance, if you want to update any record in PR table, just write the attribute name
but for Child records like PRLINE; use the standard relationship like PRLINE.orderqty



1.  Create a non-persistent object NP_BULKUPDATE with 2 fields ATTRIBUTEVALUE, ATTRIBUTENAME.

<dialog id="NP_BULKUPDATEDIALOG" label="NP_BULKUPDATEDIALOG" mboname="NP_BULKUPDATE">
    <section id="NP_BULKUPDATEDIALOG_110">
        <sectionrow id="NP_BULKUPDATEDIALOG_111">
            <sectioncol id="NP_BULKUPDATEDIALOG_112">
                <textbox dataattribute="ATTRIBUTENAME" id="NP_BULKUPDATEDIALOG_114" />
                <textbox dataattribute="ATTRIBUTEVALUE" id="NP_BULKUPDATEDIALOG_115" inputmode="required" />
            </sectioncol>
        </sectionrow>
    </section>
    <buttongroup id="NP_BULKUPDATEDIALOG_120">
        <pushbutton default="true" id="NP_BULKUPDATEDIALOG_121" label="OK" mxevent="dialogok" />
        <pushbutton id="NP_BULKUPDATEDIALOG_122" label="Cancel" mxevent="dialogcancel" />
    </buttongroup>
</dialog>

2. create a dialog in application designer and add the above 2 fields into any application, let's say in PR application.



3. Develop an OLP script on NP_BULKUPDATE before Add and good to go. 

from psdi.mbo import MboConstants
from psdi.webclient.system.beans import ResultsBean

# to get the non persistent object
mbo = mboset.getMbo(0)

vATTRIBUTENAME = mbo.getString("ATTRIBUTENAME")
vATTRIBUTEVALUE = mbo.getString("ATTRIBUTEVALUE")

# get AppInstance object to retrieve UI properties list view
app = service.webclientsession().getCurrentApp()
# get the MboSet from the app
parentSet = app.getResultsBean().getMboSet()
#service.error('',str(app))
# this is True if the Select Records check boxes are displayed
isTableSelect = app.getResultsBean().getTableStateFlags().isFlagSet(ResultsBean.TABLE_SUBSELECT_ON)

vParent = parentSet.moveFirst()
while (vParent):
    # if Select Records is displayed we have to take action on selected records only
    # if Select Records is NOT displayed we have to take action on all records
    if vParent.isSelected() or not isTableSelect:
        vParent.setValue(vATTRIBUTENAME, vATTRIBUTEVALUE)
    vParent = parentSet.moveNext()
parentSet.save()


Extension to my confirmation dialog upon deletion post but got the idea from Bruno's article which is here:

Sunday, 14 November 2021

Confirmation dialog before Deleting PR Item, and Save It In Worklog | Maximo

Add a confirmation dialog before deleting any line in PR application. So that user will have to enter the reason of deletion and it will be saved in worklog with all the related details like who deleted, reason of deletion, what was the item number and quantity at the time of deletion.

1. add one non-persistent attribute let's say NP_REASON in the PR object.

2. Make/add a dialog in PR.XML, add NP_REASON attribute 

<dialog id="deletedialog" label="deletedialog">
<section id="1567883350896">
<sectionrow id="1567883359616">
<sectioncol id="1567883366027">
<statictext align="left" id="1597323707588" label="Are you sure, you want to delete this line?"/>
<textbox dataattribute="PRNUM" id="1567883419910" inputmode="readonly"/>
<textbox dataattribute="iTEMNUM" id="1597321688221" inputmode="readonly"/>
<textbox dataattribute="NP_REASON" id="1567892172806" inputmode="required"/>
</sectioncol>
<sectioncol id="1567883367821"/>
<sectioncol id="15678833596162"/>
</sectionrow>
</section>
<buttongroup id="mydialog_2">
<pushbutton default="true" id="mydialog_2_1" label="OK" mxevent="dialogok"/>
<pushbutton id="mydialog_2_2" label="Cancel" mxevent="dialogcancel"/>
</buttongroup>
</dialog>

3. In PRLINE tab using application designer, edit the delete button properties and modify the event property to the newly created dialog (deletedialog) as below:

event: deletedialog

4. Write an ALP automation script on PR.NP_REASON attribute, the body is as below:


vWORKLOG = mbo.getMboSet("PR.WORKLOG")
line = vWORKLOG.add()
line.setValue("LOGTYPE","CLIENTNOTE")
line.setValue("DESCRIPTION",str("Item:")+mbo.getString("itemnum")+str(" Qty:") + mbo.getString("ORDERQTY") +str(" UnitCost:") + str(mbo.getDouble("unitcost"))+str(" Reason:") + mbo.getString("NP_REASON"))
line.setValue("SITEID","KAUST")
line.setValue("RECORDKEY",mbo.getString("prnum"),2L)
line.setValue("CLASS","PR",2L)
mbo.delete()
mbo.save()



  

Sunday, 8 September 2019

Create a Custom Dialog and Save Values in Custom Object | IBM Maximo

 A requirement is to have a custom dialog box which will be called by Select Action or from workflow during status change for instance:

Below is the simplest workaround by creating a non-persisten attribute in primary object and use it in dialog then run your automation on it and do your logic to store/insert.

Step by step is as beLow:

1. add non persistent attribute in pr ojbect (NP_STATUSMEMO)
2. pr to pojust relationship: ownerid = :prnum and object='PR'
3. add signature: MYDIALOG and grant to maxeveryone
4. add actio menu and attach signature MYDIALOG as option
5. DIALOG IN pr.xml attached below, add required fields to display
6. write ALP for this attribute validate with below jython


Wednesday, 20 March 2019

Create Custom Dialog to get Input from User and perform Tasks | Maximo


  1. create a Non-Persistent Object(my_np_object) for the dialog interface
  2. create an empty relationship from the main object, say (workorder2my_np_object)
  3. create a dialog(mydialog) in presentation xml with the relationship (workorder2my_np_object)
  4. create an Action or button control to call the dialog event (mydialog)
  5. write OLP script on INIT of my_np_object, to set default values in dialog,(optional)
  6. write OLP script on before SAVE to perform action when dialog close. 





6. OLP on INIT script (optional):

mbo.setValue("ORGID", mbo.getOwner().getString("ORGID"))
mbo.setValue("SITEID", mbo.getOwner().getString("SITEID"))

7. OLP on Before SAVE 
mbo = mboset.getMbo(0)

# get the originator MBO
origWo = mbo.getOwner()

# perform your tasks here.

 

...


Guru Bruno also document it here in better details:
https://bportaluri.com/2019/08/custom-dialog-using-automation-scripts.html


Tuesday, 4 October 2016

Sorting data of the relationship attributes | IBM Maximo

Sorting:
You cannot sort data of the relationship attributes or non-persistent attributes.

Filtering:
you can filter relationship attribute but not non-persistent attributes.  


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

Monday, 22 August 2016

Custom Field in Non-persistent Object ISSUECURRENTITEM | IBM Maximo

Add a new field in ISSUE CURRENT ITEM dialog and capturing the data in the MATUSETRANS table using automation script.

if owner and owner.getRecordMboName()=="INVENTORY": issueitemMbo=owner.getMboSet("ISSUECURRENTITEM").getMbo(0) if issueitemMbo: mbo.setValue("MATUSETRANScustomaFieldName", issueitemMbo.getString("ISSUECURRENTITEMcustomFieldName"))

Thanks to SASHULL