I'm developing the salesforce app using salesforce LWC components, I have requirement where I should process the salesforce data from an external system, for this I'm sending the data to the external api, say 'https://myapi.com/contact', but when I render the app, I'm getting an error as unauthorized access, so I setup my api url in the remote site settings, since my app will be downloaded and used by any salesforce user, It's not possible to set this manually, is there a way I can set the remote site settings programmatically when my app is installed or is there any other way I can solve this without any user intervention
1 Answer
How are you distributing your app? Can't you just add the remote site to your managed package?
If not - you could add some "setup guide" VF page (lwc won't work because it doesn't generate api-enabled session IDs) and do a trick similar to https://andyinthecloud.com/2014/07/29/post-install-apex-metadata-api-configuration-solved/
2 Comments
R_M_R
Thanks for the answer, I will be pushing the app to salesforce AppExchange, may I know how can I add the remote site within my package, I found from the docs, I have to set remote site from the salesforce application.
eyescream
Sign up for your own free Salesforce Developer Edition (has most "toys", features but limited storage space), that's the only way to create a managed package. Have you seen developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/… ?