You can save to PDF using the append command, but I believe it will append a new page for each record. It's an option in line 18 of your script.
An easier thing to do would be use the "hide object when" functions, and "stack" your body part templates on top of eachother, so they change their automatically based on a calculation. This is usually how I do time and expense entry reports and certain invoices now, but you can also use it in regular list views and forms as well.
Could you expand on the "hide object when..." idea?
The Body potentially returns many records requiring differing layout versions per record in the same document. I think I understand but not sure how to apply a calculation to hiding objects in that way. I currently have a Script Trigger that changes the layout depending on fields either Empty/Valid but that changes the layout for all records in the current document.
Hope I've made that clear?
I've just read up about "hide object when..." - hadn't used it before but think it's going to work.
Yep, one of the best features available.
Ok, it works in part. However 2 of the fields and a portal need to appear in different sizes depending on amount of data that’s within them. If a field or portal is duplicated in the same layout, can you make one visible and other not using the Hide Object if it’s grouped with another object or on it’s own even?
Couldn’t reply via Forum - I think the discussion has closed.
Figured it out and all working!
Many thanks - learn something new every day.