[Vtigercrm-developers] vtiger 7.0 cannot create task with status

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Vtigercrm-developers] vtiger 7.0 cannot create task with status

lounik
Hi,

I'm trying to create a new task via workflow. The task is created but
the status is empty. The code I'm using is the following:

$activity = Vtiger_Record_Model::getCleanInstance("Events");
     $activity->set('mode', 'create');
     $activity->set('activitytype', 'Task');
     $activity->set('date_start', "2019-01-01");
     $activity->set('time_start', "09:00:00");
     $activity->set('due_date', "2019-01-31");
     $activity->set('taskstatus', 'Planned'); //$activity->set('status',
'Planned');
     $activity->set('visibility', 'Private');
     $activity->set('subject', "test");
     //$activity->set('description', '');
     //$activity->set('parent_id', $record['id']);
     $activity->set('assigned_user_id', 1);
     $activity->save();

With both status and taskstatus the task gets created with the status
field empty.

NOTE: the same doesn't happen when creating an event.

Any idea on how to solve it?

Thanks

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|

Re: vtiger 7.0 cannot create task with status

its4you
Maybe this is wrong ?

$activity = Vtiger_Record_Model::getCleanInstance("Events");

Calendar module is joined from 2 modules Events and Tasks.
Try to use Tasks not Events in getCleanInstance function

Matus



Dňa 16. 1. 2019 o 16:30 lucia digirolamo napísal(a):

> Hi,
>
> I'm trying to create a new task via workflow. The task is created but
> the status is empty. The code I'm using is the following:
>
> $activity = Vtiger_Record_Model::getCleanInstance("Events");
>      $activity->set('mode', 'create');
>      $activity->set('activitytype', 'Task');
>      $activity->set('date_start', "2019-01-01");
>      $activity->set('time_start', "09:00:00");
>      $activity->set('due_date', "2019-01-31");
>      $activity->set('taskstatus', 'Planned'); //$activity->set('status',
> 'Planned');
>      $activity->set('visibility', 'Private');
>      $activity->set('subject', "test");
>      //$activity->set('description', '');
>      //$activity->set('parent_id', $record['id']);
>      $activity->set('assigned_user_id', 1);
>      $activity->save();
>
> With both status and taskstatus the task gets created with the status
> field empty.
>
> NOTE: the same doesn't happen when creating an event.
>
> Any idea on how to solve it?
>
> Thanks
>
> _______________________________________________
> http://www.vtiger.com/


_______________________________________________
http://www.vtiger.com/
VTE
Reply | Threaded
Open this post in threaded view
|

Re: vtiger 7.0 cannot create task with status

VTE
In reply to this post by lounik
Try eventstatus field. That's what Events use instead of Tasks('status).  

 $activity->set('eventstatus', 'Planned');



-----
VT Experts
Email: [hidden email]
Web:  http://www.VTExperts.com 
Skype: VTExperts
Phone: +1 (818) 495-5557



--
Sent from: http://vtiger-crm.2324883.n4.nabble.com/vtigercrm-developers-f4.html
_______________________________________________
http://www.vtiger.com/
VTExperts