Asset assignment history on user form.

Kalyani21
Mega Guru

Hello Team,

 

My requirement is like this:

Create a functionality to capture asset assignment history. This functionality will be developed to track asset assignment history on the user profile. On user form, a new related list will be created which captures the asset assignment history.

 

Can you please guide me?

Thank you.

 

 

Regards,

Kalyani Shaha

2 REPLIES 2

Abhijeet_Pawar
Tera Guru

Hello @Kalyani21 ,

to achieve this requirement, you need write after update business rule on Asset(alm_asset) table.

after that you need to create one custom table which will hold history of assigned asset.

and then configure related list on User(sys_user) form and select that table from slush bucket.

(function executeRule(current, previous /*null when async*/) {

	if (current.assigned_to.changes()) {
// Create a new record in the 'Asset Assignment History' table
var history = new GlideRecord('u_asset_assignment_history');
history.initialize();
//history.asset = current.sys_id;
history.u_assigned_to = current.assigned_to;
history.u_assigned_on = new GlideDateTime(); // Current date/time
history.u_asset_name=current.sys_id;
history.insert();
}

})(current, previous);

 If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 

Thanks, and regards,
Abhijeet Pawar.

Pankaj kr
Kilo Sage

Hi Kalyani,

 

This is inbuilt in servicenow. You just have to use and teach other to use the activities tab filters. I did this for my convenience when I was part of configuration management team.

 

Please mark my answer helpful if it helps you.

 

Thanks,

 

Pankaj kumar