0

We have a Second Generation Managed Package which is live on AppExchange and we want to release a patch version with few changes. I have referred the Salesforce Documentation, still I have few doubts.

  1. Can we change the Label and API Name of a field of Custom Metadata?
  2. Can we change the Parameters and Return Type of an Aura Enabled Methods?
  3. Can we add new AuraEnabled Methods in Apex Class?
  4. Can we change labels of the Design Attributes of an Aura Component?
  5. Can we add new Design Attributes in an Aura Component?
  6. Can we change the target config properties of an LWC Component?
  7. Can we change the Labels of the Variables in Flows?
  8. Can we add new AuraEnabled Variables to the existing public inner class?
  9. Can we change the data (Field Values) of the Custom Metadata Record?
  10. Can we new public static variables to a public class?

Unable to create Patch Version: This is the error: UNKNOWN_EXCEPTION : UNKNOWN_EXCEPTION: Managed Package Patch Modification Exception: A change was made to the patch release that will change the visible behavior of the application: Component can't be created because it will be automatically included in the package.

Changes I have done:

  1. Changed the Parameters of AuraEnabled methods
  2. Added a new AuraEnabled variable to the inner class (wrapper class) which is used as return type of a Auraenabled method
  3. Added a public static variable to a public class
  4. Changed the Custom Metadata Type record whose fields are upgradable
  5. Added a lightning progress bar in an LWC Component Conditionally based on a variable (using if:true)

2 Answers 2

1

When using patch versions of 1GP and 2GP managed packages, there are significant limitations. However, the specifics are not well documented and this does lead to confusion. Over the years we have discovered the following.

Can we change the Label and API Name of a field of Custom Metadata?

You cannot change the API name of custom object/custom settings/custom metadata type fields, but you can change their labels, descriptions and inline help text (though the latter doesn't apply in an upgrade).

Can we change the Parameters and Return Type of an Aura Enabled Methods?

As long as the method and parameter classes are not global you can add and remove additional parameters or further @AuraEnabled attributes/properties in parameter classes.

Adding/removing/changing non-global methods/properties to existing top-level classes, and adding/removing/changing nested classes is permitted in a patch. That means you can "rename" methods - though note that a rename is actually a remove and add. This applies for plain and aura enabled methods and properties.

NOTE: You may, sometimes, find that the Salesforce platform doesn't quite handle "rename" scenarios in a single version - we have had some cases where we needed to keep the old method (empty) next to the new method, updating all usages of the old method to the new, then package the removal of the old method in a subsequent package version.

I am not sure about changing the return type, though I expect you can.

Can we add new AuraEnabled Methods in Apex Class?

Yes, as long as the new method is not global.

Can we change labels of the Design Attributes of an Aura Component?

Unknown since we don't use Aura (but I expect you can as long as the name remains the same).

Can we add new Design Attributes in an Aura Component?

No, on the assumption these work like target properties for LWCs.

Can we change the target config properties of an LWC Component?

No, except perhaps the labels.

This is a problem area even in major/minor releases.

We wanted to split the specification of target properties to vary them between flow and record page use of a component (since flow supports array input types), but just splitting the targets in a major/minor version was not possible.

Can we change the Labels of the Variables in Flows?

No. Flows cannot be changed at all in patches since this requires a new flow version and that's disallowed.

Can we add new AuraEnabled Variables to the existing public inner class?

Yes.

Can we change the data (field values) of the Custom Metadata Type Record?

It depends on the manageability of the field; if the field is "Upgradeable" (developer controlled) then yes, but if the field is "Subscriber editable" then no.

This applies to both protected and non-protected records and applies in patches and major/minor releases equally.

Can we add new public static variables to a public class and in a patch version?

Yes.

12
  • Thanks for the reply @Phil W, Can you explain this line a bit more "As long as the method and parameter classes are not global you can add and remove additional parameters or further AuraEnabled attributes/properties in parameter classes". Does this mean we can change the datatype and name of the parameters (variables) of AuraEnabled Methods and we can change the name of the AuraEnabled Method?
    – S1th
    Nov 23, 2023 at 9:00
  • @S1th see updated answer.
    – Phil W
    Nov 23, 2023 at 9:49
  • Thank you so much @Phil W, Got a lot of clarity regarding the changes we can make in patch version.
    – S1th
    Nov 23, 2023 at 10:20
  • Hi @Phil W, Can we change the data (field values) of the Custom Metadata Type Record and can we add new public static variables to a public class and in a patch version?
    – S1th
    Nov 30, 2023 at 12:12
  • See updated answer.
    – Phil W
    Nov 30, 2023 at 12:40
1

As mentioned in the documentation:

  • You cannot change the label and API name of a field of custom metadata in a patch version. This is considered a major change that requires a new package version.
  • You cannot change the parameters and return type of an aura enabled method in a patch version. This is also a major change that affects the API and dynamic Apex access controls.
  • You can add new aura enabled methods in an Apex class in a patch version, as long as they are not global or virtual. However, you should be careful not to introduce any breaking changes or dependencies with the new methods.
  • You can change the labels of the design attributes of an aura component in a patch version, as long as they are not global. This is considered a minor change that does not affect the functionality of the component.
  • You cannot add new design attributes in an aura component in a patch version. This is considered a major change that requires a new package version.
  • You can change the target config properties of an LWC component in a patch version, as long as they are not global. This is considered a minor change that does not affect the functionality of the component.
  • You can change the labels of the variables in flows in a patch version, as long as they are not global. This is considered a minor change that does not affect the functionality of the flow.

I hope this helps you to understand the limitations and possibilities of patch versions for second-generation managed packages.

7
  • Thanks for the reply @Tushar Jadav, For AuraEnabled Method we have wrapped all the data in an public inner class with AuraEnabled Variables, can we add a new variable to that class and can we change the names of the parameters (variables) of an AuraEnabled class with same datatype?
    – S1th
    Nov 23, 2023 at 7:01
  • You cannot add a new variable to an inner class that is used as a parameter or return value for an AuraEnabled method in a patch version. You can change the names of the parameters (variables) of an AuraEnabled class with the same data type in a patch version, as long as they are not global. This is considered a minor change that does not affect the functionality of the class. Nov 23, 2023 at 7:12
  • Thanks for the reply @Tushar Jadav, Can you explain this line a bit more "You can change the names of the parameters (variables) of an AuraEnabled class with the same data type in a patch version, as long as they are not global." Does it mean we can change the names of the AuraEnabled Variables of an inner class?
    – S1th
    Nov 23, 2023 at 7:16
  • It means that you can change the names of the variables that are used as parameters or return values for an AuraEnabled method in a patch version, as long as they have the same data type and they are not global. Nov 23, 2023 at 7:21
  • 1
    Thank you so much @Tushar Jadav, Got clarity regarding the changes we can make.
    – S1th
    Nov 23, 2023 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .