You need to sign in to do that
Don't have an account?
Aishwarya_Todkar
Can't find a way of how to test case owner changed to queue
Hi,
I have created a case assignment rule where whenever case of specific record type is created it is assigned to a Queue.
But I'm not able to test it in test class. Kindly help me with the solution for this.
I have created a case assignment rule where whenever case of specific record type is created it is assigned to a Queue.
But I'm not able to test it in test class. Kindly help me with the solution for this.
If you set the DMLOptions to use the case assignment rules before an insert or update then the case assignment rules will fire during tests.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved.
Thanks and Regards
Pavit Siddhu
All Answers
Aishwarya27
I think you are asking about to use assignment rule by apex.
A solution is using Database.DMLOptions. The Database.DMLOptions class can provide extra information during a transaction; for example, specifying the truncation behaviour of fields or assignment rule information. For example, the script below is fetching the assignment rules of Case and then creating the DMLOptions for the "Assign using active assignment rules" checkbox.
Now when the Case is inserted using this script, the assignment rules get triggered.
I tried this before, but facing same issue.
I am getting the expected results in debugs If I used debugs only without adding asserts. But when I added both debugs and asserts then asserts are failed and debugs are unexpected, getting null values.
If you set the DMLOptions to use the case assignment rules before an insert or update then the case assignment rules will fire during tests.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved.
Thanks and Regards
Pavit Siddhu