Modify Approval Mail Template in NAV 2009 SP1

Dodda11Dodda11 Member Posts: 5
Hello everyone,

I want to modify Approval mail template by adding 2 new columns.
I have exported the mail template in .htm.
I know that I should modify this file, then I will import it, but what I don't understand where the variables/parameters (%10, %57...) are declared?
This is the mail template:

<html>
<body>
Bonjour,<br /><br />

<br /><br />
<table border="1">
<tr>
<td>Numero de la demande</td>
<td>Objet de la Demande </td>
<td>Date</td>
<td>Demandeur</td>
<td>Department</td>
<td>Buyer in charge</td>
<td>Montant</td>
<td>Devise</td>
</tr>
<tr>
<td>%10</td>
<td>%57</td>
<td>%63</td>
<td>%65</td>
<td>%56</td>
<td>%64</td>
<td>%51</td>
<td>%53</td>
</tr>
</table>
<br /><br />
Cordialement,<br />
<br />
</body>
<html>

Thank you

Comments

  • Dodda11Dodda11 Member Posts: 5
    Hello,

    There is no ansewer?

    Please I need the solution as soon as possible.

    If not, I gonna have a bad time ](*,) ](*,) ](*,)
  • postsauravpostsaurav Member Posts: 708
    Hi,

    Your Output when you send a email notification of approval will look as shown below



    If you are trying to modify standard function look for a function like FillSalesTemplate.

    You can find this function in Standard Codeunit 400 Approvals Mgt Notification. This Functions fills the % values with actual values as shown in below image.



    Try to modify similar function in your case if you want to add new values in the table. If you want to add values in footer of the email then put values after </table> tag.

    Let me know if you have any doubts.
    1.JPG 25.6K
    2.JPG 36.3K

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • postsauravpostsaurav Member Posts: 708
    Hi,

    Your Output when you send a email notification of approval will look as shown below



    If you are trying to modify standard function look for a function like FillSalesTemplate.

    You can find this function in Standard Codeunit 400 Approvals Mgt Notification. This Functions fills the % values with actual values as shown in below image.



    Try to modify similar function in your case if you want to add new values in the table. If you want to add values in footer of the email then put values after </table> tag.

    Let me know if you have any doubts.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • Dodda11Dodda11 Member Posts: 5
    Hello Saurav,

    Thank you so much for your answer.
    Well, I don't want to abuse. :oops:
    But I will take advantge of your kindness.
    I consulted the codeUnit 440 "Approval Mt Notificaion",and I detected the fonction I should to modify.
    But I don't know how can I change it to show the 2 new columns !
    Can you show m what I should to do please?
    Thank you in advance :)

    The code is below
    PROCEDURE FillPurchaseTemplate@15(VAR Body@1000 : Text[254];TextNo@1001 : Text[30];Header@1002 : Record 38;AppEntry@1003 : Record 454;CalledFrom@1004 : 'Approve,Cancel,Reject,Delegate');
        VAR
          RecLUserSetup@1100296000 : Record 91;
        BEGIN
          CASE TextNo OF    
            '1': Body := STRSUBSTNO(Text002,Header."Document Type");    
            '2': Body := STRSUBSTNO(Body,Header."No.");
            '3': CASE CalledFrom OF
                CalledFrom::Approve: Body := STRSUBSTNO(Body,Text003);
                CalledFrom::Cancel: Body := STRSUBSTNO(Body,Text014);
                CalledFrom::Reject: Body := STRSUBSTNO(Body,Text016);
                CalledFrom::Delegate: Body := STRSUBSTNO(Body,Text020);
              END;
            '4': CASE CalledFrom OF
                CalledFrom::Approve: Body := '';
                CalledFrom::Cancel: Body := '';
                CalledFrom::Reject: Body := '';
                CalledFrom::Delegate: Body := '';
              END;
            '5': Body := '';       
            '6': Body := STRSUBSTNO(TxtGMailObject,AppEntry."User group",AppEntry."Sell-to/Buy-from Name"        
            ,AppEntry.Amount,AppEntry."Currency Code",AppEntry."PR Object");               
            '7': Body := STRSUBSTNO(Body,AppEntry.FIELDCAPTION(Amount));
            '8': Body := STRSUBSTNO(Body,AppEntry."Currency Code");
            '9': Body := STRSUBSTNO(Body,AppEntry.Amount);
            '10': Body := STRSUBSTNO(Body,AppEntry.FIELDCAPTION("Amount (LCY)"));
            '11': Body := STRSUBSTNO(Body,AppEntry."Amount (LCY)");
            '12': Body := STRSUBSTNO(Body,Text018);
            '13': Body := STRSUBSTNO(Body,Header."Pay-to Vendor No.");
            '14': Body := STRSUBSTNO(Body,Header."Pay-to Name");
            '15': Body := STRSUBSTNO(Body,AppEntry.FIELDCAPTION("Due Date"));
            '16': Body := STRSUBSTNO(Body,AppEntry."Due Date");
            '17': BEGIN
                IF AppEntry."Limit Type" = AppEntry."Limit Type"::"Request Limits" THEN
                  Body := Text043
                ELSE
                  Body := ' ';
              END;
            '18': BEGIN
                IF AppEntry."Limit Type" = AppEntry."Limit Type"::"Request Limits" THEN
                  Body := STRSUBSTNO(Body,AppEntry."Amount (LCY)")
                ELSE
                  Body := ' ';
              END;      
            '19': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                  Body := STRSUBSTNO(Body,CteG001);
              END;
            '20': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                BEGIN             
                  RecLUserSetup.GET(AppEntry."Approver ID");
                  IF RecLUserSetup."PR visibility" <> RecLUserSetup."PR visibility"::Specifier THEN
                    Body:=STRSUBSTNO(Body,CONTEXTURL + '&target=Form 50022' +
                    '&view=SORTING(Field1,Field3)&position=Field1=0(29),Field3=0('+Header."No."+')')
                  ELSE
                    Body:=STRSUBSTNO(Body,CONTEXTURL + '&target=Form 50031' +
                    '&view=SORTING(Field1,Field3)&position=Field1=0(29),Field3=0('+Header."No."+')');           
                END;
              END;
             '21': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                  Body:= STRSUBSTNO(Body,APPLICATIONPATH);
              END;
            '22': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                  Body := STRSUBSTNO(Body,CteG002);
              END;
            '23': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                BEGIN             
                  Body:=STRSUBSTNO(Body,CONTEXTURL + '&target=Form 658'+
                  '&view=SORTING(Field6) WHERE(Field1=1(38),Field2=1(29),Field3=1('+Header."No."+'))'+
                  '&position=Field1=0(38),Field2=0(29),Field3=0('+Header."No."+'),Field4=0('+ FORMAT(AppEntry."Sequence No.") +')');           
                END;       
              END;
             '24': BEGIN
                IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
                  Body:= STRSUBSTNO(Body,APPLICATIONPATH);
              END;
          END;
        END;
    
  • postsauravpostsaurav Member Posts: 708
    Hey,

    So what i can understand is that you want to add two columns in Reports with -
    Captions as - Name & Phone No.

    Let's see what the standard have written (From your initial Query) -
    <table border="1">
    <tr>
    <td>Numero de la demande</td>
    <td>Objet de la Demande </td>
    <td>Date</td>
    <td>Demandeur</td>
    <td>Department</td>
    <td>Buyer in charge</td>
    <td>Montant</td>
    <td>Devise</td>
    </tr>
    <tr>
    <td>%10</td>
    <td>%57</td>
    <td>%63</td>
    <td>%65</td>
    <td>%56</td>
    <td>%64</td>
    <td>%51</td>
    <td>%53</td>
    </tr>
    </table>

    1. Just append this if <td> After <td>Devise</td> -
    <td>Name</td>
    <td>Phone No. </td>
    2. Now for Values of these fields After <td>%53</td> append these lines -
    <td>%50000</td>
    <td>%50001</td>

    **The Changes 1 & 2 Need to be done in HTML File also.

    Now Navigate to Function FillPurchaseTemplate and do these changes -
    AFTER -
    '24': BEGIN
    IF Header."Document Type"=Header."Document Type"::"Purchase Request" THEN
    Body:= STRSUBSTNO(Body,APPLICATIONPATH);
    END;

    3. Add Following Line of Code -
    '50000': Body := AppEntry.Name;
    '50000': Body := AppEntry."Phone No.";

    ** Code Under 3 Assuming that fields that you want to add are part of Appentry Recordset.

    4. Save the changes, Import the Template and Run the process.

    I hope the email should be like the way you want it.

    Let me know if you have issues.,

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
Sign In or Register to comment.