Removing Awaiting Acceptance in HR Case

neophyte
Kilo Expert

Has anyone successfully remove the Awaiting Acceptance State in an HR case?

What i'm trying to achieve is set the state of the ticket to Closed Complete from Work in Progress when the Closed Complete button (UI action) is clicked.

In the "sf_state_flow" table i already turn off the SF0000340.

Change the Ending state of SF0000324 to Closed Complete.

The workflow is not executing and I only change the condition so that it will not execute.

Choice List values in State are;

Closed complete = 3;

Work in progress = 18;

Awaiting acceptance = 20;

Edited the Manual script to

current.state = 3;

current.update();

When I created an HR ticket and clicking "Closed Complete" UI action the state changes to "Awaiting Acceptance" instead of "Closed Complete".

Hr history.jpg

I also tried turning off all State Flows and the OOTB UI Action.

I then created a custom UI action, and the state still changes to Awaiting Acceptance when clicking the Closed button.

Even doing a glidequery and doing update does not work, it still changes the state to Awaiting acceptance.

Below is a sample script that will set the ticket to Closed complete. However, upon gr.update the hr_case.state becomes 20 (Awaiting acceptance) instead of 3 (Closed complete).

var x = current.sys_id;

var gr = new GlideRecord('hr_case');

gr.addQuery('sys_id', x);

gr.query();

if (gr.next()){

  gr.state = 3;

  gr.update();

  gs.addInfoMessage('The ticket has been closed.');

  action.setRedirectURL(current);

}

Update:

I got a workaround for this at the moment by adding a workflow, but should also work in a business rule.

The workflow will set the state values to 3 (Closed Complete) if the Active is false.

5 REPLIES 5

Marcel H_
Tera Guru

I am having a very similar issue, but in Facilities Management.



I am turning up the module for a group and they want some different statuses than the OOB options, which is easy enough to do, but then when trying to change the process flows, business rules, and UI actions to match, the flow seems to do whatever it wants. For example I created an On Hold status that would likely be used if a part is needed, etc. I set up a business rule to set the Status to On Hold when the button is pushed and ask for notes to be added to the Comments section (I modeled this after the Suspend UI action). Now whenever a ticket is submitted in my tests, the status always changes to On Hold no matter what. I even checked the business rules for initial status and another to automatically move into a specific status, and they seem to be getting ignored and the ticket placed On Hold. I can't find any rule anywhere that tells SN to set the ticket to On Hold on save/submit.



The problem then of course is that once it's On Hold, there is no way to manually change the status back to another one (my eventual plan of course would be to add a Resume button that would place it back in Work in Progress). I've even changed the Dictionary Override for the table to not make the field Read Only, but it always flips back to Read Only when the status changes.



Should I just be deactivating or deleting the OOB business rules and state flows? Should I really have to create all new ones just because I have created some different statuses? Even giving the new statuses the same values as the previous ones for the flows (e.g. value = 2, etc.) the flows don't fire correctly at all.


quentin_gillet
ServiceNow Employee
ServiceNow Employee

Ok.



Could you let me know what version your are using?


Also, you said you disabled the State flows. Is your case running entirely from your workflow? How do you move from one state to another?


Hi Quentin,



We are running Geneva (glide-geneva-08-25-2015__patch7-05-04-2016_05-21-2016_0850.zip).



I tried disabling all the state flows and created custom UI actions, however, when I clicked on Close complete (custom ui) the state reverts to Awaiting acceptance. The workflow is not running as I change the condition to - None -.



I have stayed out of the box for now in our instance with a new workflow that change the condition of the state to closed complete when the ticket is inactive. It changes the state from Work in progress to Awaiting Acceptance to Close complete.



What we want to achieve is remove the awaiting acceptance and reject acceptance. Tickets should be Closed complete from Work in progress.



The only code I saw that set to Awaiting acceptance is the Manual script in SF0000324 state flow.



current.sla_suspended = true;


current.sla_suspended_on = gs.nowDateTime();



if (current.request_category == hr.CATEGORY_OFFBOARDING || current.request_category == hr.CATEGORY_ONBOARDING || current.request_category == hr.CATEGORY_EMPLOYEE_CHANGE ) {


  current.state = 3; //set the ticket to close complete


  current.update();


}


else {


  current.state = 20; //set the ticket to awaiting acceptance


  current.update();


}


In that line of code in SF0000324 state flow, change line 09 to "current.state = 3" so it is just like line 05.   That will basically bypass the process and set it to close complete.