Skip to main content

Notifications

Announcements

No record found.

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
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.
  • Jason0810M Profile Picture
    Jason0810M on at
    Get all note attachments of sales order based on a specific type of attachment
    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.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,861 Super User 2024 Season 2 on at
    Get all note attachments of sales order based on a specific type of attachment
    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?
     

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,861 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,540 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans