Need to create a new ptask when one ptask closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 01:10 AM
In the problem record moves to RCA state, automatically one Ptask generated that is called "TEST". Once the TEST Ptask closed again one new Ptask should be auto generated. Can some one help me with the script and conditions on using business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 03:09 AM
Hi Praghatiesh,
Write on change client script.
In client script call script include to create PTASK.
Or
You can achieve with flow designer.
Please mark my reply helpful If I have answered you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 03:24 AM
In problem, the task are specific, if you want the same type of task as 2nd one, best option go low code. Create a Flow on problem table and
Action
Create task
but here if there are 2- 3 task opened, ( may be different type) then you need to put a condition. Also in problem generally task creation done manually.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 03:30 AM
Better approach is to use a flow for this but if you want to proceed with a Business Rule, you can try as below :
Create an after update business rule on problem_task table with conditions like short_description contains Test or description contains Test and State is Closed ( Please modify the conditions as per your requirement) and make use of the below script to get the new Problem Task created.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.addInfoMessage(current.problem);
var pTask = new GlideRecord('problem_task');
pTask.initialize();
pTask.short_description = 'Problem Task 2';
pTask.problem_task_type = 'general';
pTask.problem = current.problem;
pTask.insert();
})(current, previous);
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 08:29 PM
If my response is able to help you, please mark the answer correct as well for others to reference.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.