Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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
    26 on at
    Retreive filters from JsonObject
    Thans you for your answers.
    I used string functions to retrieve "document no" filter .
  • Suggested answer
    Shrey Chauhan Profile Picture
    276 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
    85,674 Super User 2025 Season 1 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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans