0

Document Template Object Reference

  • updated 2 mths ago

Some of the SolarNexus template variables described in the Available Variables list on the template editor screen are objects containing sub-properties. For example, the salesperson variable is a User object with properties corresponding to the project sales owner's name, phone, email, etc.

This article describes each type of SolarNexus template object and the properties it contains.

To output an object-type variable in a template, use the syntax {{object.property}}. For example, to output the sales owner's full name, write {{salesperson.full_name}}.

Object Reference

  • Date
  • Milestone
  • User
  • Solution Element
  • Item
  • Finance Option
  • PV Array
  • PV Inverter

Date

Property Name Description
raw raw date object, can be used with Liquid template date formatting expressions
full_date e.g. Monday, July 29, 2017
short_date e.g. 7/29/2017
day_of_week e.g. Monday
full_month e.g. July
short_month e.g. 7
day_of_month e.g. 29
ordinal_day_of_month e.g. 29th
year e.g. 2017
time e.g. 5:30pm

Milestone

For milestones, use the name of the name of the milestone before completion as the object's name. So for example, if your scheduled milestone is "Sales Appointment," you would use "sales_appointment" as the object. If you wanted to provide the scheduled start date and time of the Sales Appointment in a paragraph in your template, that could be:

<p>{{sales_appointment.start_at.short_date}} at {{sales_appointment.start_at.time}}</p>

 

Property Name Description
name name_after_completion if milestone is completed, otherwise name_before_completion
name_before_completion e.g. Sales Appointment
name_after_completion e.g. Sales Appointment Completed
completed_at a Date object representing milestone completion time, or blank if not completed
owner a User object representing the milestone owner, or blank if not assigned
owner_or_salesperson a User object representing the milestone owner, or the project's sales owner if the milestone has no owner

 

For scheduled milestones only:

Property Name Description
start_at a Date object representing event start time
has_duration true if event has a duration, otherwise false
duration_hours e.g. 1
duration_minutes e.g. 30

User

Property Name Description
full_name user's first and last name, e.g. Jane Doe
first_name user's first name, e.g. Jane
last_name user's last name, e.g. Doe
title title from the user's profile, e.g. Project Manager
phone user's phone number, e.g. (510) 555-5555
email user's email, e.g. jane.doe@example.com
hin home improvement number from the user's profile
bio bio from the user's profile

Solution Element (aka "Services")

The user interface refers to Services, but the associated template variables use the term "solution_elements." Solution_elements is an array of solution_element objects containing all solution elements, regardless of type, ordered by user-specified position. Each solution_element object has:

  • type - The top level categories of elements. Its a predefined enumeration of these values: PV System, Storage System, Efficiency Measure, and General Service
  • subtype - This is known as the "Service Type" in the SolarNexus UI. It is a set of Admin defined values
  • name - This is the user provided name for any "General Element" or "Efficiency Measure" type element. PV and storage element types are auto-named "PV System" and "Storage System"
  • description - the short description of the scope of work for this solution element.
  • items - items is an array of product items in the solution_element, each with:
    • type (REMOVED)
    • category - This is the Company Catalog's product category
    • sub-category - This is the subcategory within the Company Catalog where the product resides. Note that some Catalog categories do note have subcategories.
    • provider - In case of materials/products, this is the manufacturer. But items can also represent services or labor, so provider covers both.
    • model_name - Product model number, or the name of the service/labor item.
    • quantity
    • img_url - outputs the url for the first image associated with the item (i.e. a product in the Company Catalog can have an image uploaded).
  • cost object properties, a solution_element's cost object includes:
    • subtotal
    • adjusted_subtotal
    • preliminary_contract_price
    • unit_price
    • cost_item_groups. Each cost item group object has:
      • sub_total_price
      • name
      • description
      • optional cost_items (if enabled for the group). Each cost item object has:
        • provider
        • model_name
        • variation
        • quantity
        • unit
        • cost
  • plus any other properties specific to the element type
  • EE element-specific values:
    • electric_savings_annual
    • electric_savings_annual_percent
    • non-electric_savings_annual
    • non-electric_savings_annual_percent

