- Mark as New
- Bookmark
- Subscribe
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-04-2020
04:38 PM
08-04-2020
04:38 PM
Update Custom Field in Subscription from Salesforce via Apex callout
I'm trying to udpate one custom field via an apex call from Salesforce so that users don't have to go through the whole quote process to update a single custom text field. I am using the following code:
global class Z_UpdateSubCustomFieldsInvokable { @InvocableMethod global static void Z_UpdateSubscriptionCustomFieldsInvokable(List<Id> subscriptionIds){ System.debug(SubscriptionIds); updateZuoraSubscription(subscriptionIds); } @future(callout=true) public static void updateZuoraSubscription(List<Id> subscriptionIds){ List<Zuora__Subscription__c> Subscription = [SELECT Zuora__External_Id__c, PONumber__c FROM Zuora__Subscription__c where Zuora__External_Id__c IN :subscriptionIds]; for (Zuora__Subscription__c sub : subscription){ makeCallout(sub.Zuora__External_Id__c, sub.PONumber__c); } } public static void makeCallout(Id SubscriptionId, String PONumber){ Zuora.ZApi zApiInstance = new Zuora.ZApi(); zApiInstance.zlogin(); Zuora.zObject subscription = new Zuora.zObject('Subscription'); subscription.setValue('id', SubscriptionId); subscription.setValue('PONumber__c__c', PONumber); List<Zuora.zObject> objs = new List<Zuora.zObject> {subscription}; List<Zuora.zApi.SaveResult> results = zApiInstance.zupdate(objs); } }
but I get the following error upon execution. I did confirm the id in the error matches the zuora id for the subscription, is the error somewhere in my syntax?
16:25:46:028 FATAL_ERROR System.StringException: Invalid id: 2c92c0f8739445ac017397a8d30873fa
Labels: