cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UNIQUE Validation is not Checked in Action Scripts - Allows Duplicate Part #s.

UNIQUE Validation is not Checked in Action Scripts - Allows Duplicate Part #s.

Here is an example of customer with expectations for Part Number Generation:
1.) They have an Existing number structure that needs to be maintained (228 different and unique sequences)
2.) They Allow Manual Entry of numbers. If no number is provided, one will be generated based of a set of conditions
3.) Since they allow manual part numbers, numbers could be created (and have) that are past the current sequence value. 
4.) There part numbers schema and requirements are based off limitations on an ERP system and are non-negotiable (I have followed this up recently with upper management)

How the was Implemented at the customer:
1.) Created a Auto Part Numbering workspace for the 228 schemas (very similar to the default Classification Structure Workspace)
2.) Implemented scripting based of of classification to select the correct schema (see above) and generate the part number.
3.) This all works perfectly minus this issues detailed below.

What the Issue is:
1.) The UNIQUE Field Validation is not Checked in Action Scripts (onCreate, onEdit, etc). So:
- Manually Entered Part numbers work just fine and UNIQUE validation is maintained
- Scripting Generate Part number ignore the UNIQUE validation and duplicate numbers are created
2.) If the UNIQUE field validation is not checked in action scripting (either by Default (Current) or through selectable script or function properties (Not implementation, but an option?), we need a way through scripting to determine if a Field value is UNIQUE.

 

Note: Autodesk worked with us previously on a solution to this that records and checks against previous part numbers created. This is not a good solution for this particular customer due to:

1.) Size and Cleanliness of legacy data.

2.) Time needed to create this data for legacy.

Please help us find a better solution to support the UNIQUE validation in scripting.

8 Comments
Anonymous
Not applicable

I agree- Need a way to enforce or check for Uniqueness in scripting.

fred_smith
Autodesk

I'd like to see additions to the script library to do ad hoc queries on arbitrary workspaces. If we had this, then good scripting could check before creating a non-unique part number.

 

But, I can imagine issues if uniqueness were always enforced. For example, for now, scripting can be used to fix bad data. Maybe there needs to be an optional behavior or function that enables/disables constraints for a specific script. Or a behavior like firing scripts on import, which operations can turn on/off. Or, if uniqueness were always enforced, a try/catch block could do something different (an update rather than an insert) if a validation fails. Several options... not sure which would be best to enable.

Nathan
Participant

I agree, there needs to be a better solution to check for uniqueness against a field defined as unique when using Action Scripts to create/edit items

Anonymous
Not applicable

I faced this issue today, thinking my field was unique.  The system allowed me to create a duplicate record even though I put a unique validation on the field.

 

During record creation, I have the user enter all the necessary parameters in the part number.  I then have a script which takes all the parameters and generates a formatted record name which should be unique.  Like everyone said here, action scripts and uniqueness don't mix.

Now I'm stuck because I don't want to use a computed field to generate my record name.  I don't find it flexible enough like the scripting.

bryce_crawford
Advocate

I'm facing almost an identical issue with our tenant. I need to be able to have a part number generated based off of some rules. The items get generated via script, but the uniqueness check does not happen. I can't find any workaround and it seems like there should be a simple solution.

Status changed to: Accepted

Hi all,

 

We are working on implementing a strict validation of unique values across the workspace (in addition to the existing unique), however it won't be available in Revision Controlled workspaces (as there are different records for the same revision of the item, thus identical fields across different dmsIds/itemIds).

 

I'll keep you apprised of progress.

 

Thanks,

 

Giliar

 

Status changed to: Implemented
 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report