Here is a script that will do it for you with the Mbos. It may not be super fast but it will just work through the list of Mbos. There is a set that is marked discardable to get the list of ids and then another set to actually do the update. There should only ever be one Mbo in memory at a time so looping through the entire set should be fine as far as performance and memory goes.
MXServer = Java.type("psdi.server.MXServer");
MboConstants = Java.type("psdi.mbo.MboConstants");
main()
function main(){
var assetSet;
try{
assetSet = MXServer.getMXServer().getMboSet("ASSET", MXServer.getMXServer().getSystemUserInfo());
assetSet.setFlag(MboConstants.DISCARDABLE, true);
var asset = assetSet.moveFirst();
while(asset){
updateLongDescription(asset.getUniqueIDValue());
asset = assetSet.moveNext();
}
}finally{
_close(assetSet);
}
}
function updateLongDescription(id){
var assetSet;
try{
assetSet = MXServer.getMXServer().getMboSet("ASSET", MXServer.getMXServer().getSystemUserInfo());
var asset = assetSet.getMboForUniqueId(id);
asset.setValue("DESCRIPTION_LONGDESCRIPTION", asset.getString("DESCRIPTION"));
assetSet.save();
}finally{
_close(assetSet);
}
}
function _close(set){
if(set && set instanceof Java.type("psdi.mbo.MboSet")){
try{
set.close();
set.cleanup();
}catch(ignored){}
}
}
var scriptConfig={
"autoscript": "MIGRATE.ASSET.DESCRIPTION",
"description": "Migrate the asset description to the long description field.",
"version": "",
"active": true,
"logLevel": "ERROR"
};
------------------------------
Jason VenHuizen
Sharptree
------------------------------
Original Message:
Sent: 10-06-2023 06:47
From: Deepa P
Subject: Copy asset description to asset long description
Hi,
We have a requirement to copy the asset description to asset long description field. I found that longdescription table in db is empty ,so i guess update wont work we will have to use insert.
I tried inserting, but data is just showing in the database not in the ui. What can be reason of that. I can share the query i am using if required
#Administration
#Analytics
#EndUser
#EverythingMaximo
#Utilities
#MaximoVisualInspection
------------------------------
Deepa P
------------------------------