HR tasks in draft state are shown in My Next tasks to employees but not in Journey Details pageDescriptionHR tasks in draft state are shown in My Next tasks to employees but not in Journey Details pageSteps to Reproduce THIS IS FROM CUSTOMER: CS7155121, CSTASK760318.1. Go to HR Templates and Create a New one as shown in the screenshot (Make sure the state is set to draft).2. Go to Manage LifeCycle Events3. Click on New Hire Demo > Activity Sets4. Add a New Activity in the first Activity Set with Activity type as HR Task and Choose The newly created HR Template in the template section. (See attached screenshots) 5. Create a new "New Hire Journey" on esc portal for an employee 6. Now on native view Observe that task created in the first activity set of created journey is in draft state. Make that task overdue by setting due_date of the task in past7. Now impersonate as the employee for which the journey is created and go to the /esc?id=jny_journeys page 8. Observe that the task created appears in Next tasks widget however when you open the journey details page for same journey the task is not present9. Expected: Draft tasks should not even appear in My Next tasks widget. (See attached doc for more details).Please make sure the fix works on Mobile and NowMobile app as well without breaking functionality.WorkaroundPossible Solution: While Fetching the tasks for My Next tasks widget, Fetch the state of the tasks too: Add the following Function in the Script include: jny_JourneyServiceSNC (sys_id: f81f3353c35901102920b8889d40dd3f) /** * Return state for task record * * @param {GlideRecord} taskRecord - GlideRecord of task * * @returns {String} - state_number of the task */ _getTaskState: function(taskRecord) { if (!taskRecord) return ""; // Fetch new instance of the record as parent is referencing to task var gr = new GlideRecord(taskRecord.sys_class_name); if (!gr.get(taskRecord.sys_id)) return ""; return gr.state; }, Now in the same script include Modify the following functions: 1. getAllTasks: getAllTasks: function(caseIds, userId, parentToJourneyMap, limit, fetchNoDueDateTasks) { var tasks = []; ........................ ........................ ........................ ........................ task.is_over_due = this._isTaskOverdue(task); task.state = this._getTaskState(taskRecords); // <-- This line needs to be added tasks.push(task); ........................ ........................ return tasks; }, 2. getJATasks: getJATasks: function(jaPlanIds, userId, parentToJourneyMap, limit, fetchNoDueDateTasks) { var tasks = []; .................................... .................................... .................................... task.is_over_due = this._isTaskOverdue(task); task.state = taskRecords.state; // <-- This line needs to be added. tasks.push(task); .................................... .................................... return tasks; }, Update the Script Include. Now Modify the Widget: jny_my_next_tasks (sys_id: 3fcabe96b1a10110fa9b956b2a26551b) Modify the client script: Edit the function ($rootScope.$on('store.myNextTasks')) $rootScope.$on('store.myNextTasks', function(evt, journeys) { c.data.myNextTasks = []; c.cardLinks = []; ............................ ............................ if (!tasks || tasks.length < 0) return; // Add the following lines: tasks = tasks.filter(function(t){ return t.state == 10; }); // Modification ends for (var i = 0; i < tasks.length; i++) { if (i >= c.maxTasks) ............................ ............................ }); Save these changes Open JNY Journeys page. It'll throw errors and following RCAs will be generated: Change the status of these generated RCAs to Allowed. Re-open the Journeys page and Issue will be resolved! Related Problem: PRB1738547