There are several ways to do this and the script you show should work for this. How does it fail for you?
the email is sent with all the required fields. The notes that is sent only shows the first note. So note 2 thru 5 is not apart of the email.
so I got it to work by making the "NoteField" into a merge field. Now it is hard to read because there is really no separation between Notes.
But why aren't you just using $List?
and are you sending an attached PDF of this info?
Otherwise a merge field has no effect on what data appears in the body of an email.
No I'm not sending out a PDF, just text on the body of my email. I got it to work without the merge field. Is there a clever way separate the records from that field?
Yes, between each loop, add
& ¶ & ¶ &
at the end of the calculation with the field being added. This will add two returns.
Your script's use of the list function is already putting one return between each note.
And a "merge field" is a specific object that you put on a layout so you must have meant something different when you used that term.
I'm going to guess the relationship isn't allowing the Lise function to work correctly. I've never tried a List in a Loop before, so maybe that is interfering with List working correctly. Bottom line, he shouldn't need the Loop with List, List should do it providing the relationship is accurate.
xxx202xxx, would you be willing to post a sample of your db with some data for review? I'm sure the community can get it sorted our for you.
Can you clarify why you don't (or cannot) use the single script step
Set Variable [$NoteList; Value: List ( Note Mangement::NoteField)]
Go to Related Record [From Table: "Note Management"; Using "Note Layout (Note Management)]
Go to Record [First}
Set Variable [$NoteList; Value: List ( $List; Note Mangement::NoteField)]
Go to Record [Next; Exit after Last]
I have frequently used list in the manner found in this script. It works just fine to build a return separated list of values with any null values automatically omitted and no extra return on the end of the list as is often the case with other scripted methods for building the list.
I would assume that a single use of List doesn't work here because it's not being done from the context of a single parent record where you can get a list of the children but rather is building a list from a found set.
You could, however, get the same list from a "list of" summary field that lists the notes field and that would eliminate the need for a looping script. But I don't see any obvious errors in the script it self. Perhaps xxx202xxx wants an extra space between each note to improve readability. that would require a change to the script shown.
My sevice::ticket table can have zero or more notes per ticket. So I'm first going to the note related table to obtain a found set of notes. Then Im using the go to record and loop step after that. Does it make any difference that the layout I'm going to is a list layout?
No, but if you are going to a set of records just to build a list, don't go to those related records. As has already been suggested, just use List ( Relatedtable::Field ) a single time to get the list without any loop at all.
If you need to double space that list, this can easily be done by including a substitute function to turn single returns into two returns.
That's it exactly. Readability
Substitute ( List ( RelatedTable::Field ) ; ¶ ; "¶¶" )
Will double space the notes and allow you to do this in one step. You might even be able to code this directly into your calculation for the email body.