How To Create a new Task using Code

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Feb 9, 2016
Company: CTC

Hi,

part of my system, in certain situations I want to create user tasks and assign the task to a user and set reminder and show it in the Calendar.
I don't know how can I create a Task. Am beginner. I tried Catalogs.Tasks.CreateTask or Documents.Tasks.CreateTask or Tasks.Task.CreateTask but it does not seem to work. How can I create a task using code.

thank you very much

 
#2
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Feb 9, 2016
Company: CTC

Got it.

       ta = Tasks.Task.CreateTask();
ta.Date = date;
ta.Description = "this is my automatically generated task";
ta.User = IdReferences.GetCurrentUser();
ta.Write();

uta = Tasks.UserTask.CreateTask();
uta.Date = date;
uta.Task = true;
uta.Creator = IdReferences.GetCurrentUser();
uta.Description = "this is my created User Task by code";
uta.Memo = "this is my memo created  by code.";
uta.Reminder = Enums.Reminder._15m;
uta.ReminderDate = date;
uta.Start = date;
uta.Finish = EndOfDay(date);
uta.Write();

 
#3
People who like this:0Yes/0No
Interested
Rating: 12
Joined: Nov 10, 2011
Company: 1A Software e.U

Dear Mubarak Sami,

could you please tell me more about the showing of tasks in the calendar?
Thank you very much?

Regards,
Lioudmila

 
Subscribe
Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.