# new-instance-script handler

<span class="notranslate">It is responsible for instantiating new objectswithin a finder on user request .</span>

<div id="bkmrk-attribute-usage-if-e"><table class="confluenceTable tablesorter tablesorter-default stickyTableHeaders" role="grid"><thead class="tableFloatingHeaderOriginal"><tr class="tablesorter-headerRow" role="row"><th aria-disabled="false" aria-label="Attribute: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="0" role="columnheader" scope="col" style="width: 81px;" tabindex="0"><div><div>**Attribute**</div></div></th><th aria-disabled="false" aria-label="Usage: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="1" role="columnheader" scope="col" style="width: 458px;" tabindex="0"><div><div>**Usage**</div></div></th></tr></thead><tbody aria-live="polite" aria-relevant="all"><tr role="row"><td class="confluenceTd" style="width: 81px;">if

</td><td class="confluenceTd" style="width: 458px;">EL expression that must be evaluated to true prior to handler action

</td></tr><tr role="row"><td class="confluenceTd" style="width: 81px;">unless

</td><td class="confluenceTd" style="width: 458px;">EL expression that must be evaluated to false prior to handler action</td></tr></tbody></table>

</div><span class="notranslate">With the following example the model will alow to create a new city within a country:</span>

```western
<datanode name="country">
    ...
    <finder name="cities" type="city" >
        <collection-finder collection="${instance.cities}">
        <new-instance-script>
            c = new City();
            c.countryAbbreviation = instance.abbreviation;
            return c;
        </new-instance-script>
    </finder>
    ...
</datanode>
```