Case state do not change from new to open when dealer attach something in case

Buddy 1
Tera Contributor

Hi 

Requirement :
1.Case state do not change from new to open when dealer attach something in case 

2.Only if Awaiting Info - The state will be move to OPEN 

How to achieve this?

Thanks in advance!

4 REPLIES 4

SatyakiBose
Mega Sage

Hello @Buddy 1 

Can you explain the entire use case please.

One liners don't help in understanding the issue.

Hi @SatyakiBose ,

1. When dealer submitting the case , the case will be in New state, and at the same time , when they attach something to the case, the case changes to open(it assumes that they is a reply from dealer and makes the case to open automatically)--this should not happen.

The case state should not change from New to Open, when they is reply from customer .
The case state should change to Open only when the previous state of case is awaiting info.

Thanks in advance!

Prashant Ahire
Kilo Sage

Hi @Buddy 1,

I Hope Your issue will be solved by using this Solution


you can create a business rule that runs when a case is updated.
Enter a name for the business rule, such as "Enforce case state transition rules."
In the 'When to run' section, select 'Before' for the 'Update' operation.
In the 'Advanced' section, add the following script:


(function executeRule(current, previous /*null when async*/ ) {

if(current.state == 'Open' && current.comments){
//check if the previous state of the case was 'awaiting info'
var previousState = previous.state || '';
if(previousState == 'Awaiting Info'){
return true;
}else{
gs.addInfoMessage('Case state should not change from New to Open, when there is a reply from the customer.');
current.state = previousState; //revert back the state to the previous one
return false;
}
}
})(current, previous);

This business rule checks if the case state is changing to 'Open' and if there is a comment added to the case. If so, it checks if the previous state of the case was 'Awaiting Info'. If it was, then the business rule returns 'true', allowing the state transition. If not, it returns 'false' and displays an information message saying that the case state should not change from 'New' to 'Open' when there is a reply from the customer. The script also reverts back the state of the case to the previous one to prevent the unwanted state transition.

 

Thankyou

Please Mark my answer correct & Helpful, if Applicable.

 

SatyakiBose
Mega Sage

Hello @Buddy 1 

Can you check your inbound email scripts please.

In the inbound email action, you need to check the below dependencies:

  • When to run > Condition
  • Actions > Script (here you need to specifically check if the state is changing or not.) If so then you can simply comment out the particular line.