Perfil de Santosh KumarSantosh Kumar Paruvella'...BlogListasLibro de visitasMás ![]() | Ayuda |
Santosh Kumar Paruvella's space |
|||||
|
20 noviembre Dynamics Ax Document Handling For The Mails Using Drag n DropIn my previous article, I had placed the example of Dynamics Ax Document handling for the files using Drag ‘N’ Drop option. In this article, we are going to see the example of Document handling for the mails (Outlook –Mail Items) using Drag ‘N’ Drop option. Steps: 1) Create a new form in Dynamics Ax and name it as MailDragnDrop_Paruvella. 2) Go to AOTàFormsà MailDragnDrop_ParuvellaàDesigns àDesign, right click and select the New control and from the control list select ActiveX control 3) Ax will open the list of ActiveX controls box (ActiveX Browser) and select the smmDrop2.smmDropWin class from available controls list
4) Add a new method for the ActiveX control as follows void onEvent_DropMail(COMVariant bMailIn, COMVariant strEntryID, COMVariant strStoreID) { DocuRef docuRef; ;
//Here I am passing CustAccountNum as 113443 i.e. I am attaching the mail item to this customer docuRef.RefRecId = CustTable::find("113443").RecId; docuRef.RefTableId = tablenum(CustTable);
if (MailDragnDrop_Paruvella::docuHandleDroppedEMail(docuRef, strEntryID.bStr(), strStoreID.bStr())) { info("Document attached successfully"); } else { info("not attached"); }
}
5) Now create a new class and name it as MailDragnDrop_Paruvella 6) Add a new method to the class as follows
public client static boolean docuHandleDroppedEMail(DocuRef _docuRef, smmEMailEntryID smmEMailEntryID = '', str smmEMailStoreID = '') { #define.outlookapplication('Outlook.Application') #define.mapidef('MAPI') #define.msgfile('msg')
NumberSeq numSeq; str tofilename; COM outlook; COM namespace; COM item; FilePath archivePath; DocuRef docuRef = _docuRef; int lines = infolog.line();
InteropPermission permission; DocuActionArchive docuActionArchive; str mailSubject, fileName, fileType; ;
permission = new InteropPermission(InteropKind::ComInterop); permission.assert();
// Initialize communication with Outlook outlook = new COM(#outlookapplication);
if (outlook) { // Get Outlook namespace namespace = outlook.getNamespace(#mapidef);
if (namespace) { // Get Outlook mail item item = namespace.getItemFromId(smmEMailEntryID, smmEMailStoreID); } }
// Check that the Outlook mail item was found if (!item) { return checkFailed("Outlook communication error. The mail item not found"); }
archivePath = Docu::archivePath(curExt());
if (! archivePath) { // The Windows path is used because the Outlook mail must be written somewhere on disk as a temp file before it can be saved in the database archivePath = WinAPI::getWindowsDirectory(); }
// Get a new number from the document numbersequence numSeq = NumberSeq::newGetNum(DocuParameters::numRefDocuNumber(), true);
// Use next number in numbersequence as filename fileName = smmDocuments::getNonExistingFileName(numSeq, archivePath, #msgfile);
// Save mail as the msg type file fileType = #msgfile;
// If path doesn't end with to backslash it should be appended archivePath = Docu::fileCheckPath(archivePath);
//docuValue.Path = archivePath;
// Create filename based on the path in the document type table and the filename (number) tofilename = archivePath + fileName + (fileType ? ('.' + fileType) : '');
// Save the e-mail as a .msg file try { // Call save function on the Outlook mail item item.saveAs(tofilename); mailSubject = item.subject(); } catch { // If the save function displays a COM error it should not be shown in the infolog infolog.clear(lines); }
// Check that the file was saved correctly if (!archivePath || !WinAPI::fileExists(tofilename)) { // Free the document numbersequence number that was reserved if the file wasn't found numSeq.abort();
return checkFailed("The file could not be saved"); } CodeAccessPermission::revertAssert();
ttsbegin;
// Mark the document numbersequence number is used numSeq.used();
// Create the document docuRef.Name = mailSubject; docuRef.TypeId = "Fil"; // this value is File here. docuRef.Notes = ""; docuRef.RefCompanyId = curExt(); docuRef.Restriction = DocuRestriction::Internal; docuRef.InterCompanySkipUpdate = InterCompanySkipUpdate::No; docuRef.smmTable = boolean::true; docuRef.ActualCompanyId = curExt(); docuRef.PartyId = "2"; docuRef.ContactPersonId = ""; docuRef.DEL_BusRelAccount = ""; docuRef.AuthorId = "100"; //curUserid -- employee Id docuRef.smmEMailEntryID = smmEMailEntryID; docuRef.smmEMailStoreID = smmEMailStoreID; docuRef.DEL_CampaignId = ""; docuRef.EncyclopediaItemId = ""; docuRef.insert(); ttscommit;
ttsbegin; docuRef.selectForUpdate(true); docuActionArchive = new DocuActionArchive(); docuActionArchive.add(docuRef, tofilename); ttscommit;
return true; }
7) Save and Compile the Class and Form. 8) Run the form and open the mail box (make sure that two windows are visible by resizing the mail box) 9) Select the mail from mailbox drag the mail and drop on to the ActiveX component of the form as show in below figure.
10) After this drag n drop option is completed, we will be prompted with following prompt
11) Just click on Allow button of the message box (it may appear 2-3 times click on Allow button always) 12) Then the selected mail will be attached to the customer record as a Outlook Message Item (*.msg). Find the complete project for this example at the following location.
12 noviembre Dynamics Ax Document Handling using File Drag n DropIn this example I am trying to achieve the Dynamics Ax Document Handling by using files Drag & drop option of windows OS. According to standard Ax, if we want to attach the documents to the customer records, We need to select the customer and select the Document Handling icon from the toolbar on the form as shown in below figure. Then it will open another form, on that form we need to click on New button, it will open the window's browser to select the file. In this example no need to do all the above steps, Ø Select the customer record fom Ax-Customers form, for which customer we want to attach the document. Ø Select the file to attach. Ø Drag the file and drop on the windows control as shown in below figure. Find the document at the following path, to understand how this example is implemented for the Customers.
10 noviembre Using the Ax-Resource nodes as MetadataIn this example, I am storing XML file as Resource under AOT of Dynamics Ax. Also I am able to get back that resource as xml file, retrieving the file contents and use the same in our Business logic according to our needs. In the same way we can use Resources as Metadata. For a quick view of the new Resource node, see the following figure. Find the related jobs at the following path, this path contains two jobs for 1) Creation of new resource file. 2) Reading the same resource as file. For this article I got basic inputs from one of my previous colleague Santosh blog and also from MS employee Dilip (DaxDilip) blog. Thanks to both of you. 02 noviembre Different styles (*.css) for our EP pages of Ax 2009We can apply our custom styles for the newly developed pages or customized pages of EP. The following link gives in idea about, how to create our own custom css file and deploy the same in to web server. Hints on Workflow implementation for EP in Ax 2009When we are developing the workflow for EP in Dynamics Ax 2009, We won’t find the workflow related control on the Tool box list, as we are finding other controls like AxGridView etc. For this explicitly we need to add the Markup tags to the control. Select the AxUserControl, right click and select the View Markup Add the following lines in the markup view (change the properties accordingly as your scenarios) <%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow" TagPrefix="dynamics" %>
<dynamics:AxWorkflowActionBar ID="WorkflowActionBar" runat="server" DataMember="ProjProposalJour_Current" DataSourceID="dsEPProjProposalInfo" onworkflowworkitemactioncompleted="WorkflowActionBar_WorkflowWorkItemActionCompleted" /> <dynamics:AxDataSource ID="dsEPProjProposalInfo" runat="server" DataSetName="EPProjProposalInfo" />
Observe form the above markup tags AxWorkflowActionBar and AxDataSource are connected using AxDatasource ID. (Properties mentioned in green color)
To implement the methods related to workflow control in the code behind sheet (in Actual C# code sheet), add the following line.
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow;
For more details and how to implemnet the worklfow for EP pages, go through the following link.
|
||||
|
|