Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / LiveCycle Developer Center /

Automatically numbering documents uploaded to LiveCycle Contentspace ES2

by Yogesh Bahuguna

Yogesh Bahuguna

Content

  • Step 1: Create a rule
  • Step 2: Create a script

Created

27 September 2010

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
LiveCycle Designer ES4
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

Some experience with using LiveCycle Contentspace ES2 will be helpful.

User level

Beginning

Required products

  • LiveCycle Designer ES4 (Download trial)

When multiple people are uploading content to Adobe LiveCycle Contentspace ES2 sometimes it can be difficult to avoid name conflicts. To avoid the unnecessary hassle of finding a new name for the document you can easily write some simple scripts that will take care of name conflicts for you automatically.

In this article, I’ll cover how to create a simple rule that will be applied on all documents when they are uploaded in the space where the rule is implemented. This rule will simply execute a script that will do the automatic numbering of the document and store the number as the name of the document. If you want to keep the original name of the document then you can simply prefix or append the number generated by the script to the original name.

Step 1: Create a rule

Follow these steps to create a new content rule in LiveCycle Contentspace ES2:

  1. Login to LiveCycle Contentspace ES2 and open the space you want to work with.
  2. Click More Actions > Manage Content Rules, and then click Create Rule to open the Create Rule Wizard.
  3. In the Select Conditions section specify the content that the rule will affect. If you want all content types to be indexed then select All Items, otherwise select as required based on type, name, and so on. You can define multiple conditions. Click Next.
  4. In the Select Actions section, select Execute A Script. When you select this option all scripts in the Data Dictionary / Scripts space will be available. Here you need to name the script that you will create in Step 2 below. For example if you name your script ContentRename.js, you would specify that here. Click Next.
  5. In the Enter Details section select Inbound as the Type so that the rule will be invoked on inbound content. Type a title and description for the rule; for example type Rename for both. You may select the option to apply the rule to sub spaces if that is appropriate. Click Next.
  6. Verify the summary of the new rule (see Figure 1) and click Finish.
The new rule for executing the renumbering script
Figure 1. The new rule for executing the renumbering script

Step 2: Create a script

When a script is executed on a document, it is available as an object named document, which can be used in the script. The current name of the file is available as document.name.

There are several ways of generating a random number to use in creating a unique name for the document. The script below uses the row id of the document. Every document uploaded to Contentspace is stored in database and is exposed to the document as a property.

Because there can be errors, it’s a good practice to ensure that the upload was successful, so the code below verifies that the file exists in the space before attempting to rename it.

var filename = document.name; if(filename != null && filename != undefined) { // uploaded file retrieved from space just to make sure that file was // uploaded without error. var newfile = space.childByNamePath(filename); var newName = "Doc"; var dbid; var fileext = ".xml"; if (newfile != null ) { //Get the Row Id of the document currently uploaded. dbid = newfile.properties[ "{http://www.alfresco.org/model/system/1.0}node-dbid"]; if(dbid != null) { // Find the extension of the file var dotIndex = filename.lastIndexOf("."); if(dotIndex > 0) { fileext = filename.substring(dotIndex); } document.name = newName + dbid + fileext; //save the document document.save(); } } }

Where to go from here

You can modify this script to implement different naming conventions based on the type of the file. For example, if the file is an XML, DOC, or TXT file, you could use a format such as  DocXXX. If it is an image (a JPG for example) you could use ImgXXX.

For more details on content rules, see Getting Started with LiveCycle Contentspace ES2 .

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement