Skip to Content

Hi,

This is Chandra Gajula who’s working in Mindtree Ltd., Bangalore.

This blog will help you to convert a custom UI field value into Base64(encode/decode) format to make it not obvious to the unauthorized users. 

“The requirement is for a user to be able to press a URL which will take them to the report in ECC for all prices maintained against that account in ECC.

The external ID is known to the user and is visible on the UI. We are passing the encoded ID so that users can’t manipulate the URL and so they can’t see data that they shouldn’t have access to.”

 As account number is visible in the URL, it will be encoded via SDK logic to make it not obvious to the user so they can’t easily manipulate the account number to access data for accounts they don’t have access to.

This report will run whenever a sales rep clicks on the URL mashup. The SDK logic will run whenever an account is created manually, or uploaded via the migration tool or from ECC.

Authorization is controlled by access to the account in C4C. The Encoded ID field which holds the encoded C4C Account ID will be hidden on the UI.

a custom field “Encoded ID” (New Account UI & Header UI) in Account -> Customer (Standard UI) is created at tenant level in C4C.

Step -1: Import custom field “Encoded ID” to SDK by using “.ref” object creation. that will import the list of custom fields added in C4C tenant. Here then you can choose your relevant custom field by ticking check box against it.

If .ref object is already exist in your solution, then simple open it, save and activate. Just close that object and re-open it. You can see the custom field that added in C4C tenant.

Step – 2: Create Extended Business Object (.xbo) in your solution. No need to add any elements or changes in extended business object until explicit needs. As per this requirement, there is no need to do any changes in it.

Hint: only one extended Business object (.xbo) will allow to add in your location for each standard business object. That can be used for all your enhancements for that particular standard object. Ex: if you added Customer extended Business Object (.xbo) that can be used for all your customer related enhancements.

Step – 3: Create script file – Root -> “Event-BeforeSave.ABSL” to extended BO and then add the below logic for Base64 conversion.

Below link will help you to check the value of base64.

https://www.base64decode.org/

import ABSL;
import AP.FO.BusinessPartner.Global;
import AP.Common.GDT;
import CommunicationServicesManagement.Global;
import AP.FO.ProductDataMaintenance.Global;

if (this.Common.GetFirst().EncodedID.IsInitial())
{
	var encodedID = this.GetFirst().InternalID;
	var multiplyBy3 = Numeric.ParseFromString(encodedID) * some numeric value(s);
	var convertToStr = multiplyBy3.ToString();
	var convertToBinary = Binary.ParseFromString(convertToStr);
	var base64ID = Binary.ToBase64String(convertToBinary);
	this.Common.GetFirst().EncodedID = base64ID;
}

Thanks

Chandra Gajula

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply