Set new Fields Null on Duplicate

Hello;

Sometimes you add new fields to the maximo mbo’s. And when you duplicate the mbo new fields are filled automatically… You should customize java to prevent this.. I will use ITEM object in this example….We are extending psdi.webclient.beans.item.ItemAppBean class in bean classes. Then we put this class into %MAXIMOROOT%\applications\maximo\maximouiweb\webmodule\WEB-INF\classes\com\item

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.item;
 
import java.rmi.RemoteException;
import psdi.util.MXException;
 
public class newItem extends psdi.webclient.beans.item.ItemAppBean
{
 
            public newItem()
            {
            }
 
            public int DUPLICATE() throws MXException, RemoteException
            {
            super.DUPLICATE();
            getMbo().setValueNull("NEWFIELD",2L);    
	    getMbo().fireStructureChangedEvent();
	    sessionContext.queueRefreshEvent();
            return 1;
            }   
}

Here we first duplicate the item object.. Then set NEWFIELD nulll.. Then we refresh the page…

After compile,build/deploy, we should open application designer…
From “Select Action” menu click “Toggle show all controls” Then on the page we select presentation.. Then we write com.item.newItem to the bean class field… We save the application… Then test it…

Have a good day…

4 Responses

  1. Cristiano Says:

    Hi,

    It’s better to extend the Mbo and override its duplicate() method. This way you don’t have to refresh the page, and the logic works for MEA and Mobile also.

    Also, in the setValueNull() call, it’s better to use the constants in MboConstants than the literal value, it’s more readable and resistant to changes

    Cristiano

  2. admin Says:

    Hello;
    Here I wanted to give a bean example. This also could be done with mbo class. And you are right. literal values are just the habit. It is harder to read this way..

    Thanks..

  3. Ravinder M Says:

    Hi,

    Can any one please explain, when exactly we need to go for bean extension or MBO Customization? What is the exact difference between both of these?

    Thanks in advance….

    Ravinder M

  4. Jerold Bitton Says:

    Great blog post, I will bookmark this in my Clipmarks account. Have a awesome day.

Leave a Reply


Switch to our mobile site