Need to update records with record producer

Jess Larsen1
Tera Expert

Hi.

 

I need to update records on assets so it can be used for assigning assets to users. 

On the portal certain users need to be able to assign an asset to others so if they look up the asset in hand by a lookup selectbox and then have another lookup select box where they can find the user, the producer needs to update the existing record and not make a new. 

 

I have made the fields that is needed in the form, but it keeps making a new record and not updateing the existing. 

 

The table I am trying to update is alm_asset so I think I´m in the right place?

 

Hope someone can help me.

 

Best Regards

Jess Larsen

 

 

1 ACCEPTED SOLUTION

Jess Larsen1
Tera Expert

var usrGR = new GlideRecord('alm_asset');
usrGR.addQuery('sys_id', producer.v_lg_computer);
usrGR.query();
if (usrGR.next()) {
usrGR.assigned_to = producer.select_employee;
usrGR.install_status = 1;

usrGR.update();
}
gs.info(producer.select_employee);
gs.info(producer.v_lg_computer);

current.setAbortAction(true);
producer.portal_redirect = "id=sc_category";

View solution in original post

5 REPLIES 5

Thrishul
Giga Contributor

please provide the script to the update the form in the field in cmdb_ci_computer table through record producer. Also only that particular user whose assigned_to name is same as logged in user name  can update his/her record. they should not update others record other then his/her.