Autodesk PLM 360
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Script Time Limit Exception
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
I have developed a script to update the derived fields on some records I have imported (there is currently a bug where derived fields do not resolve during import - they only reolve when the item is edited). The problem is that I have over 5000 import records to modify (dmsID 50575 to 55716).
The script below works (I use the workspace 'create' behaviour to call it). However when I try to run it for more then 200 or so records I get a 'ScriptTimeLimitException' error (see attached). Please advise.
The scirpt is:
//This script resolves derived fields. Required because serived fields do not resolve during import.
record = 50575;
do{
var newItem = loadItem(record);
if (newItem.CONTRACT_NUMBER4 != null){
var linked_item = newItem.CONTRACT_NUMBER4;
if (linked_item.CUSTOMER != null){
newItem.CUSTOMER4 = linked_item.CUSTOMER;
}
if (linked_item.DETAILS != null){
newItem.DESCRIPTION2 = linked_item.DETAILS;
}
}
record++;
}while(record <55717);
Re: Script Time Limit Exception
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Scott,
Clever
That's a system limitation so we don't have "run away" scripts. Think of cases where stuff is just so intensive that it actually affects the performance of your site, etc... It's set to 500 ms.
So - What you can do is break it down in chuncks. Try processing 1/2 of them first. Then edit the script and do the other 1/2. That doesn't fly do 1/3 or whatever.
(or chunks of 1000? I have no clue how many it can do... It will take some experimenting.

Brian Roepke
Director of Product Lifecycle Management
Autodesk, Inc.
Re: Script Time Limit Exception
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Scott,
I can only seem to get it to run for about 200 records at a time. Is there nay way to make the code more efficient as you see it? (i'm not a software person BTW) ;-)
Thanks,
David.
Re: Script Time Limit Exception
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry. Brian - not Scott.
Re: Script Time Limit Exception
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I don't see any obvious performance issues with your script, however you may be able to gain some performance using a multi-pick list and not the loadItem function. This approach might take a couple of temp workspaces to get through the process, but could increase your chunk size.
Product Manager, Product Lifecycle Management
Autodesk, Inc.
