Status Code: 422, The LocationRole being added is invalid.
Looking at Subscription A-S00000xxx, there's a temporary invoice, TMP-INV-00000xxx that we are trying to post, but when we do our Vertex callout it fails because the callout is supposed to pull Subscription Rate Plan Charge custom fields to generate the Vertex request. It's failing because the SRPC custom fields are empty, however in the UI they are populated!
The Invoice Items seem to be connected to Subscription Rate Plan Charges that are not in the UI. When I do an export on Invoice Item to get the related Rate Plan Charge data, I am not seeing any custom field data, even though the RPC in the export does indicate it's the latest version. When I go into the UI and I look at the Subscription, the Rate Plan Charge does have Custom fields populated, which is what we expect.
Doing an export of Rate Plan Charges related to the Subscription A-S00000xxx it returns 6 RPC, which is double what we'd expect. The Subscription has 1 charge and 3 versions.
Why are there these extra RPC objects related to the Invoice Item and Subscription? And why don't they have the RPC custom field data?
There were 2 separate issues here.
- Rate Plan Charge Data source is pulling 6 RPC records while in the UI, only one is there.
- Custom fields values in the Rate Plan Charge object are not populating in Invoice which is causing error when the empty values are passed to the Vertex app for tax calculation which are the mandatory fields for calculation.
Below is the explanation:
If a Subscription is amended, rate plan charge ID’s will change for each transaction. In this case, custom field is updated in both the amendments and that is how rate plan charge ID’s got multiplied and resulted in the Data source. To display only the latest values, please use “Is Last Segment” equals to “TRUE”.
Custom Field blank error in Invoice:
- First the Subscription was created without custom field values (Ship to country) with effective period as “July1, 2019 – July1,2020”.
- An amendment was created to update the custom field, where rate plan segments split into 2 as from “July1,2019 – July24,2019 & July24,2019 – July1,2020”, in which the later had the custom field value populated.
- An Invoice was generated with service period as “July1,2019 – July24,2019” & “July24,2019 – July1,2020”.
- Invoice was built over the “Non-Last Segment Charge” as well since service period is from July1,2019 which doesn’t have the custom field value populated.
- Invoice is posted and Now when both the invoice line items were attempting to reach Vertex app for Tax calculation, it caused the below error as the “Ship to Country” field value is mandatory. 1st invoice line item doesn’t have the custom field value.
The tax calculation call to Zuora Connect returned the following error: Status Code: 422, The LocationRole being added is invalid. This might be due to an invalid location or an invalid address field. Make sure that the locationRole is valid, and try again.
Background of this issue:
Splitting of charge segments while performing an amendment is an expected behavior when the Contract Effective Date is different for the amendments.
- The Subscription version 1 was created on July 24th with the Contract Effective date as "July 1, 2019".
- The same day, Version 2 got created with the Contract Effective date as "July 24, 2019" and some of the custom fields were updated.
Again, an amendment was done and version 3 was created on the same day with Contract Effective date as "July 24, 2019" and few custom fields were updated.
This Contract Effective date change while performing the amendment caused the Subscription effective dates to split into segments in which the Service period - "July 1, 2019 - July 1, 2020" is split into "July 1, 2019 - July 24, 2019" & "July 24, 2019 - July 1, 2020". Custom Fields will be at the Rate Plan Charge level and not the Rate Plan Charge Segment level. That’s why in the second version of subscription, the Rate Plan Charge segment 1 does not have any custom fields.
Since this behavior is by design, the Invoice Item doesn't have custom field values and thrown error when the Invoice is Posted. Same issue has been reproduced locally as well.
If you are trying to update the custom fields via amendments and so it should print on the Invoice.
- Best suggestion is to update the custom fields in the UI without performing an amendment. This is because of the segments being created while performing the amendments and it makes the custom fields not to be updated in the previous segments.
- Once the custom field is updated in UI, so when the Bill run is performed, the Invoice will be generated with the custom fields even though the Last segment is FALSE.
If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √