Updating Custom Expressions in Custom Forms via API | Community
Skip to main content
February 24, 2025
Question

Updating Custom Expressions in Custom Forms via API

  • February 24, 2025
  • 2 replies
  • 504 views

Hey all,

I'm trying to update customExpression values (those calculation fields in Calculated form for Custom Forms) through the API. Looks like I can't update CTGPEX directly.

Is going through the Category object the only option? Seems a bit much to update all CategoryParameters when I only need to change a few customExpression values. Plus, I haven't even had luck with that approach.

Any ideas on how to directly update those customExpression fields?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

LToledoAuthor
February 24, 2025

For anyone facing a similar challenge, here's how I managed to update customExpression values --

It turns out you do need to update the Category object, and unfortunately, it requires including all CategoryParameters, even those without custom expressions. I haven't found a more efficient method yet.

Here's the general approach that worked for me:

 

PUT https://{workfront}.{instance}.workfront.com/attask/api/v19.0/CTGY/{category_id} { "categoryParameters": [ { "ID": f"{category_param1.categoryID}_{category_param1.parameterID}", "customExpression": custom_expression }, { "ID": f"{category_param2.categoryID}_{category_param2.parameterID}", "customExpression": custom_expression }, ] }

 

skyehansen
Community Advisor
February 25, 2025

Have you ruled out going through the ctgypa itself? It's the end of my day but I'm happy to look into ctgypa tomorrow if you haven't ruled it out -- just tell me what issues you're having with it so I don't have to replicate all your errors.

LToledoAuthor
February 25, 2025

I believe did try updating through the CTGYPA object before, but I might have missed something. I'd really appreciate it if you could take a look tomorrow and see if you can get it working. Thanks!

skyehansen
Community Advisor
February 25, 2025

I'm getting a "must specify an ID to edit" error, and none of the ID fields seem to be acceptable (tried category ID and parameter ID). Is this what you ran into as well?

 

I'd like to have found a way to link down to the CTGPEX ID itself similar to what you did above (cat ID + parameter ID + category parameter expression ID) but it's not gelling (and may well be going down the wrong path)