Bonjour wassim77,
Your code seems a bit confusing with ttsbegin while you are trying to insert a record and no insert() method anywhere.
If I get you right, you want to pick record from your custom table and insert it into kMVirtualNetworkAnswerTable when the current document is fully approved.
A better way, I would achieve this is by having a method createkMVirtualNetworkAnswerTable() on NouvelleMesureTable where I will define the fields and mapping for insertion.
On the workflowEventHandler, I would just call the insertIntokMVirtualNetworkAnswerTable and pass the documentId.
///
///
///
public void createkMVirtualNetworkAnswerTable(RecId _recId)
{
kMVirtualNetworkAnswerTable kMVirtualNetworkAnswerTable;
NouvelleMesureTable nouvelleMesureTable = NouvelleMesureTable::find(_recId);
kMVirtualNetworkAnswerTable.clear();
kMVirtualNetworkAnswerTable.ExecutedBy=nouvelleMesureTable.Person;
kMVirtualNetworkAnswerTable.EvaluationOf=nouvelleMesureTable.Person;
kMVirtualNetworkAnswerTable.kmCollectionId=nouvelleMesureTable.Questionnaire;
.......
.......
kMVirtualNetworkAnswerTable.insert();
}
public void completed(WorkflowElementEventArgs _workflowElementEventArgs)
{
// TODO: Write code to execute once the workflow is completed.
RecId documentRecId = _workflowElementEventArgs.parmWorkflowContext().parmRecId();
NouvelleMesureTable::updateWorkflowStatus(documentRecId, GD_WFDocumentStatus::Valide);
// Here we call the method for inserting record into KMVirtualNetworkAnswerTable
NouvelleMesureTable.createkMVirtualNetworkAnswerTable(documentRecId);
}