Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Using the custompropertyID to show custom property in a custom table

john_allen289john_allen289 Member Posts: 38 PRO
edited March 2021 in FeatureScript
Can someone show me the correct syntax to use the customPropertyID with PropertyType.CUSTOM?

I just can't get it to work for some reason (mostly because I have almost no idea what I'm doing with FS!), but trying hard to learn.....

var custom1 = getProperty(context, { "entity" : part, "propertyType" : PropertyType.CUSTOM, "custompropertyID" : 5f15b2e90eb1e3150e07046f } );

Best Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,690
    edited March 2021 Answer ✓
    The ID is a text string so put it in quotes.
    Senior Director, Technical Services, EMEAI
  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    edited April 2021 Answer ✓
    It looks like one issue you may have been having is that you've misspelled customPropertyId. Keys are string arguments, so enclosing them in quotation marks is fine (unless you want to use a variable defined elsewhere as a key). Thus, your line of code should actually look something like the following:
    var custom1 = getProperty(context, { "entity" : part, "propertyType" : PropertyType.CUSTOM, "customPropertyId" : "5f15b2e90eb1e3150e07046f" });
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,690
    edited March 2021 Answer ✓
    The ID is a text string so put it in quotes.
    Senior Director, Technical Services, EMEAI
  • john_allen289john_allen289 Member Posts: 38 PRO
    Thanks Neil for the punchy response, seem so simple and I had tried that, but was getting a missing SEMI error, looks like I had also mistakenly put the phrase customPropertyID in quotes which wasn't helping, seems be working now! Thanks.





  • Alex_KempenAlex_Kempen Member Posts: 248 EDU
    edited April 2021 Answer ✓
    It looks like one issue you may have been having is that you've misspelled customPropertyId. Keys are string arguments, so enclosing them in quotation marks is fine (unless you want to use a variable defined elsewhere as a key). Thus, your line of code should actually look something like the following:
    var custom1 = getProperty(context, { "entity" : part, "propertyType" : PropertyType.CUSTOM, "customPropertyId" : "5f15b2e90eb1e3150e07046f" });
    CS Student at UT Dallas
    Alex.Kempen@utdallas.edu
    Check out my FeatureScripts here:



  • john_allen289john_allen289 Member Posts: 38 PRO
    Ah, I see, typo and quote marks on both the Key and the string is fine. This is my first conscious use of Keys so thanks for that. Face palm on the typo’s, I know many will roll their eye at this...But I know I will learn faster if I air my failings on here. Thanks for the help Alex.
Sign In or Register to comment.