Action to Create new To Do

I’m working on an action to create a new “To Do” in a user’s mail file using information from a open Helpdesk ticket- Thanks for the help in a prevous post.What I want to do is have the ability to create the new “To Do” from an action button while the current helpdesk ticket is open. With the code below I am bringing up a new “To Do” but none of the information from the helpdesk ticket is being populated.

Form names:

CR- Helpdesk Request

Task- To Do form in the users mail db

Field Names-

CR.Subject map to Task.subject

CR.calldate map to Task.StartDate

CR.description map to Task.body

I have attached my LotusScipt for your evaluation and comment:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim maildb As Notesdatabase

Dim taskuidoc As NotesUIDocument

Dim CRuidoc As NotesUIDocument

Dim taskdoc As NotesDocument

Dim CR As NotesDocument

Dim taskbody As Variant

Dim subject, calldate, description As Variant

Dim StartDate, Body As Variant







Set CRuidoc = ws.CurrentDocument

Set maildb = New NotesDatabase("","")

maildb.OpenMail

Set taskuidoc = ws.ComposeDocument(maildb.Server, maildb.FilePath, "Task")







Set CR = CRuidoc.Document

CR.Form = "CR"

CR.subject = taskdoc.Subject

CR.calldate(0) = taskdoc.StartDate(0)

CR.description = taskdoc.Body

End Sub

Thanks for any help or pointers.

Subject: Action to Create new To Do

Is it correct to assume that the user is creating the To Do item themselves?

If so, have you looked at the mail file actions for memos to get sample code from there?

Aside from that, why are you doing this the way you are instead of creating the document in the back end and then opening it?

The we deal with the issue is that your code is backwards. You are not setting anything in the Tsk document at all, in fact the taskdoc has not even been set. You have:

CR.subject = taskdoc.Subject

CR.calldate(0) = taskdoc.StartDate(0)

CR.description = taskdoc.Body

it should be

taskdoc.Subject= CR.subject(0)

taskdoc.StartDate=CR.calldate(0)

etc etc