CX Sales & B2B Service - Generate Dynamic URL based on Pod in Groovy

Hi,

In this post, I am going to discuss how to generate the dynamic URL in groovy based on Pod. You may ask why we need this. One main reason is to avoid code change in groovy after CSM migration. 

For example, we have a mashup with the following URLs, and we create mashup with groovy expression.

For DEV Pod, the mashup URL is https://my-url-123

For TEST Pod, the mashup URL is https://my-url-456

For PROD Pod, the mashup URL is https://my-url-789


If we hard code URL in the groovy like below on Dev Pod, we need to update the groovy after we perform CSM from DEV to TEST and TEST to PROD.

def url = 'https://my-url-123';

return url;


To address this issue, we can add the additional logic to generate dynamic URL based on Pod like below,

def url = oracle.topologyManager.client.deployedInfo.DeployedInfoProvider.getEndPoint('ORA_CRM_UIAPP');

def dev = 'https://my-url-123'

def test = 'https://my-url-456'

def prod = 'https://my-url-789'

if(url == 'https://devpod.oraclecloud.com:443'){

return dev;

}

else if(url == 'https://testpod.oraclecloud.com:443'){

return test ;

}

else if(url == 'https://prodpod.oraclecloud.com:443'){

return prod;

}

With the above groovy code, there is no need to update groovy then publish Sandbox after CSM.


Note - you can also check MOS doc (Doc ID 2291413.1) about How To Get The Pod URL via groovy.


Hope this is helpful!

Adam Liu


Comments

Popular posts from this blog