Announcement

Collapse
No announcement yet.

Attempting to delete Opportunity Item results in 403 Access Denied errors.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Attempting to delete Opportunity Item results in 403 Access Denied errors.

    Hello everyone. I am hoping to get some insight on this issue we are having.

    Occasionally we will need to delete an opportunity, it's associated quote(s) and opportunity item(s). We are using the REST API to do this. Most all of this works fine, however we can not find a way to delete the associated opportunity item. Whether using the API or the Espo front end. Here is the API call and response:
    1. Request URL:
      http://espo/api/v1/OpportunityItem/614219e7d30745df1
    2. Request Method:
      DELETE
    3. Status Code:
      403 Forbidden
    Here is the associated Espo log entry:

    [2021-09-14 23:52:34] Espo.ERROR: API [DELETE]:/:controller/:id, Params:Array ( [controller] => OpportunityItem [id] => 6102dacfc32b08261 ) , InputData: - Opportunity Item can be deleted only within Opportunity
    record. [] []
    [2021-09-14 23:52:34] Espo.ERROR: Display Error: Opportunity Item can be deleted only within Opportunity record., Code: 403 URL: /api/v1/OpportunityItem/6102dacfc32b08261 [] []

    Referencing the error that they can only be deleted within the Opportunity, we cannot figure out how to do that either (API or front end). When we delete all of the other records, the opportunity item is effectively unlinked, but it's also an orphaned entry in the database.

    We are attempting this using the built in Admin account. Additionally, when looking at the roles, there is no Opportunity Item scope to give permissions to.
    Our Espo verion is 5.5.6

    Thanks for any help.

  • #2
    I am bumping this question to see if anyone has any ideas.

    Thank you.

    Comment


    • #3
      Hi, as you can see you cannot directly delete OpportunityItem via API - instead use DELETE /Opportunity and delete directly the parent opportunity. Btw I see u specified 'http' in endpoint URL, not sure if that's by mistake but it's always recommended to use https protocol on your espocrm host instance.

      Comment


      • #4
        I have no idea!

        My suggestion would be the rabbit hole, you can try to see how EspoCRM does it using browser F12 console and see if it can be done, if it can then perhaps you can build an API around that.

        Comment


        • #5
          Thank you for your replies.

          Alter, this does work, however when I look in the database directly, it seems to leave an orphaned opportunity item record which we would like to avoid if at all possible.

          espcrm, This is normally my method of figuring out API calls, but I can't even figure out how to do it from the front end! When using the drop down from Opportunity Item:
          Click image for larger version

Name:	EspoRemoveOpItem.png
Views:	341
Size:	23.6 KB
ID:	74893
          Gives me a 403 error:
          Click image for larger version

Name:	403Error.png
Views:	320
Size:	14.3 KB
ID:	74894

          When you go into the Opportunity itself, there is no option (as far as I can find) to remove it from there either. We have tried removing the item from the quote, deleting the quote, then deleting the opportunity, but it still seems to leave an orphaned Opportunity Item in the database itself.

          Thanks again.

          Comment


          • esforim
            esforim commented
            Editing a comment
            If you can't do it after trying like this then I be no help.

            I guess only Yuri would be able to help you then. But he don't want to be @ping and if he does come around it might be a "No you can't" then you be disappointed.
        Working...
        X