Delete Hours Entries from Billing Records using API module | Community
Skip to main content
Level 9
September 18, 2023
Solved

Delete Hours Entries from Billing Records using API module

  • September 18, 2023
  • 1 reply
  • 1580 views

Hi Fusion Community,

 

I'd like to bulk remove/delete hours entries from a number of open billing records.  It looks like I would need to use the DELETE method via an API module in Fusion.  Is anyone willing to guide me through this?

 

Thanks!
Nick

 

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

I think you have to use the Custom API Call module (at least, that's how we do it).  Here's an example pipeline that gets to just the deletion portion.  Note that it's simply about setting the hours value to an empty array.

1 reply

Level 5
September 18, 2023

It's pretty straightforward.  You can either use the Delete module or the Custom API module with a method of DELETE and a URL of bill/{id}.  Just make sure the billing record first has no hours associated to it and it's not in "invoiced" status.  So you may need to do some updates to the record PRIOR to the deletion itself.

Router

--> Change status to uninvoiced

--> Remove association to any hours

--> Delete the object

 

The removal of association to hours is the trickiest part, but it's just a bill/{id} update call where you set the hours to an empty array / null.

NickVa7Author
Level 9
September 20, 2023

Thanks for this, cverges-medallia.
The part I'm uncertain on how to create is the last part, the removal of association to hours and setting the hours to an empty array/null.   Are you able to show a screenshot of how you would set up that module?

Level 5
September 21, 2023

Perfect, that worked!  Thanks, cverges-medallia.

My goal with this is to remove certain hour records from billing records so I can then make some user cost rate updates, and the costs for those hours I pulled out of the billing records calculates at the correct rate.

Once I make the user cost rate updates, I want to re-add the hour records I removed from the billing record and put them back in the billing records.  Do you know if the API method is best for that, and if so, are you able to provide some guidance again?


Sure, it's the same, just in reverse and using a POST/PUT (depending on whether you're creating or updating):

 

{ "hours": [ "123", "456", "789", ... ] }

 

where each of the entries in the array are the IDs of the hour object that you want associated to the billing record.