We also provide the following objects that define specific solution elements, or subsets of solution elements:

  • Existing ee_measures object variable becomes a subset of solution_elements of type "Efficiency Measure."
  • general_solution_elements is subset of solution_elements of type "General Service"
  • pv_solution_element object only includes properties of the one and only one PV system element (type = "PV System")
  • storage_solution_element object only includes properties of the one and only one storage system element (type = "Storage System")

Object name is solution_element. Also have special specific solution_elements: pv_solution_element and storage_solution_element. There is a collection (solution_elements) that you can loop through. And special solution_element collections that are a subset of elements: ee_measures, and general_solution_elements.

Property Name Description
type ENUM. One of the following legal values: PV System, Storage System, Efficiency Measure, General Service
subtype DESCRIPTION NEEDED
name Name, of the element e.g. PV system, EV charging station, etc
description EE Measures and General elements have a description field. Default descriptions can be defined in an element template, but can be edited in a solution.
items a collection of Item objects. An Item is a product from your Company Catalog that can be associated as a key item for the solution element. Just as PV Systems have PV Modules, Inverters, and possibly Optimizers, you can custom create a solution element with whatever item types are required to call out in proposals and contracts.
cost XXXX
TBD XXXX
TBD XXXX
TBD XXXX

Item

Object is named item, an object within a solution_element. (for item in solution_element.items)

Property Name Description
category {{item.category}}
sub-category {{item.subcategory}}
quantity {{item.quantity}}
provider {{item.provider}}
model_name {{item.model_name}}
description {{item.description}}
image url {{item.img_url}}

Finance Option

Object is named fin_opt. An analysis can generate an array of up to 3 finance option objects. There is a collection (fin_opts) that you can loop through.

Property Name Description
type ENUM of the following values: cash, unsecured loan, secured loan, PACE loan, lease, power purchase agreement
Name Given name of finance option. Built in generic types have the following names: Pay Cash, Unsecured Loan, Secured Loan, PACE Loan, Lease, PPA.
TBD XXXX
TBD XXXX
TBD XXXX
TBD XXXX
TBD XXXX

PV Array

Used in the pv_arrays array variable.

Property Name Description
name Array name
area_type Roof Face, Flat Roof, Ground
slope e.g. 26.57
azimuth e.g. 180.0
annual_solar_access e.g. 97

PV Inverter

 Used in the pv_inverters array variable

Property Name Description
qty Number of inverters of this model.
subcategory Microinverters - grid-tie, String inverters - grid-tie, etc.
mfr Manufacturer
model Model name
rating_kwac_num kWac without units
img_url Image URL, if inverter has an image.

Using Objects in Liquid Directives

Object Indices

The objects in a collection have an index from 0, 1, 2 (first, second, third position)

It’s OK to reference an indexed object in a conditional directive {% %}, but not in a simple evaluation {{ }}. For example, You can do this:

{% assign loan_one.name = fin_opt_loans[0].name %}
loan 1: {{loan_one.name}}

But not this:

loan 1: {{fin_opt_loans[0].name}}

Due to the way the template is parsed during evaluation, you can’t reference a non-existent array index inside {{ }}, even if that is enclosed within an {% if %} that would prevent it from being evaluated. I think it parses all the expressions in {{ }} prior to evaluating the conditionals, and in the process of parsing an expression involving an array, it tries to access the referenced index, which is where it’s failing.

Assigning fin_opt_loans[0] to fin_opt_pre allows it to work because it’s ok to reference object properties inside of {{ }} even if that object might not exist. When initially parsing that expression, it doesn’t check if the object exists.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 4 mths agoLast active
  • 9Views
  • 1 Following