Document Template Classes
From AgileApps Support Wiki
Revision as of 21:15, 5 April 2012 by imported>Aeric (→Configuring the Print Template to Use the Method)
This page is currently in progress...
About Print Template Classes
As far as a Print Template is concerned, a data object is simply a HashMap in the TenantContext. By manipulating the HashMap(s) it contains, you change the data that the Print Template has available for processing.
- Template reference: $objectName.fieldname
- Retrieve a data object: TenantContext.get(objectName)
- Add or update a data object: TenantContext.put(objectName)
- Get a field from data object:
- Add or update a field in a data object:
Configuring a Print Template to use a Specified Class and Method
- --select the class, and the method to use
Methods that take following arguments are listed:
- com.platform.api.TenantContext - The container that the print template gets its data from.
- String (objectName) - The name of the object the print template was invoked on.
- String (recordID) - The ID of the record on which it was invoked.
__TBD: objectName is passed in, yes? Does return value have to be void__
Accessing Lookup Target Records
Data from lookup-target records is stored as a nested map. So to get data for the template variable $Order.customer.name:
- HashMap orderMap = TenantContext.get("Order") gets the Order HashMap from the TenantContext.
- HashMap customerMap = orderMap.get("customer") gets the lookup-target record for the customer field.
- String name = customerMap.get("name") gets the customer's name.