script time out error

Anonymous

script time out error

Anonymous
Not applicable

Hi guys,

 

I get a time out error when the transistion runs my action script.  This is the first time I'm seeing this and the only thing different about this record is the large number of attachments.  There are 33 files attached to this record where I'm taking each attachment and creating a hyperlink for each.  Ususally the file attachment sizes are under 10 but this was an exception.  

 

When I try the same script with say 1 file, it is able to run.  What options can I look into?

 

 

2016-05-31 16:34:31.166Jason Leung (leungjcp)[ECO_Notify_complete (line 136, col 0)] org.mozilla.javascript.WrappedException: Wrapped com.dms.scripting.exceptions.ScriptTimeLimitException: Script ran too long: 10733ms (ECO_Notify_complete#136)
0 Likes
Reply
Accepted solutions (1)
1,217 Views
11 Replies
Replies (11)

Anonymous
Not applicable
There is a time limit on script execution. It is hard to say what you
could do differently without seeing your script. You may be able to
optimize it or you may need to choose another approach, such as an on
demand script or other type of behavior. Can you post your script,
without any identifying information, for us to provide assistance?
0 Likes

Anonymous
Not applicable

This seems to be the offending code.

 

for (k = 0; k < arraylength; k++)
{
filename[k] = item.attachments[k].fileName;
fileid[k] = item.attachments[k].fileID;

 

drawing_links[k] = '<html><body><br><div style="text-align: left; padding-left: 200px"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">'
+ '<a href="https://nucap.autodeskplm360.net/servlets/DownloadFile/'
+ filename[k] + '?fileID=' + fileid[k] + '&dmsID=' + dmsID + '&workspaceID=94">Updated Drawing: ' + filename[k] + '</a></font></br></body></html>';


format_link[k] = '<br><a href="https://nucap.autodeskplm360.net/servlets/DownloadFile/'
+ filename[k] + '?fileID=' + fileid[k] + '&dmsID=' + dmsID + '&workspaceID=94">' + filename[k] + '</a>';

}

 

 

When I remove this portion of the code it works fine.  Even if I leave the first line in the for loop, it times out. All I'm trying to do is get the hyperlinks to the attached files....and put them in another work space for others to see.  See image.hyperlinks.JPG

0 Likes

gasevsm
Alumni
Alumni
Hi Jason, seeing the image...have you considered adding a link to the item attachment tab itself that contains all the files you're looping through? Users will click on one link taking them to attachments tab both ways.

Martin Gasevski | Fusion 360 Team Product Manager

Anonymous
Not applicable

Hi Martin,

 

I initially, during development, thought about using the above mentioned method but we utilize reports heavily to see pending tasks.  When Engineering finishes their work, the result are part drawings and multiple records are then created for specific departments to monitor their progress.  In each new record, I write to a field all the hyperlinks for the attachments.

 

Each department point person can now view and have easy access to the drawings through a link in their report.  Here's a sample image.

 

pending.JPG

 

 

0 Likes

Anonymous
Not applicable

Bastien helped me today to resolve this issue for now. My script was timing out at around 22 attached pdfs.  We removed "getprintview" line of code which I was not using and it gave me 1 extra pdf for a total of 23 before time out.  For us....it may be an on-going issue.

0 Likes

Anonymous
Not applicable

Doesnt look like this was metioned,

 

Another solution you can look into is reducding the over all scirpt and inculding 3 functions,

1. to collect to given information,

2. create the hyperlink

3. to populate the given information to target workspace.

 

This will extened the amount of time you have to run the script overall, provided you with flexibilty on changing the script or adding changes, and you might find it to actual run faster

 

~Joe P

0 Likes

Anonymous
Not applicable
Hi Joe,

Do you mean create a library script so that my action scripts chains to the library script which would give me more time before the entire script times out? It was mentioned by chaining I would be given more time before timing out?
[http://www.nucapbrakes.com/images/image001.jpg] Jason Leung - Design Engineer
NUCAP Industries Inc.
3370 Pharmacy Avenue, Toronto ON
Ph.416 494 1444 FAX.416 494 2505
Jason.Leung@nucap.com

Please visit us at www.nucap.com www.gripmetal.com



[http://www.nucapbrakes.com/images/banner-nrx.png]
0 Likes

Anonymous
Not applicable

Yes,

 

So it would be something like this:

Action script to find the item > pass item and target location to first library

>library script to create the hyperlink > pass hyperlink and target location to second library

>>library script to add to workspace > write information to target item

 

The values you would pass would be

item in question

link to target workspace

 

0 Likes

Anonymous
Not applicable

Thanks Joe,

 

I will give it a shot and see if there is improvement.  

0 Likes

Anonymous
Not applicable
Accepted solution

Whoa...so I created a library and I input item.attachments to it.  From there I do all my looping.  The output is a list of hyperlinks.

 

The computation is much faster now.  Visibily the spinning wheel finishes faster.  I was only able to attach roughly 22 pdfs before. Now I am able to attach at least 43 pdfs just by placing my loop in a library script.  

 

Thanks all.

 

 

0 Likes

Anonymous
Not applicable

Glad I could help out

0 Likes