- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 07:00 AM
Hi All,
I have created a email notification in alm_hardware table and I wanted to add a custom field (u_hostname) from cmdb_ci_computer table to that notification. How can we add this?
If anyone implemented this, please help me with steps.
Thanks in advance!!
Ajith Pillai
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 08:12 AM
Hi @Ajith A Pillai ,
You can achieve using email script. use below code in your email script.
var hostname= '';
var gr = new GlideRecord('cmdb_ci_computer');
gr.addQuery('asset', current.sys_id);
gr.query();
if (gr.next())
hostname= gr.u_hostname;
template.print('Host Name: ' + hostname);
I have tested this, it will work.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 08:12 AM
Hi @Ajith A Pillai ,
You can achieve using email script. use below code in your email script.
var hostname= '';
var gr = new GlideRecord('cmdb_ci_computer');
gr.addQuery('asset', current.sys_id);
gr.query();
if (gr.next())
hostname= gr.u_hostname;
template.print('Host Name: ' + hostname);
I have tested this, it will work.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------