SET @admin_user_role := (SELECT id FROM ohrm_user_role WHERE `name` = 'Admin');
SET @module_id := (SELECT id FROM ohrm_module where `name` = 'expense');

SET @admin_user_role_subscriber := (SELECT DISTINCT(ns.id) FROM `ohrm_notification_subscriber_subscription` nss
	LEFT JOIN `ohrm_notification_subscriber` ns ON nss.subscriber_id = ns.id
    LEFT JOIN `ohrm_notification_subscription` nsc ON nss.subscription_id =nsc.id
    LEFT JOIN `ohrm_notification` n ON n.id= nsc.notification_id
    WHERE n.module_id=@module_id AND ns.user_role_id = @admin_user_role);

SET @notification_subscription_id :=(SELECT ns.id FROM `ohrm_notification` n
  LEFT JOIN `ohrm_notification_subscription` ns ON n.id=ns.notification_id
  LEFT JOIN `ohrm_workflow_state_machine` wsm ON ns.workflow_item_id = wsm.id
  WHERE n.name='Claim Request Assignment' AND wsm.workflow ='CLAIM_REQUEST' AND wsm.role = 'ADMIN' AND
  wsm.action='Assign');

INSERT INTO `ohrm_notification_subscriber_subscription` (subscription_id, subscriber_id) VALUES
 (@notification_subscription_id, @admin_user_role_subscriber);