Salesforce has blocked this package upgrade because the new package version - salesforce

Actually, we have deleted some components from the package and when we are installing it in the client’s org, it is giving us following error:
“Salesforce has blocked this package upgrade because the new package version removes some Apex code that one or more Visualforce pages or global Visualforce components need in order to function. Please contact your partner with this error information. Provide these component names to your partner. Visualforce Pages: abc.vf.”
i posted on salesforce support but got not make sense reponde

You've failed to complete the two-stage process for removing public Apex or Visualforce:
Because the managed package components behavior differs from the behavior of public Apex classes and public Visualforce components, use a two-stage process to delete Visualforce pages, global Visualforce components, and global Lightning components from a managed package. When you upgrade a package in a subscriber org, the Visualforce pages, global Visualforce components, or Lightning components that you deleted aren't removed. Although a Delete button or link is available to org administrators, many orgs continue using obsolete pages and components. However, public Apex classes and public Visualforce components are deleted as part of the upgrade process. If you delete pages and components without performing this two-stage procedure, Salesforce can’t warn you when later deletions of public classes and components break your subscribers’ obsolete pages and components
Emphasis mine. The error message is confusingly phrased; what most likely happened is you deleted some public Visualforce that referenced public Apex without executing the two-stage process described in the above link.
You'll have to create a patch version from the previous version of your package (before the deletion) to resolve this. In the patch version, blank out the content of the Visualforce page(s) or component(s) you deleted, specifically removing all references to Apex controllers. Upload the patch version. Then, you should be able to upgrade subscriber orgs from the previous version to the patch version and finally to your new version, where the Visualforce is completely removed.

Related

How to use a custom github action from another repository in my organization?

