Skip to Content
Technical Articles
Author's profile photo Raviteja Satuluri

My adventure in learning Groovy Script for Cloud Integration (CI)– Part 7


Here I am just explaining the Importance of Groovy script in the Real time scenarios when we are dealing with Cloud Integration.

Groovy scripting is an integral and important feature of SAP Cloud Platform Integration (CPI). The goals of this repository are: Providing templates when you are implementing a new script. Easily finding Groovy functions related to the CPI topic at hand. Minimizing search engine time for common tasks.

Business Requirement: How to access Credentials from Script

Accessing credentials from a script:

The user/password configured in a deployed credential can be accessed programmatically from a script
with the help of the getUserCredential api of the SecureStoreService class

Classes needed:;;

Method signature:
public UserCredential getUserCredential(String alias)

Sample Code:
Get a handle to the SecureStoreService service:
def service = ITApiFactory.getApi(SecureStoreService.class, null);

Retrieve the target value using:
def credential = service.getUserCredential(“<Name of Credential that is deployed on
the tenant>”).

Finally retrieve the username and password from the credential object:
String userName = credential.getUsername();
String password = new String(credential.getPassword());


The below code will print the retrieved user and password to the message payload (body).



Conclusion –

Hope this document will help to beginners to understand CPI concept of Groovy Script. Happy Learning 🙂





Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jack Drilegna
      Jack Drilegna

      Hi Raviteja,


      Is it possible to retrieve JDBC credentials from JDBC Material in CPI by some way ?