Options

Update NAV field from Outlook

davmac1davmac1 Member Posts: 1,283
edited 2010-10-19 in NAV Three Tier
Are there any existing add-ons that will allow us to send an email with a response button (yes/no or an option box), and then have it update NAV when the recipient responds? (This is what the customer wants.)

The easiest method I can think of is with a web link which would allow an email to be generated with the responses in web links which would allow it to work on smart phones as well. Updates would take place using the application tier. Any suggestions for this method would be appreciated as well.

Comments

  • Options
    vrushankvrushank Member Posts: 16
    This is one way of doing it. I use thos code to scan my e-mail message and then update a certain table.


    //GET TEMPORARY FILE PATH
    TempPath := ENVIRON('TMP');

    CLEAR(autOLAppl);
    CREATE(autOLAppl);
    autOLNamespace := autOLAppl.GetNamespace('MAPI');
    autOLNamespace.Logon('','',TRUE,FALSE);
    autOLMapiFolder := autOLNamespace.GetDefaultFolder(6);
    autOLItems := autOLMapiFolder.Items;
    FOR LoopCounter := 1 TO 2 DO BEGIN

    IF LoopCounter = 1 THEN
    txtFindCriteria := '[Subject] = ''UGLI_FCUBE_IRCB_CONV - Errors''';
    IF LoopCounter = 2 THEN
    txtFindCriteria := '[Subject] = ''UGLI_FCUBE_IRCB_LOAD - Success''';
    autOLItems := autOLMapiFolder.Items.Restrict(txtFindCriteria);
    MailCount := 1;
    intEndOfLoop := autOLItems.Count;
    WHILE MailCount <= intEndOfLoop DO BEGIN
    BodyOfMail := '';
    autOLMItem := autOLItems.Item(MailCount);
    autOLMItem.BodyFormat(2);
    IF autOLMItem.UnRead THEN
    BEGIN
    //SAVE MAIL BODY AS FILE
    autOLMItem.SaveAs(TempPath + '\MailTMP_.txt');

    //OPEN FILE SAVED TO READ CONTENT
    FileBody.OPEN(TempPath + '\MailTMP_.txt');
    FileBody.CREATEINSTREAM(StreamIn);
    WHILE NOT StreamIn.EOS DO BEGIN
    StreamIn.READTEXT(MailBody,12);

    //READ FILE NAME
    IF MailBody = Text00002 THEN
    StreamIn.READTEXT(FileNameTemp,16);

    //READ FILE STATUS
    IF MailBody = Text00001 THEN
    BEGIN
    StreamIn.READTEXT(BodyOfMailTemp,12);


    //INSERT TO LOG TABLE
    OutlookLog.RESET;
    OutlookLog.SETRANGE(OutlookLog."File Name",FileNameTemp);
    IF OutlookLog.FINDFIRST THEN
    VerNo := OutlookLog."File Version No." + 1
    ELSE
    VerNo := 1;
    OutlookLog.INIT;
    OutlookLog."File Name" := FileNameTemp;
    OutlookLog."File Version No." := VerNo;
    OutlookLog."Mail Imported On" := CURRENTDATETIME;
    OutlookLog."Mail Date" := autOLMItem.SentOn;
    OutlookLog."Mail From" := autOLMItem.SenderName;
    OutlookLog."Mail Subject" := autOLMItem.Subject;
    OutlookLog."Status In Mail" := BodyOfMailTemp;
    OutlookLog.INSERT;

    END;
    END;
    FileBody.CLOSE;
    ERASE(TempPath + '\MailTMP_.txt');
    autOLMItem.UnRead := FALSE;
    END;
    MailCount := MailCount + 1;
    END;
    END;
    CLEAR(autOLMItem);
    CLEAR(autOLAppl);
    A day without the sun is like night
Sign In or Register to comment.