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: 18 PRO
edited March 31 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: 3,884
    edited March 31 Accepted Answer
    The ID is a text string so put it in quotes.
    Director, Technical Services, EMEAI
  • Alex_KempenAlex_Kempen Member Posts: 179 EDU
    edited April 1 Accepted 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" });
    Former Ovyl Intern
    Sophomore CS Student at UT Dallas
    [email protected]

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,884
    edited March 31 Accepted Answer
    The ID is a text string so put it in quotes.
    Director, Technical Services, EMEAI
  • john_allen289john_allen289 Member Posts: 18 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: 179 EDU
    edited April 1 Accepted 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" });
    Former Ovyl Intern
    Sophomore CS Student at UT Dallas
    [email protected]
  • john_allen289john_allen289 Member Posts: 18 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.