Ui Action

vishakha932
Tera Contributor

Introduce New UI Action called "Reject RCA" in problem form.Please consider below scenario
i)Above button should be visible only after "Problem RCA Submission" task completed

1 ACCEPTED SOLUTION

Mark Manders
Tera Patron

What isn't working for you? Please let us know what you already tried and where you are stuck. 

 

View solution in original post

2 REPLIES 2

Mark Manders
Tera Patron

What isn't working for you? Please let us know what you already tried and where you are stuck. 

 

vishakha932
Tera Contributor
(function executeRejectRCAAction(current) {

    var taskGR = new GlideRecord('problem_task');
    taskGR.addQuery('problem', current.sys_id);
    taskGR.addQuery('short_description', 'Problem RCA Submission');
    taskGR.query();

    while (taskGR.next()) {
        // First set to an intermediate state if needed (e.g., Pending Review or Resolved)
        taskGR.state = '155'; // Replace with allowed intermediate state ID if needed
        taskGR.update();

        // Then move to Closed Complete (state = 3)
        taskGR.state = '154'; // 3 = Closed Complete (commonly used for task closure)
        taskGR.close_code = 'Closed/Complete'; // Optional: set close code if your table has this field
        taskGR.work_notes = 'Closed via Reject RCA action';
        taskGR.update();
    }
})(current);
this are the code and i am stuck in this error "Problem task model 'General' prevented state transition from Assess to Closed"