+1 vote

Is it possible to use parameters inside a template? For Example

[foreach leads]
 Name: [GetFormattedAttributeValue("mykey")]

a "lead" has the method GetFormattedAttributeValue(String identifier").

But all I get is 'GetFormattedAttributeValue("salesstagecode")' was not found.


1 Answer

0 votes

You can't pass parameters to methods. Only properties and parameter-less methods are supported.

This is 'by design' to prevent users from coding in templates, and force them to create proper view models.

You'll have to create parameter-less method or property that invokes GetFormattedAttributeValue(string) method with appropriate parameter.

As a side note: You can use format strings when you display dates or numbers:

This reply was generated on [Date:yyyy"/"MM"/"dd HH:mm]

Format strings work on anything that implements standard IFormattable interface.

by (298k points)