- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:04 AM
Hi,
I want to get the configuration item and assignment group auto populate when the incident created using before BR.
please suggest the script how get the above values.
examples: Configuration item = server,
assignment group= test group.
regards,
venkatesh t
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:10 AM
Hi @t venkatesh1 ,
Whats your condition here ?
You can add the below code :
current.assignment_group = ''pass the sys_id of the group"
current.configuration_item="sys_id of the CI"
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:42 AM
Hi @t venkatesh1,
By using before Business rule it can be achieved by below code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.assignment_group= '019ad92ec7230010393d265c95c260dd';
current.cmdb_ci = 'b4fd7c8437201000deeabfc8bcbe5dc1';
})(current, previous);
But thing is when you load the form then that time field will be empty and when you save the record then it will be auto populate.
But if you want to auto populate when the form is loaded then you need to create the onLoad client script to get this and code is shared below:
Please mark my answer as accept if resolves your query.
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:10 AM
Hi @t venkatesh1 ,
Whats your condition here ?
You can add the below code :
current.assignment_group = ''pass the sys_id of the group"
current.configuration_item="sys_id of the CI"
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:42 AM
Hi @t venkatesh1,
By using before Business rule it can be achieved by below code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.assignment_group= '019ad92ec7230010393d265c95c260dd';
current.cmdb_ci = 'b4fd7c8437201000deeabfc8bcbe5dc1';
})(current, previous);
But thing is when you load the form then that time field will be empty and when you save the record then it will be auto populate.
But if you want to auto populate when the form is loaded then you need to create the onLoad client script to get this and code is shared below:
Please mark my answer as accept if resolves your query.
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 02:00 AM
Hi @t venkatesh1,
By using before Business rule it can be achieved by below code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.assignment_group= '019ad92ec7230010393d265c95c260dd';//replace with your group sys id
current.cmdb_ci = 'b4fd7c8437201000deeabfc8bcbe5dc1';// replace with your config item
})(current, previous);
But thing is when you load the form then that time field will be empty and when you save the record then it will be auto populate.
But if you want to auto populate when the form is loaded then you need to create the onLoad client script to get this and code is shared below:
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setValue('assignment_group','019ad92ec7230010393d265c95c260dd');// 2nd para will take sys id as it is refrence field
g_form.setValue('cmdb_ci', 'b4fd7c8437201000deeabfc8bcbe5dc1');// 2nd para will take sys id as it is refrence field
}
Please mark my answer as accept if resolves your query.
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:50 AM
Hi @t venkatesh1 ,
Please create Before Business Rule, add appropriate condition and add below script
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.assignment_group= '<sys_id of assignment Group>';
current.cmdb_ci = 'sys_id of of cmdb_ci';
})(current, previous);
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak