What's the best way you've found to get the conversion rate of the Unit of Measure on each line of a transaction, in Advanced PDF/HTML Templates? I've been able to find the UoM internal ID and abbreviation name on the line, but not the conversion rate. I also can't seem to create a transaction line field to look up the conversion rate, so I'm looking into other options. I want to avoid creating a script or workflow to populate the line fields when the transaction loads or saves. We have enough of that mess going on already.
Well, I couldn't find a way to do it without scripting or workflows, but I got it to work without storing the conversion rates on the record being rendered as a PDF, by adding a custpage field in a beforeLoad userevent script function, and populating it with a JSON of unitstype search results, then in the template I ?json_eval that field and iterate over that array it parses to, until I find one matching the abbreviation of the item.units, and get the conversionrate from that one.
This amounts to the same effect in the PDF as a nonstored field with a summary search-driven default value (which is what I was trying to do but couldn't because of the requirement to match on a available filter field).
The beforeLoad event does NOT fire when rendering the PDF as part of an Email merge & send action though; so I will have to store the field after all.
It's silly to have thousands of copies of the same data floating around though. I'll want to refine this.