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: 

Can a picklist be accessed from a script?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
mpasumarti
655 Views, 5 Replies

Can a picklist be accessed from a script?

I have a requirement wherein I have to compare a field value on an item with bunch of values (over 30) to perform an action. As I didn't like the idea of hard coding the values in the script I thought of creating a static picklist and accessing it/its values and accessing it from the script. Is there an API to access a picklist from script?

If there is no API, any other suggestions?


Thanks,
Madhav
5 REPLIES 5
Message 2 of 6
shenx
in reply to: mpasumarti

you can access a multi-select picklist field in an existing item, and access the values use

item.PICKLISTX[0]

item.PICKLISTX[1]

...

Message 3 of 6
mpasumarti
in reply to: shenx

@shenx, Thanks for your reply.

As I stated above I don't have a reference to the static picklist on any item, it's just a standalone list. Is it possible to access such standalone picklist from script?


Thanks,
Madhav
Message 4 of 6
shenx
in reply to: mpasumarti

as I know there is no script access to picklist manager currently. you have to create an item with the picklist and access it.

Message 5 of 6
tony.mandatori
in reply to: shenx

I don't think there is a way of doing this either.

 

You could make your script call API - /api/rest/v1/setups/picklists/{picklistId} to get the values, but this seems a little bit too much.  

 

I would rather create a hidden attribute that is attached to the picklist so that I can easily reference it.  

Message 6 of 6
mpasumarti
in reply to: tony.mandatori

I went ahead and implemented a function as mentioned below with static array to avoid jumping through hoops to get to what I need.

 

function isProprietaryItem(thisItem) {
      var proprietaryDocTypes = ["ALP", "BEP", "DSD", "FDS", "SFS", "FS", "HRS", "PDS", "RFS", "SPP", "SRS", "PDR", "REF", "DSD", "ERW", "PRN", "FDD", "SRS", "HDD", "DVT", "TRS", "TNS", "WCA", "MRD", "PBP", "MCD", "DTM", "PCM", "RTP", "FAP", "FAC", "QTP", "SIP"];

     

      var itemType = thisItem.ITEM_TYPE_PREFIX;

 

     if(itemType !== null) {
           var typeIndex = proprietaryDocTypes.indexOf(itemType);
           if (typeIndex !== null && typeIndex > -1) {
               return true;
           }
    }

 

    return false;
}

 


Thanks,
Madhav

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

Post to forums  

Autodesk Design & Make Report