On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Auto DCR Naming Code - TST 5.5

Hi All,

I thought I'd share some code to implement auto-naming DCR's through FormAPI. By autonaming, I mean that when you save an untitled DCR, it will automatically assign it a name without the user having to enter a logical filename. I saw a few posts floating around that related to this subject, but didn't find any good examples for my own use. So I've attached some code that you might find useful.

To use, just dump the attached file into either a global include location or in your data category and use the appropriate script tag to reference. I use a global reference like the following:
<script src="/iw/userscript/autoname_dcr.js"/>
By default the DCR name is generated using the following convention:
Today's date + DCT Field (up to four words, optional) + Random 5 digit number
e.g. 10_01_03_company_39_release_new_40433

The optional DCT field can be specified by this userscript:

<script>
<![CDATA[
// Set the autonamed field
autoNameField = "/title";
]]>
</script>
Where autoNameField is a reference to a DCT field. I use the title of a press release.

Feel free to modify for you own needs. You could also modify this code for TS 6.0 as a custom naming handler too.