- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2022 03:56 AM
- Whenever any new Demand is created with Company as TECHS, new Demand Task will be automatically created.
The number of demand tasks created will depend on the number of values in the 'Business application' field in the demand record . if there are two values in the 'Business application' field then there will be two tasks created one for each business application.
Note-Business application is a List collector
The field mapping would be :
Priority- 2
shortdescription- task created for $business application
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 01:04 AM
For your second part of query, for setting the priority as None but it's not happening because Priority is a Field on Task Table and has a Default value being set in it as shown below which is 4 i.e. Low and hence when ever a task is getting created it is setting it as Low:
Now in order to override this , Right click on Priority field and select Configure Dictionary and then scroll down to Dictionary Override as shown below:
Click on New Button:
Select Table as Demand Task and then select the check box as Override Default Value and leave it blank value in below field of Default value:
Now when your Demand Task will be created the priority value will be empty as you want as shown below:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 12:59 AM
Hi,
You just need to update the same script. I have modified it for you, please use the modified script below which will copy the Business Application Name to Short Description of Demand task:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var getCurrentBusinessApplications = current.business_applications;
var splitApplications = getCurrentBusinessApplications.split(',');
for(var i=0;i<splitApplications.length;i++){
createDemandtask(splitApplications[i]);
}
function createDemandtask(applicationName){
var gr = new GlideRecord('dmn_demand_task');
gr.initialize();
gr.parent = current.sys_id;
gr.short_description = getApplicationName(applicationName);
//gr.FIELDNAME = current.FIELDNAME; // Replace "FIELDNAME" in case you want to copy field values as well
gr.insert();
}
function getApplicationName(applicationName){
var gr1 = new GlideRecord('cmdb_ci_business_app');
gr1.addQuery('sys_id',applicationName);
gr1.query();
if(gr1.next()){
return gr1.name.toString();
}
}
})(current, previous);
This is working for me in my PDI.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 01:04 AM
For your second part of query, for setting the priority as None but it's not happening because Priority is a Field on Task Table and has a Default value being set in it as shown below which is 4 i.e. Low and hence when ever a task is getting created it is setting it as Low:
Now in order to override this , Right click on Priority field and select Configure Dictionary and then scroll down to Dictionary Override as shown below:
Click on New Button:
Select Table as Demand Task and then select the check box as Override Default Value and leave it blank value in below field of Default value:
Now when your Demand Task will be created the priority value will be empty as you want as shown below:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 04:19 AM
Will this script also work when i update the business application on existing demand record by just checking the update operation in the business rule.
I did some testing , i added one business application in the existing demand record it created the duplicate tasks along with the new task for new business application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 04:50 AM
Yes it will work for Update as well if you select the Update Checkbox in your existing BR.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 05:16 AM
Its working but when i add a new business application to the existing business application , its creating duplicate tasks.
Like if data management and event management are already added as business application in demand record and later i add a third business application to the existing list . It should create only third task .Total it should be three tasks.
But when i check the update in the BR , its creating 5 tasks.
Any idea to this?
Thanks in advance!