want to populate description field only when selected CI's class is Application service
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:14 AM - edited 06-05-2025 05:43 AM
Hello All,
I want to populate description field only when the selected configuration item's class is 'Application service' in configuration item field using script include and client script. I tried but no luck because of every class in configuration item is referring to a table. I glided the cmdb_ci as grCI table and used if(grCI.sys_class_name== cmdb_ci_service_auto) but it is not fetching the the CI's which are under Application Service class.
I copied the query from cmdb_ci table as class is Application service and got this query as sys_class_name=cmdb_ci_service_auto and I used this in script but not working. Can anyone help me on the script include
Script inlude:
configurationItem: function(){
var applicationService= this.getParameter('sysparm_ci');
var grCI= new GlideRecord('cmdb_ci');
grCI.query();
while(grCI.next()){
if(grCI.sys_class_name== cmdb_ci_service_auto'){
return true;
} else {
return false;
}
},
Even the selected CI's class is 'Application Service' then also not working not going into if loop.
Client script is working fine
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:16 AM
Please provide your client script and script include so we can see where it's going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:22 AM
Yes, Adding the script in my post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:18 AM
Are you trying to do this on incident form? Use case : when you populate ci which is application service then you want to auto populate description.
Question : Is it any fix value you want to populate or something from the application service?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:22 AM
I want to populate description field on Change form when the selected CI's class only Application Service. I'm adding the script in my post.