Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Update Lifecycle of Managed Item via Script

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
hcoulter
1239 Views, 11 Replies

Update Lifecycle of Managed Item via Script

Hello,

 

I am trying write a script to spawn an item in a different workspace, add the newly spawned item to the original item's Managed Items Tab, and update the lifecycle of the new item to "Initial Design Revision". The whole script works except updating the lifecycle.

 

According to everything I've read, this should work:

 

var NewPartsAndBom = createNewItem('WS_PARTS_AND_BOM', newProperties); 

var NewManagedItem = item.workflowItems.addItem({RELATED:NewPartsAndBom});
item.workflowItems.lifecycle = 'Initial Design Revision'; 

 

When the script runs, this is the error message: java.lang.NullPointerException: null

If I comment out "item.workflowItems.lifecycle = 'Initial Design Revision'; " there are no error messages.

 

Help would be much appreciated,

 

Harper

11 REPLIES 11
Message 2 of 12
liumi
in reply to: hcoulter

Try to change "item.workflowItems.lifecycle = 'Initial Design Revision';" to

"item.workflowItems[i].lifecycle = 'Initial Design Revision';"



Michal Liu
Software Engineer
Product Lifecycle Management
Autodesk, Inc.

Message 3 of 12
gasevsm
in reply to: hcoulter

Greetings,
The 'item.WorkflowItems' is the collection holding the affected items including the one you just created. As such, cannot set lifecycle on a collection, but only on an individual applicable item within that collection.
Provided the item is eligible to perform that lifecycle transition, this should work after getting a handle on the added item:
NewManagedItem.lifecycle = 'Initial Design Revision';
Or this would work too (as long as you find the index [i] of the item just added and item is eligible to select this lcTrans):
item.workflowItems[i].lifecycle = 'Initial Design Revision';

If neither still work, kindly raise a support ticket and we'll look into the issue. HTH,

Martin Gasevski | Fusion 360 Team Product Manager
Message 4 of 12
hcoulter
in reply to: gasevsm

With this code:

    NewManagedItem.lifecycle = 'Initial Design Revision';

I am getting this error: java.lang.NullPointerException: null

 

With this code:

    NewManagedItem.workflowItems.lifecycle = 'Initial Design Revision';

I am getting this error: TypeError: Cannot set property "lifecycle" of null to "Initial Design Revision" (Create_Item_Parts_BOM_no_SAP#50)

 

I also played around with using "[i]" with no success. If I am missing something obvious, let me know, otherwise please direct me on how to raise a support ticket.

Message 5 of 12
gasevsm
in reply to: hcoulter

Hi,
I confirmed this code should work by design; would treat the error as a bug that needs correcting.
NewManagedItem.lifecycle = 'Lifecycle Transition Name';
Kindly visit this help guide on steps to log a support ticket. http://help.autodesk.com/view/PLM/ENU/?guid=GUID-6E0A13B0-DE38-4263-9C15-7509380A0941

Martin Gasevski | Fusion 360 Team Product Manager
Message 6 of 12
hcoulter
in reply to: gasevsm

I work for a reseller and it does not seem that I have the ability to create a support ticket. Specifically, I do not have the option to click "View my support cases" - step 3 in the guide you shared. How should I proceed?

Message 7 of 12
michelle.stone
in reply to: hcoulter

Harper - as a reseller, you can request technical assistance via Partner Center.  Are you able to access that?  If not, I'll open a case with Customer Care and have someone review your account.

 

Thanks,

Michelle



Michelle Stone
Technical Marketing, PDM & PLM
Autodesk, Inc.
Message 8 of 12
hcoulter
in reply to: michelle.stone

I do not have access, but I believe it is an issue on our side. I don't think a Partner Center account was created for me. I will get with someone in IT to figure that out.

 

My coworkers can access it, so once in Partner Center, how can we create support tickets?

Message 9 of 12
michelle.stone
in reply to: hcoulter

Looks like there's an option for the customer to grant you access for viewing their cases: Setting Reseller Permissions for Viewing Cases.  For logging cases yourself, it would be through the normal flow for Submitting and Viewing Support Requests.

 

Thanks,

Michelle



Michelle Stone
Technical Marketing, PDM & PLM
Autodesk, Inc.
Message 10 of 12
wendy.salas
in reply to: gasevsm

Hello,

 

We are having the same problem as described initially. We have a script that adds a Managed Item to a WS, but we cannot get the Lifecycle to populate (ideally we would like to also populate the Effectivity, To and From). Please see code below:

 

function createNewItem(wsID,propertiesArray) {
    newItem = createItem(wsID);
    for(var propKey in propertiesArray){
        newItem[propKey] = propertiesArray[propKey];
    }
    var wfItem = newItem.workflowItems.addItem({RELATED : newItem});
    wfItem.lifecycle = 'Publish New Document';      
}

The relationship is getting created (i.e. when we execute the script, the system creates the new Item, and it adds the linkage in the Managed Items. The problem is that the Lifecycle remains blank. The error we get is:

 

[Generate_Document_Change_Order] java.lang.NullPointerException: null

Message 11 of 12
gasevsm
in reply to: wendy.salas

Hi Wendy,

Updating EffectivityDate and To: (IFF using manual rev scheme) isn't available presently via scripting. Setting the lifecycle transition name via script is expected and designed to work; if you are having issues with this, kindly raise a support ticket to triage this matter. you shouldn't get a null exception, that is for sure.


Martin Gasevski | Fusion 360 Team Product Manager
Message 12 of 12
john.denner
in reply to: gasevsm

I'm having the exact same issues. item.workflowItems.addItem(); does not return an object. Nor does it add the new item to the beginning or the end of array workfItems array. It adds it in alpha numeric order. So it potentially it could be in position 0, 3, 2 or .length -1.

 

 

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

Post to forums  

Autodesk Design & Make Report