I'm following the examples of a docker Github action to create my own action. I would like to keep the action in a private repository in my organization, and then re-use it from another repositories under the same organization.
The documentation states that "When an action is in a private repository, the action can only be used in workflows in the same repository" but, to my understanding, it doesn't cover how such actions behave in organization context - only in standalone repo context. Do I have to make it public and on the marketplace, just to be able to re-use it in my own private organization?
Does anyone have any experience setting up such an action?
I have recently published a custom action to GitHub marketplace,
You have two options:
Publish your custom GitHub action to the marketplace and then use it with any repository wherever you like however this will require you to make your code public
Second option is to copy all the contents of the GitHub action you created (entrypoint.sh, dockerfile and action.yml) to the repository where you want to use it and simply use it like this:
uses: ./
Do let me know if this solves your problem, thanks
Github has introduced a new repository sharing option, called internal.
With internal repositories it is possible to share actions across repositories.
Please note that only some types of organizational accounts are entitled to this visibility option.
https://dev.to/n3wt0n/finally-custom-github-actions-in-internal-repos-4l91
Expanding on #MujtabaMehdi's answer: the copying can actually be done as part of the action itself:
-
uses: actions/checkout#v3
with:
repository: your-org/your-action
path: your-action
-
uses: ./your-action
(This pollutes the current folder. I originally tried to checkout the action to /tmp/your-action, but uses only takes paths that start with ./. You could still put it in the parent directory with ./../your-action, but checkout also doesn't want to write anything there -.-.)

Gatsby add dynamic page on client side

I'm using a Gatsby setup hosted on Netlify.
I'm building some sort of recipe website where users can register, login and add recipes to their own cookbook page. To add a new recipe a user can fill in a form with some data (like recipe name, ingredients etc.). On submit the data will be stored inside a database. I then also want a dynamic page to be created for that specific recipe. (This is where you come in).
I know I can add pages via the gatsby-node.js file but I would prefer if this page can be added on the client side and exists instantly after the form submit without rebuilding the project. Is this possible in Gatsby and if so... how?
If this is not possible my best option would be calling the Netlify webhook to rebuild the project after the form submit and simply wait for the build to be completed before I can show the recipe detail page? Any thoughts on this?
Hope one of you coders can help me out here!
The way I would approach this is first show a dynamic version of the new recipe page (directly after submitting), which will only be visible to the authenticated user (based on its user ID and post ID). Maybe make this clear for the author with a note on that page. Something like: "This is a preview. Your recipe is being cooked up right now and will be ready in a few minutes."
At the same time, an incremental build would be triggered using a webhook from the backend. Both gatsby cloud and netlify support this now, so theoretically the build should be fast.
Triggering the webhook depends on your backend solution which you didn't mention. But when using for example Drupal you can use the build_hooks module. This can be configured to trigger a build when a recipe is posted back to Drupal.
I'm sure there would be a number of technical challenges but I think it should be possible. The trick would be not to generate too many dependencies in your new content, so the incremental build stays as small as possible.
Okay so I figured out there isn't a way in Gatsby to create the page directly in the client side. I decided to go with Albert's idea of first showing a dynamic page including a message saying this is a temporary page and the real recipe is "being cooked up".
On form submit I also just simply call the webhook to trigger Netlify deploy. This triggers a new deploy and in the gatsby-node.js I will create the new page based on the data I saved in my database on the form submit.

How to determine (with Salesforce API) in which component a custom field is referenced?

I am new to Salesforce and trying to figure out a way to determine all the components such as ApexPages, ApexClasses, Triggers etc. in which a custom field is referenced.
Is there any API available for this ?
Can metadata API fetch such references of a custom field/object in all components ?
There isn't an elegant way of doing this.
If you have a sandbox, you can attempt to delete the field. If it's referenced in other parts of your org, it will usually not allow you to delete the field and I believe it also gives you a link to where it is referenced. This isn't a complete solution, however, because if you have a field referenced in Javascipt in a VF page or as a field in a dynamic SOQL query (ie. Database.query('Select Id, Custom_Field__c from Account'), Salesforce won't be able to detect that the field is referenced.
A more complete solution requires more effort. I suggest using the Eclipse Plugin or the Ant Migration Tool to download all of your items (Pages, Classes, Triggers) locally. Then you can perform a simple search/find across the text files to find reference to your file.
Finally, a newer option that is probably even easier is to use the Developer Console. It has recently gained the ability to 'Search in Files.' You can open it from inside Developer Console under the 'File' menu option.

How to access Salesforce managed site pages without writing the namespace prefix?

We're working on a Salesforce managed package that contains visualforce pages that are to be published on a Salesforce site.
When testing, we can access those pages at http://example.force.com/pagename
But when installing the managed package on a testing org, we can only access those pages is prepending the package namespace, http://example.force.com/namespace__pagename
How can I make the pages accessible at /pagename even when accessing from a managed package instalation?
A URL rewriter might possibly work but I'm pretty sure you'll find no way around this — the point of the namespaces is to prevent naming conflicts between packages, being able to remove it from the page URL would mean there's nothing to stop your package from conflicting with other packages or custom VF pages in the orgs the package is installed on.

Is there a way a method can be triggered or run during a salesforce package installation process?

I would want to do this to run post installation setup process like adding custom data that is required for the application to run.
One option I am aware of is to Write Installation and Setup instructions for users. Create visualforce page and include a button on this page. Redirect user to this page as the process of Installation and ask the user to click the button.
I only wanted to know If there was a more elegant way to solve the problem and if there is a way to call a method during the installation process.
Salesforce has recently implemented the ability to execute scripts (as Apex) during package Install / Uninstall:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_install_handler.htm
No, we can't have a post installation script for the app. What you are saying is best solution, just keep a custom setting to flag, if initial setup is not done, then redirect to the setup page first, other wise do the normal work.
My question would be revolving around why you need custom data for the app to run? One of the things Salesforce look for when doing a security review of your code and the unit tests you have is to check to see if you are requiring data in your org as this is bad practice. Note that if your app is requiring specific data to run then it cannot be tested properly as the data will not be in the org when running the tests on install.
What is the data you are requiring? Could it be stored in an xml like static resource file or something similar for you to load and parse as it is needed?
Paul

Resources