Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
vishaldubey
Advisor
Advisor
Introduction

In this blog post, you will learn how to store and read local credential variables from the local machine (not cloud factory) and thus make the user-specific automation scripts with the SAP Intelligent RPA Desktop Studio (aka SAP iRPA).

Purpose

This approach gives the flexibility to work with specific users. This use case is suitable when there is a requirement that all users will use their own credentials. In this case, no need to create a cloud credential variable based on the number of users.

Product

SAP Intelligent RPA 1.0 version used: Desktop Studio 2.0.10.58

Steps in action

1. Credential creation in local machine

1.1. Accessing Credential Manager - Windows 10

Credential Manager lets you view and delete your saved credentials for signing in to websites, connected applications, and networks.




  1. To open Credential Manager, type credential manager in the search box on the taskbar and select Credential Manager Control panel.

  2. Select Web Credentials or Windows Credentials to access the credentials you want to manage. Add a generic credential as below:


  3. Added "myLocalCredentials"




2. Workflow creation

2.1. Declaration credential variable

NOTE: Here, it is used in step but can also be kept outside. For more information, please have a look at the blog post.


2.2. Get credential value


2.3. Build the project and check the generated code. I added code to display the username and password.
// ----------------------------------------------------------------
// Step: Declare_credential
// ----------------------------------------------------------------
GLOBAL.step({ Declare_credential: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('localCredentials', 'e27c531a-c14a-4286-b156-fc31e7d81b66') ;
// Declares a credential

ctx.cryptography.credential({ myLocalCredentials: {
comment: "My credential",
server: false
}});
sc.endStep(); // Get_credential
return;
}});

// ----------------------------------------------------------------
// Step: Get_credential
// ----------------------------------------------------------------
GLOBAL.step({ Get_credential: function(ev, sc, st) {
var rootData = sc.data;
ctx.workflow('localCredentials', '23a62cb5-6924-45d0-9e1f-8d017ce5ebf9') ;
// Retrieves credential login and password

ctx.cryptography.credentials.myLocalCredentials.get(function(code, label, credential) {
if (code == e.error.OK) {
// get values for credential
rootData.username = credential.userName.get();
rootData.password = credential.password.get();
ctx.log("Username: " + rootData.username);
ctx.log("Password: " + rootData.password);
}
});
}});

Output:


Conclusion

Now you should be able to store and read the credentials from the local machine and thus make the user-specific automation scripts for your SAP iRPA 1.0 project. Happy Learning!!!