Forum Stats

  • 3,770,167 Users
  • 2,253,079 Discussions
  • 7,875,357 Comments

Discussions

Dynamic URL Endpoint configuration in web source module

steddy21
steddy21 Member Posts: 22 Blue Ribbon
edited Jul 30, 2021 9:53PM in APEX Discussions

When implementing the web source modules using the apex I ran into difficulty in configuring the URL_ENDPOINT to be dynamic based on environment. 

Here is how I did, 

Step 1: Created a remote server in the work space utilities it is like if I create a module using the remote server where I provided Static Identifier as: Sales, Base URL: www.google.dev.sales.com (just as example), Prompt On Install: On (switch to on)

Step2: Created a web source module in the shared components of application in that work space by selecting Sales in the Remote Server select list.

Step3: Provided headers which are dynamic based on page Item Value(No Auth Required)

Step4: Got the response (happy so far)

Question:

When I move this code to test I want the Base URL in remote serve be like: www.google.test.sales.com, and for uat: www.google.uat.sales.com, for prod: www.google.prod.sales.com and so on.

The only way I found to make it possible is after I export the app from dev work space, manually edit the sql file and manually change the values in there, so every environment I promote I have to do this and which is not correct since I need to check in the file to a version control tool so that app code is same across all environments ideally.

Other way do the web service call programmatically either on apex page or create a database package and call that on the page, manually parse the json, etc. Either of these options take away the APEX functionality of low code.

I created an Application Item (set scope to be Global) and computation on it to select the value from a table where I stored the URLs but unable to pass that as a parameter in the URL section of remote server, this also did not work.

How do I make the APEX select url based on environment from a table?


Apex Version I am using: 19.2.00.18 (I tried Version 20.1 and it is the same case).

Thanks,

Sree