We are using Info @ hand and the workflow has a bug.
If you do a workflow in case to create a task, it creates over 500 tasks. thus the reason i am trying this script.
What i am trying to achieve is when case status equels -- to create a task calledd --. but in this script it keeps creating the tasks everytime i edit a case and the status stays the same, or even when i edit the task a new task gets created.
How would i be able to fix this, or does someone know how to fix the info@hand workflow from multiplying.
DELIMITER $$
USE `======`$$
DROP TRIGGER /*!50032 IF EXISTS */ `Cases`$$
CREATE
/*!50017 DEFINER = 'eeeeee'@'localhost' */
TRIGGER `Cases` AFTER UPDATE ON `cases`
FOR EACH ROW BEGIN
INSERT INTO tasks (id,date_entered,date_modified,assigned_user_id,mo dified_user_id,created_by,
NAME,STATUS,date_due_flag,date_start_flag,parent_t ype,parent_id,priority,description)
SELECT MD5(RAND()) AS id,
CURDATE()AS 'd1',
CURDATE() AS 'D2',
assigned_user_id,
modified_user_id,
created_by,
CASE
WHEN STATUS = 'Obtain Info' THEN 'Gather Info'
WHEN STATUS = 'Contact Client' THEN 'Contact Client to get more info'
END AS 'taskname',
'Not Started' AS 'caseSTATUS',
'on' AS 'on121',
'on' AS 'on1',
'Cases' AS 'beantype',
cases.id AS 'Caseid',
'p2' AS 'peep',
CASE
WHEN STATUS = 'Obtain Info' THEN 'Gather all relevant information need to assist the SP'
WHEN STATUS = 'Contact Client' THEN 'Contact Client to get more info'
END AS 'description'
FROM cases
$$
DELIMITER ;


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks