Post

2 followers Follow
0
Avatar

Referencing a Project in a Custom Action

Just throwing this question out here to see if anyone has had a similar experience.

 

I am calling a custom action on a Project using the REST API which creates a task/work item. My call executes fine and shows the "Success" dialogue but the task never appears as a child under the Project. Searching for the task in the system also yields no results.

 

I've tried adding a "Parent" field to link the task to the project in my JSON body but get an error "InvalidArgument" and can't send the request.

 

My JSON has a format like this:

ENDPOINT: https://api.clarizentb.com/v2.0/services/data/executeCustomAction

{
    "targetId": "/Project/xxxxxxx",
    "customAction": "Quote - New Work Items",
    "values": [
       {
            "fieldName": "LineItemType",
            "value": "/Services"
        },
        {
            "fieldName": "Description",
            "value": "A normal description"
        },
        {
            "fieldName": "Hours",
            "value": "10h"
        },
        {
            "fieldName": "Parent",
            "value": "/Project/xxxxxxx"
        }
    ]
}
 
The "x's" are the Project's External ID. The custom action works when I trigger it from the UI and the $Parent is set to CurrentObject() but I can't seem to figure out what value the function passes.
 
Any help would be appreciated!
 
J
Jlau Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hello J,

If you set the targetId to the relevant project when making the API call, then the custom action should be able to access that project via CurrentObject() function. 

I hope this helps.

Roland

Roland Pumputis 0 votes
Comment actions Permalink