Creating new invoice using Erp.BO.APInvoiceSvc/APInvoices results in locked group for other users

This question applies to Epicor SaaS MT 10.2.x

I have built a custom shipping/logistics solution for my client. Part of our process is to create AP invoices via the Epicor API to pay our third party carriers.

When I push a set of invoices to Epicor via the REST API (Erp.BO.APInvoiceSvc/APInvoices) I am able successfully create all invoices and lines using a new AP invoice group that we specify. However, once that step is complete, the service account we are using keeps the AP invoice group locked where no other users can access the group and therefore they cannot post and pay these invoices in the client.

Error: “The Group is in use by 99927-IService and may not be selected.”

The only way I have found to clear this lock is to go into the Epicor client with that service account user ID, open the group and then perform the File/Exit routine to clear the session lock. It appears the lock does not clear on its own for a very long time (72 hours?)
.

Please tell me there is a way to unlock this in a programmatic way or avoid the lock altogether when we are posting the invoices. While we only run invoicing twice a month, it is super inconvenient to have to go do this manual step.

There is a method for that in the APInvGrpSvc rest endpoint, called UnlockGroup.

1 Like

Is there some documentation on the POST body structure for that or the parameters if it is a GET? The SWAGGER description for that BO says nothing about an UnlockGroup method.

By poking around I discovered that it is pretty straight forward. Putting the answer in here for those who run across this need in the future.

POST /api/v1/Erp.BO.APInvGrpSvc/UnlockGroup

Body
{
“InGroupID”: “GroupID”
}

You can see the signature also by switching to the custom method list for any BO in the swagger. There should be a link on the top right of the page.
Glad you found what you needed.

2 Likes

Does anyone know if this will work if the users are closing Epicor altogether without exiting out of the Invoice Entry screen first?

Yes, it will. I remember us having the same issue when we were on 10.1.400 and 10.1.600.
Back then I made a dashboard that called the unlock group method that some power users could use when that happened.

1 Like

A post was split to a new topic: APInvoiceSvc in REST

Thanks for this tip Joseph! For anyone using the new Swagger UI, the trick is to press on RPC on the left side or you can switch to the old help page and then change OData to Custom methods in the top right.