+ Start a Discussion

how to deactivate price book via API


I'm trying to create a new deactivated price book via API calls. I was able to create a new pricebook when I do not use the setIsActive() method. When I use the setIsActive() method to create a deactived pricebook, I get the following message:

bad field names on insert/update call: IsActive

So I tried creating a price book in which I specify true instead of false for setIsActive() method, but it still give the same message. I also tried creating a new standard pricebook and try to update the price book. This also fail.

Is there a way to create a new deactivated pricebook? Any help would be greatly appreciated,


Here is a sniplet of my code:

SObject[] objs = new SObject[1];
Pricebook pb = new Pricebook();
SaveResult[] saveResults = null;
try {
saveResults = binding.create(objs);
} catch (UnexpectedErrorFault uef) {
System.out.println("UEF Exception: "+uef.getExceptionMessage() + "\n\n");
return emptyID;
} catch (Exception e) {
return emptyID;