<h1>Contract number and name generator</h1>
<p>Contract numbers and names are created by generators. Each generator is based on a template that generates the contract number, for example, with the help of contract data. Additional information on numbers and names can be found in <a
href="#!/guide/pEB586201_2285_4D03_9D72_4F799451178E">Contract (contract file)</a>.</p>
<p><span class="tag_important">The contract numbers and name generator used to create a new file have to be specified in the <a
href="#!/guide/p7B9917EA_3551_445E_A621_AF59E23AE8DF">contract type</a> configuration.</span></p>
<p>{@img img1.png}</p>
<p>Information, including on the available template helpers (Handlebars.js) and templating options, is provided by the <code>sol.common.Template</code> class. A few examples are explained in the following.</p>
<p>The template syntax <code>{{ }}</code> enables access to contract information via the <code>sord</code> object. The <code>sol.common.ObjectFormatter</code> class transforms the ELO Indexserver sord object, forming the basis for this.</p>
<h2>Contract number generator</h2>
<p>Generators for the contract number have to be filed to <code>\Administration\Business Solutions Custom\contract\Configuration\Generators\Contract no.\</code> as text files.</p>
<p>Contract numbers can be generated with the <code>count</code> template helper. The helper expects a number range (here: <code>sol.contract.ContractNo</code>) and optionally the possibility to generate a number with a predefined amount of digits (here <span
style='font-weight:bold;font-style:italic'>000000</span>). </p>
<pre><code>C{{count &quot;sol.contract.ContractNo&quot; &quot;000000&quot;}}

// Results:
// C000001
// C000002
</code></pre>
<p>If the contract type (index field: <code>CONTRACT_TYPE</code>) is to be added to the number range, the contract number generator can be extended as follows:</p>
<pre><code>C-{{sord.objKeys.CONTRACT_TYPE}}-{{count &quot;sol.contract.ContractNo.{{sord.objKeys.CONTRACT_TYPE}}&quot; &quot;000000&quot;}}

// Results:
// C-Subscription-000001
// C-Subscription-000002
// C-Maintenance_Contract-000001
</code></pre>
<p><span class="tag_important">When creating your own number generators, make sure to include all number range information in the contract number. Otherwise, duplicate numbers may be generated.</span></p>
<h2>Contract name</h2>
<p>Generators for the contract name (short name) have to be filed to <code>\Administration\Business Solutions Custom\contract\Configuration\Generators\Contract short description\</code> as text files.</p>
<p>All contract information can be accessed in the process. The example below shows the standard solution where the contract number and contract name are added.</p>
<pre><code>{{sord.objKeys.CONTRACT_NO}} {{sord.objKeys.CONTRACT_NAME}}
</code></pre>
