Delete Supplier price list using BO Method VendPart.DeleteByID

Hello,

Has anybody tried to delete the Supplier pricelist using the BO method? I am trying it in App studio using the calling function to delete but it is giving me Error Code 500. It is even the same when I tried it using BPM and calling the same BO Method.

image

Instead of using DeleteByID, you could try setting the RowMod to “D” and then calling Update.

I am trying to use Epicor functions. Do you have any reference code for that?

Same way you called DeleteByID. Just call Update instead after setting the RowMod value in your tableset.

Something akin to this:

this.CallService<Erp.Contracts.VendPart>( vpBO = >
{
    Erp.Tablesets.VendPartTableset vpTS = vpBO.GetByID(yourKey);

    vpTS.VendPart[0].RowMod = "D"; // Your index may not be zero. Find your own.

    vpBO.Update(ref vpTS); 
});

Modify as needed; I did not test the syntax or viability.

Thanks, Hannah. It is still giving me the same error. But in your code comments, you are saying to find your own Index. How would I find that?

Depends on if there’s multiple pricelists in the GetByID. If that’s true, you would need to iterate through them all to find the right one based on your criteria.

If you’re getting the same error, you should still go to the server’s Event Viewer to see the specific error.
It’s possible it’s not letting you delete it because it’s being used somewhere.

Thanks, Hannah. Unfortunately, I don’t have access to the server and I tried creating a fresh new pricelist and still no luck :frowning:
same error

Hello Hannah,

Seems I am able to achieve it. Just a little modification in the code but overall it is the same as you suggested. thanks again! :slight_smile:

1 Like