diff --git a/modules/Calendar/actions/SaveAjax.php b/modules/Calendar/actions/SaveAjax.php
index 5893c853d72f27ff4b040032fe3b76666edcfe5c..deb5e3cfa0868b33f38154a6c9794eaffe0a8eb4 100644
--- a/modules/Calendar/actions/SaveAjax.php
+++ b/modules/Calendar/actions/SaveAjax.php
@@ -183,7 +183,8 @@ class Calendar_SaveAjax_Action extends Vtiger_SaveAjax_Action {
 
 		$activityType = $request->get('activitytype');
 		$visibility = $request->get('visibility');
-		if(empty($activityType)) {
+		// set activity type as "Task" when creating or inline editing Task.
+		if(empty($activityType) || empty($recordModel->get('activitytype'))) {
 			$recordModel->set('activitytype', 'Task');
 			$visibility = 'Private';
 			$recordModel->set('visibility', $visibility);