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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Get all note attachments of sales order based on a specific type of attachment

(1) ShareShare
ReportReport
Posted on by 8
Hello,
I am trying to concatenate all note values of docuref of sales orders.
I have a custom field on the docutype which needs to be set to Yes to work.
 
My request is as follows:
 while select Notes from docuRef
            join RecId from docuType
            where docuRef.RefRecId == salesTable.RecId &&
                docuRef.RefTableId == salesTable.TableId &&
                docuRef.RefCompanyId == salesTable.DataAreaId &&
                docuRef.TypeId == docuType.TypeId &&
            docuRef.ActualCompanyId == docuType.DataAreaId &&
                docuRef.Notes != '' &&
                docuType.XXXCustomField == NoYes::Yes
                {
                stringValue += docuRef.Notes;
                }
The sales table record has a value when debugging.
However, the while loop is not being executed.
I have run a T-SQL statement for the record and it is returning records in MSSQL.
  • André Arnaud de Calavon Profile Picture
    307,893 Super User 2026 Season 2 on at
    Hi Jason0810M,
     
    Can you tell where exactly you added this coding? Is the debugger hitting the while select statement or is your code skipped at all? 
    Have you tried taking out the condition DocuRef.Notes != '' and have an additional if-statement to check for contents before filling the stringValue variable?
     
  • Jason0810M Profile Picture
    8 on at
    Hello Andre,
    I have removed the condition DocuRef.Notes != ''.
    I have an if condition inside the while loop and it seems to be working fine now.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 445 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 309 Super User 2026 Season 2

#3
CU29091230-0 Profile Picture

CU29091230-0 192

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans