Not able to fetch value from Hardware table

Community Alums
Not applicable

Hi Team,

 

Initially a String Field was created on alm_hardware table with some choices.Now as per the requirement we needed to create the same field on alm_asset table so that in future if other child class wants to leverage the same, it will be feasible and delete the field from Hardware table

 

Field Name on Hardware form is u_transaction_type

Field Name on Asset form is u_transactiontype

Both the field are of type string. 

Now I need to copy data from field on Hardware form to the field on asset form.

I wrote the below Fix Script to copy the data but its not working:

 

var gr = new GlideRecord('alm_asset');
gr.addQuery('u_transaction_type', '!=', '');// This field on Hardware table
gr.addQuery('u_transactiontype', ''); // Field on asset table
gr.setLimit(2);
gs.info('Total record:'+gr.getRowCount());
gr.query();
while (gr.next()) {
    gs.log('Transaction Type:' + gr.u_transactiontype); // Here I am getting Blank or NULL value
    gr.u_transactiontype = gr.u_transaction_type;
    gr.update();

}
 
Kindly help in resolving the issue. I am not able to fetch the value from Transaction Type field on Hardware table
1 ACCEPTED SOLUTION

Kristen Ankeny
Kilo Sage

Instead of running against the alm_asset table, run it against the hardware table - it will have access to both fields.

View solution in original post

2 REPLIES 2

Kristen Ankeny
Kilo Sage

Instead of running against the alm_asset table, run it against the hardware table - it will have access to both fields.

Community Alums
Not applicable

Below is the list of choice on hardware table for Transaction Type Field:

Ankur20_0-1715185018031.png

Below is the list of choice on asset table for Transaction Type Field:

Ankur20_1-1715185054396.png