Reason - Issue occurs if service category and service additional
fields related tables like servicemetatable, dynamic tables contains
orphan entries for that particular service category
Queries to be executed directly from db:
1. select * from servicemetatable where serviceid =4801;
2. select * from dynamictables where tablename in ('ServiceReq_4801','SServiceReq_4801','ARC_ServiceReq_4801');
3. select * from tabledetails where table_name in ('ServiceReq_4801','SServiceReq_4801','ARC_ServiceReq_4801');
4. select * from columndetails where table_id not in (select table_id from tabledetails);
5. select * from servicereq_4801;
6. select * from sservicereq_4801;
7. select * from arc_servicereq_4801;
8. select * from servicedefinition where serviceid=4801;
Replace '4801' with service category id which is found in error trace
To resolve the issue:
Scenario 1 :
If
query 5 to 7, throws error like no table is present and if query 1 to 4
contains data, then it is safe to delete those orphan entries using
below queries
1. delete from servicemetatable where serviceid =4801;
2. delete from dynamictables where tablename in ('ServiceReq_4801','SServiceReq_4801','ARC_ServiceReq_4801');
3. delete from tabledetails where table_name in ('ServiceReq_4801','SServiceReq_4801','ARC_ServiceReq_4801');
4. delete from columndetails where table_id not in (select table_id from tabledetails);
From
query 8, we'll get the service category name for which issue occurs.
After executing the above delete query, we can just dummy update this
service category to resolve the issue