UI Macro on Incident form to display User/Caller Assigned Assets

JesseEmoryATL
Tera Contributor

I have seen a UI Macro associated with user records that can display the user's assigned assets.  I don't think this is out-of-the-box like the Show Related Incidents UI Macro on an Incident Form.  

find_real_file.png

This allows the agent to easily associate the incident with an assigned CI/Asset.  When you click on a "Show Assigned Assets" button next to a user record, it would auto-fill the CI field on the form.  Does anyone have an idea of how I could create/implement something like this?  It's been a while since I have seen this and I am not quite sure where I actually saw it.

3 REPLIES 3

Yousaf
Giga Sage

Hi Jesse,

This is not exactly what you want i think but this should give you and idea

In system UI > UI Macros Check this one please

find_real_file.png

 

Mark correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Thank you. I'll see if that can help me get what I need and report back

Sagar Pagar
Tera Patron

Hi,

You have to create UI macro for the same. where once you click on it, you have to set the CI to CI field.

<script>
		function addCI(reference) {
		// Hide any field messages
		
		// get the CI / assets and set to CI field
		
		g_form.setValue("fieldname", value);
		}
		else{
		//Display a field error message
		g_form.showFieldMsg('cmdb_ci', 'no CI associated with user, 'error');
		}
		}
		}
	</script>

 

Thanks,

Sagar Pagar

The world works with ServiceNow