I am currently trying to use a action script on creation that creates a numbering sequence. But everytime I go to test the action script through the script editor I get a reference error of "item" undefined on line 10(in red).
var DCOSeqID = '4835';
if (item.DCO_NUMBER === null){
//set the new number
var newDCONumber = nextSeqNumber(DCOSeqID);
if(newDCONumber !== null){
item.DCO_NUMBER = newDCONumber; }
} //end if
When testing in the script editor I input the WorkspaceID for the work it is for.
Solved! Go to Solution.
Solved by gasevsm. Go to Solution.
mmcvey,
The script as shared below has an undefined item context to run - the 'item' variable is not defined based on the snippet.
To access item.*, a PLM script must run in the context of an item dmsID. For testing purposes, you may try one of these two:
1. At minimum, provide a dmsID of an existing item in the test dialog. The workspaceID is optional since the editor will implicitly discover its ID from the provided dmsID. The userid (username) is also optional as the editor will run as you implicitly.
2. Write code to spawn a new item, and then once created, access its item.DCO_NUMBER to set its newly generated DCONumber from the sequence.
Hope this helps,
--
Martin Gasevski | Product Manager | Autodesk PLM 360