Code Components
Fundraising makes use of a few klevr utilities.
Klevr Utilities
Fundraising makes use of a few klevr utilities. Some of the utilities need to be configured to work properly.
Field Locker: This utility locks fields on records based on their status. The product includes locked field configuration for Gift and Gift Batch records. The fields can be tweaked through the field locker interface (webresources/klevr_admin.html). The config is written Environment Variables that can be included in your solution.
Clone: This utility copies a record and related records. It can be configured to exclude certain fields (e.g. autonumbers, start dates). It is used in Fundraising for Gift adjust, Return and Voiding. The configuration is also written to environment variables (klevr_Cloneklevr_gift_adjust, klevr_Cloneklevr_gift_void, klevr_Cloneklevr_gift_return). These configurations can be adjusted to suit customer specific fields.
Status Transition: This utility prevents normal users from changing status between specific values (e.g. canceled back to active). It is configured for Klevr Gift. It can be adjusted using the status transition admin interface (/webresources/klevr_admin.html)
Execute SQL Query: This utility allows plugins to execute SQL qeuries. This is used extensively for all the gift statistics in the system (e.g. lifetime giving amount and count). Fundraising defines a number of asynchronous plugin steps (mostly on gift) that specifies the queries to run and fields to write the calculations to. It can be extended to include customer specific calculations too, by configuring new plugin steps and specifying the right configuration for the query to run and the field to write the answers to.
It is also used by a scheduled flow that runs daily and executes a query to find differences in actual values vs committed values on contacts that are date based (e.g. giving over the last 6 months). The query returns all contacts where there are a mismatch, and the flow then updates all of the relevant contacts with the new values.
For the Execute SQL Query utility to work, you have to follow a specific setup to create an App Service Registration with access to Dynamics, configure a federated identity for it, and bind it to the plugin assembly. These steps are documented in the Klevr Utilities documentation.
Save and New from subgrid: These consist of some re-usable scripts. 1 script is bound to a custom button on the subgrid for specific entities. The other script is bound to a save and new button on the relevant entity form. Together these two buttons allow the user to create multiple records that are all associated to the original record. This is used for gifts on a gift batch and commitments on a gift. In addition these two main forms have a custom script to hide all tabs except for a "quick create" tab, and hide the entity heading. This makes the main form look like a quick create form, but still have all the functionality and script execution of a main form, allowing these buttons to work.
UI Features
Statistics web resource: This web resource are added to various entities like Campaign Appeal, Package, Contact, Account. It looks for specific fields on the record, and if they have a value, it displays a statistic tile for the field. If you wish to show other fields or alter the behaviour, easiest might be to create an unmanaged layer on the web resource and altering the code. You will notice that it has a list of fields, their type and a label. You can easily extend this to add your own fields or remove default fields you do not wish to display. The type drives the icon used for the tile. The format is driven by the regional settings for the user (e.g. date format). The values in the standard fields are all configured to automatically calculate as per the "Execute SQL Query" utility section above.
Gift Import: The Gift Import Entity is almost a copy of the gift record, but allows for importing from an excel sheet where you may have different identifiers for "lookups" in Dynamics. These are imported as string fields into the import record. A plugin will run on create to attempt to match each of the fields. If an exact match is found, the lookup will be set. Alternatively a user will need to use the Match tab to select a field to resolve, and select a record from the list.
Both the plugin and the Resolve tab are driven by a set of queries defined for each field. These queries can be fine tuned per implementation. They are defined in the "klevr_giftimportresolvequeries.json" web resource. Create an unmanaged layer on this web resource with your own queries. Follow the format in the existing file.
Each entry in the JSON object has a key of (e.g) "Code_344590000". This refers to the dropdown that contains the fields to resolve. In theory you could add your own fields to the list too, as long as they have matching string and lookup fields on the entity. For each of these entries, you specify the string or match field (in the FormValue proeprty), the Lookup attribute to resolve to (ResolveAttribute) and the FetchXml to run. In the fetchXml, you can place a "slug" called {{formvalue}} which will be replaced with the value that was imported from excel into the match field. For instance you can have a fetch to retrieve records where the external id matches the imported field value.
Gift Import Conversion: The mapping used for the conversion of Gift Import Records to Gifts can also be customised. This is done by editing the klevr_giftimportmapping.json web resource. It's a list of from and to values, which should contain the schema name of the fields in the gift import and gift tables. The filed types need to match, but you can add your own custom fields to both entities, and add them to the web resource and to your excel import template to ensure they also get imported and converted all the way through to the gift record.
Gift Scanning: On the Gift Batch's Gift Scanning tab, we have a web resource that allows you to use a scanner to convert an Appeal to List record to a gift. The web resource loads some metadata required to help the process. As part of this, it loads the "klevr_appealtolist_giftmapping.json" web resource and uses the contents to know what fields to map to the newly created gift. You can customise this web resource to add any additional client specific fields for this process.
The web resource itself allows you to enter a string and press enter. This will initiate a search for an appeal to list record with a matching autonumber, and if found, create a gift by populating the mapped fields from the Appeal To list record and gift batch record. It will also clear the input field and retain focus, so that it is ready to scan the next record.
If you are using a barcode scanner, you can configure it to enter the code and then press enter (or newline). This will allow you to continuously scan barcodes without additional input while the system will create the gifts from the records.
Last updated on