Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Retreive filters from JsonObject

(1) ShareShare
ReportReport
Posted on by 26
Hello,
 
I need to use the event 'OnAfterDocumentReady' to merge the purchase order layout with pdf files attached in item card.
The problem is inside the event, I can't get the /document Type/ and /Document No/ of my record.
 
 
I tried to read the json object ObjectPayload, and I found report filters in the /view/ attribute .
Can I Apply the /view/ value to filter my record /Purchase Header/ in AL ?
 
 
 
 
Thanks
 
  • Meriah Profile Picture
    Meriah 26 on at
    Retreive filters from JsonObject
    Thans you for your answers.
    I used string functions to retrieve "document no" filter .
  • Verified answer
    Shrey Chauhan Profile Picture
    Shrey Chauhan 271 on at
    Retreive filters from JsonObject
    Hello ,

    You can use like this to retrieve the number 106044 :
    // Now, Order number should start with the view value
    // Find the end of the number value (assuming it ends with a period)
    numberEndPos := StrPos(numberStartPos, '.');
    if numberEndPos > 0 then begin
    // Delete everything after the number value
    numberEndPos := numberEndPos - 1;
    numberEndPos := DelStr(numberStartPos, numberEndPos, StrLen(numberStartPos) - numberEndPos + 3);
    end;
    Var
    numberEndPos: Integer;
    numberPos: Integer;
    numberStartPos: Text;
    numberEndPos: text;

    Hope this help
    Thank you,
    ​​​​​​​Shrey
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 76,221 Super User 2024 Season 2 on at
    Retreive filters from JsonObject
    Hi, I think this requires some string functions to extract the order number first, such as 106044. Then filter from the AL code.
     
    Hopefully other experts can give you better advice.
     
    Thanks
    ZHU

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,904 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans