+1

API call to mark job as uninvoiceable

Sancho Leath 1 year ago in Home Portal / Smart Projects with CAT integration updated by Robrecht Belien 1 year ago 8

Does anyone know what API command to use to set a job as uninvoiceable (Smart Projects)? We are trying to set this Invoicing Term at the start of the step/job in question, which would be the trigger. Since we are not able to set this field in the global or process configuration of XTRF, we have to get an API call to take care of that, but so far I have not been able to find the right field/value in the API documentation that points to the property Invoiceable.

This is the macro that we use to set the invoicable field for provider invoice. This macro can be executed on Projects.

We explicitly set the invoiceable to false for the provider with ID 23, but it's up to you what to do with it.

#set($activityService = $utils.getService("com.radzisz.xtrf.service.ActivityService"))
#foreach($project in $list)
    #foreach($activity in $project.getActivities())
        #if($activity.getProvider().id == 23)
            Set uninvoicable for project $project.displayName for vendor $activity.getProvider().displayName
            $activity.setInvoiceable(false) 
            $activityService.update($activity)
        #end
    #end
#end

Hi Dennis,

This is interesting. Could you tell me what 'update' does in the last line? What additional action does it do compared to setInvoiceable(false)?

If I understand correctly, it updates the activity in the database. Otherwise it is only changed locally (in code).

Thank you very much for your reply. A few quick questions:

- Is this macro used with Classic or Smart Projects?

- Do you run this as a periodic job? If not, what is your trigger?

- You also did not find a way to run this as an API command? Macro is the only way to achieve this?

- Is this macro used with Classic or Smart Projects?
Smart Projects.


- Do you run this as a periodic job? If not, what is your trigger?
The trigger comes from our own Platform. This triggers the Macro by the Macro API.

- You also did not find a way to run this as an API command? Macro is the only way to achieve this?
True, I haven't found any API command to change this field.

+2

Thank you very much, Dennis. I hope I can return the favor one day.

On another note, let me know via IM whether you are interested in co-developing or crowd funding more complex API solutions, such as connecting PowerBI to XTRF. You seem to be one of the more active API/macro users of XTRF.

Hey Sancho,

If there is an initiative to look into connecting XTRF and PowerBI, I'd love to tag on as well. We're trying to get started with it, but find that we need a long workaround to get our data from XTRF into PowerBI. Anything that can help shorten that cycle is welcome :-)

Same Here Sancho and Thijs,

We are also using powerBI and are using some long workarounds to get the data directly.