Happy Business Starts Here

Partner

Getting INVALID_ID - invalid id for update When Trying to Update a Custom Field on Subscription

I am using Order Builder from SalesForce to update a custom field on the Subscription. Please see the code below and the log messages. I am getting the correct subscription ID - I verified this by viewing the subscription in Zuora with the same ID - yet, when I try the update with the same ID, I get the error. This update is done after the quote is sent to Z-Billing. The code below is from a Queueable class. 

 

zApiInstance.zlogin();
Zuora.zObject sub = new Zuora.zObject('Subscription');
sub.setValue('Id',this.zuoraSubId);
sub.setValue('CustomFieldName__c', this.hsSubId);
List<Zuora.zObject> objs = new List<Zuora.zObject> {sub};
List<Zuora.zApi.SaveResult> results = zApiInstance.zupdate(objs);
for (Zuora.zApi.SaveResult result : results) {
if (result.Success){
String updatedId = result.Id;
System.debug(LoggingLevel.INFO, 'Zuora Subscription Update successfull - ' + this.zuoraSubId);
} else {
Zuora.zObject[] errors = result.errors;
for (Zuora.zObject error : errors) {
String errorCode = (String)error.getValue('Code');
String message = (String)error.getValue('Message');
System.debug(LoggingLevel.ERROR, 'Zuora Subscription update failed: ' + this.zuoraSubId + ' - ' + errorCode + ' - ' + message);
}
}
}

 

And here is the log result:

23:12:14.0 (4900400)|USER_DEBUG|[12]|DEBUG|zuoraSubId: 2c92c0f853cf922f0153e98e31ce2791
23:12:14.0 (702283362)|USER_DEBUG|[32]|ERROR|Zuora Subscription update failed: 2c92c0f853cf922f0153e98e31ce2791 - INVALID_ID - invalid id for update

 

Any ideas??

 

Thanks.

 

2 REPLIES 2
Partner

Re: Getting INVALID_ID - invalid id for update When Trying to Update a Custom Field on Subscription

I will answer my own question Man Happy 

 

The issue was that my Z-360 sync settings - which are used by Order Builder - were wrong and did not match the Quote Config settings. When I updated the Z-360 settings, every thing worked fine.

 

Live and learn I guess.

 

- Marwan

 

Zuora Support Moderator

Re: Getting INVALID_ID - invalid id for update When Trying to Update a Custom Field on Subscription

Thanks for putting your resolution to your question!



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √