web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Marked Lines

(0) ShareShare
ReportReport
Posted on by

On the Purch. Comment page I am trying to create a button which sends the lines in which are selected by the user into another function which will create an email. How can I filter by only these highlighted lines? 

here's my attempt at what I want to achieve but it's far from correct i guess..


recPurchHeader.GET("Document Type", "No.");
MARKEDONLY(TRUE);
IF Rec.FIND('-') THEN BEGIN
cuPurchMgmnt.SendPurchChangeEmail(Rec, recPurchHeader);
END;

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    60,969 Super User 2025 Season 2 on at
    RE: Marked Lines

    check this function.

    msdn.microsoft.com/.../dd354931.aspx

  • Community Member Profile Picture
    on at
    RE: Marked Lines

    Thank you, any guide on how I can implement that with the code above?

    Such as..

    CurrPage.SETSELECTIONFILTER(Rec);

    IF Rec.FIND('-') THEN BEGIN

    cuPurchMgmnt.SendPurchChangeEmail(Rec, recPurchHeader);

    END;

    ??

  • Mohana Yadav Profile Picture
    60,969 Super User 2025 Season 2 on at
    RE: Marked Lines

    Copy the record first to a global variable

    recordvariable.copy(rec);

    CurrPage.SETSELECTIONFILTER(recordvariable);

    cuPurchMgmnt.SendPurchChangeEmail(recordvariable, recPurchHeader);

    Repeat the recordvariable in function..

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at
    RE: Marked Lines

    You can use SETSELECTIONFILTER function to achieve what you trying to do.
    https://msdn.microsoft.com/en-us/library/dd354931(v=nav.90).aspx

  • Community Member Profile Picture
    on at
    RE: Marked Lines

    On my Comment page I have this code,

    CLEAR(grecPurchComment);

    grecPurchComment.COPY(Rec);

    CurrPage.SETSELECTIONFILTER(grecPurchComment);

    cuPurchMgmnt.SendPurchChangeEmail(grecPurchComment, recPurchHeader);

    This then goes into this code,

    cuCPUtilities.UserCreateEmailAddress(recPurchaseheader."Created By");

    strEmailNo :=

     cuSMTPMail.EmailRecordMessageCreate(

       strEmailAddresses,

       '',

       STRSUBSTNO(

         Text022,

         recPurchaseheader."No."

       )

       );

    REPEAT

     cuSMTPMail.EmailRecordMessageLineBlank(strEmailNo,1);

       cuSMTPMail.EmailRecordMessageLine(

         strEmailNo,

         STRSUBSTNO(

           grecPurchComment.Comment

           ),

         '',

         FALSE

         );

    UNTIL grecPurchComment.NEXT = 0;

    cuSMTPMail.EmailRecordMessageEnd(strEmailNo);

    It only creates the Last line highlighted?

  • Suggested answer
    Mohana Yadav Profile Picture
    60,969 Super User 2025 Season 2 on at
    RE: Marked Lines

    you can add a  message in REPEAT loop to check whether records are looping correct or not.

    Message('%1',recPurchComment.Comment);

    If it is repeating correctly then there must be something else wrong.

    is EmailRecordMessageLine function customized? I cant see in NAV2017.

  • Community Member Profile Picture
    on at
    RE: Marked Lines

    Thankyou, after adding the message I can see it only repeats the once.

    The function is as followed

    EmailRecordMessageLine(strEmailNo : Code[20];strLine : Text[1024];strLine2 : Text[1024];blnTableStart : Boolean)

    // TIO000003

    CLEAR(recEmail);

    recEmail."Email No." := strEmailNo;

    recEmail."Email Marker" := recEmail."Email Marker"::Line;

    recEmail."Email Line" := strLine;

    recEmail."Email Line Col 2" := strLine2;

    recEmail."Email Table Start" := blnTableStart;

    recEmail.INSERT(TRUE);

  • Suggested answer
    Mohana Yadav Profile Picture
    60,969 Super User 2025 Season 2 on at
    RE: Marked Lines

    I didnt find

    IF recPurchComment.FINDSET THEN

    in SendPurchChangeEmail function before REPEAT

    and where are you incrementing the line no. while inserting into recEmail record?

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Marked Lines

    Thank you for your help, the issue has been resolved! However by using the same code on the table it'self it worked, somehow trying to pass it to a code unit wasn't allowing it to work. Unsure why...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#1
Alexander Ermakov Profile Picture

Alexander Ermakov 2

#3
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans