Expand my Community achievements bar.

Updating Custom Expressions in Custom Forms via API

Avatar

Level 1

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!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Level 1

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
        },
    ]
}

 

Avatar

Community Advisor

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.

Avatar

Level 1

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!

Avatar

Community Advisor

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)