Identical issue to: https://forum.civicrm.org/index.php?topic=32904.msg140249#msg140249 which was never solved. Manually inserted a case with all of the tables mentioned in the post, yet it doesn't appear under job search in CiviCRM. They show in the database, but the GUI is blank.
1 Answer
Was missing:
INSERT INTO civicrm_case_activity (
case_id,
activity_id
)
VALUES(
CIVICRM_CASE_ID,
CIVICRM_ACTIVITY_ID
);
-
Don't forget to mark this answer as the correct one if it is the final answer!– JohnFFCommented May 20, 2017 at 23:11
-- Create CiviCRM case INSERT INTO civicrm_case ( case_type_id, subject, start_date, end_date, status_id, is_deleted ) VALUES( CIVICRM_CASE_TYPE_ID, SessionId, ACTIVITY_DATE_TIME, ACTIVITY_DATE_TIME, 2, -- Completed 0 -- Not deleted ); SELECT LAST_INSERT_ID() INTO CIVICRM_CASE_ID;
-- Create case start activity INSERT INTO civicrm_activity ( activity_type_id, activity_date_time, status_id, priority_id, is_deleted, is_test, is_auto, is_current_revision ) VALUES( 148, ACTIVITY_DATE_TIME, 2, -- Completed 2, 0, 0, 0, 1 );
-- Create case end activity INSERT INTO civicrm_activity ( activity_type_id, activity_date_time, status_id, priority_id, is_deleted, is_test, is_auto, is_current_revision ) VALUES( 13, ACTIVITY_DATE_TIME, 2, -- Completed 2, 0, 0, 0, 1 );
-- Set case owner INSERT INTO civicrm_case_contact ( case_id, contact_id ) VALUES ( CIVICRM_CASE_ID, CIVICRM_CONTACT_ID );