Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Retreive filters from JsonObject

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
 
Categories:
  • 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 288 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 68,842 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

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,353 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,251 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans