Skip to Content
Technical Articles
Author's profile photo Mariusz Jurcz

Implementing custom BADI in C4C in order to restrict list of “from” channel providers


This blog post provides guide how the list of “from” providers can be restricted.  This approach should help when couple of departments are present in one tenant and people from those departments should not use providers, which they don’t supposed to use it. C4C does not provide Code List Restriction or any adaptation changes options in order to restrict access to this content. However it’s possible to implement custom BADI in SAP Cloud Application Studio.

Email channels, SMS messages channels and social channels are supported.


In this example I will restrict “from” providers based on business role of currently logged user.

Steps for custom solution

  1. I created new solution and added new item of type Enhancement Implementation:


Adding new item in solution


2.The values should be chosen like in the screenshot below:


Parameters for BADI


The item with extension *.enht should appear in Solution Explorer. After extented this file, it has to have script with following name:



Here is example implementation of this script:

	Add your SAP Business ByDesign scripting language implementation for:
		Enhancement Option: RestrictFromAddress

		Script file signature
		Parameter: InputData of type SocialMediaActivityProviderRestrictFromBadiInput
		Returns: SocialMediaActivityProviderRestrictFromBadiOutput

	  - To use code completion, press CTRL+J.
import AP.FO.Activity.Global;
import AP.PC.IdentityManagement.Global;
import ABSL;

var result : SocialMediaActivityProviderRestrictFromBadiOutput;
var listOfAllowedProviders : SocialMediaActivityProviderRestrictFromBadiOutput.SocialMediaActivityProviderIDList;

var identityUUID = Context.GetCurrentIdentityUUID();
var roles = IdentityUtilities.GetAssignedBusinessRoles(identityUUID).BusinessRoles;

var query = SocialMediaActivityProvider.QueryByElements;
var praram = query.CreateSelectionParams();
praram.Add(query.ID.content, "I", "NE", "");
var elements = query.Execute(praram);

if(roles.Where(role => role.content == "Put your role ID here").Count() > 0){
var listOfProvidersNames = elements.Where(x=>(x.AccountName == "put your channel ID here" || x.AccountName == "put your channel ID here"));

foreach(var item in listOfProvidersNames){

	listOfAllowedProviders.SocialMediaActivityProviderID = item.ID.content;

	foreach(var item in elements){

	listOfAllowedProviders.SocialMediaActivityProviderID = item.ID.content;


return result;


In “Put your role ID here” and “put your channel ID here”, corresponding ID’s must be substituted with values presented in tenant.

Examples of working:

Before implementation:


Selection channel “from” before implementation

After implementation:


Selection channel “from” after implementation

Description of script

Basically script takes llist of roles from logged user. In the next step querry gets executed to get list of all channels by ID. Then there are lines of code, which assign channels to business role, so logged-in user can choose only providers based on script. If user don’t have role in “Put your role here”, the “else” part of script gets executed which grant access to all available channels.



I prepared simple steps on how restriction of “from” address can be done in very simple way. Obviously this is only proof of concept, every customer or partner may have other requirements. This code can improved and refactor, but I think it’s readable to get the idea.

It is worth to mention, that after activation of custom BADI in order to disable it, it has to be deleted. At least it works in that way in my tenant.

I hope, that this short blog post can help with development and customization in other C4C tenants.

Thank you for reading and please like and share this blog post.

If you have any question, don’t hesitate to comment.


Best regards,

Mariusz Jurcz

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Saurabh Kabra
      Saurabh Kabra

      Excellent example + use case Mariusz. Keep sharing!

      Author's profile photo Mariusz Jurcz
      Mariusz Jurcz
      Blog Post Author

      Thank you!

      Author's profile photo Sudhakar Boopathi
      Sudhakar Boopathi

      Hi @Mariusz Jurc,

      I have implemented this BADI to restrict list of "From Address" while responding to the ticket via Interaction center.

      I could hardcode the active channel and pass the same via ABSL script, but I need to have this dynamic based on few data in the Ticket object, I am unable to access "Ticket" object in this BADI. Can you please provide some input on how to proceed.

      Thanks in advance!

      Srikanth Rathod

      Author's profile photo Olivier Schietecat
      Olivier Schietecat


      FYI, if you hit the "E-Mail" creation button on a ticket with an inbound e-mail attached to it, it will set "From" to the channel found on the latest inbound e-mail. It will not pass through this BADI.

      That means this BADI cannot be used as an authorization check. Users will still be able to send from any channel if they have access to a ticket where it was used.

      Quote from SAP support (for version 2211):

      Our development team checked and explained that the default email address is populated based on the latest inbound email channel. The BADI is only applicable to filter the emails while selecting the channels from the pop up, not while defaulting the email.

      Kind regards,

      Author's profile photo Pratik Shekokar
      Pratik Shekokar

      Saurabh Kabra Mariusz Jurc,

      Hello Guys,

      In my scenario for the ticket Interaction, if multiple email channels are available, I wanted to "Default" i.e., auto-populate the X e-mail channel based on YZ condition.

      Is it possible? As I can see this BADI is to restrict the list of Email channels not to default the Email channel.

      Thanks & Regards,

      Pratik Shekokar

      Author's profile photo Pratik Shekokar
      Pratik Shekokar

      Hello Team,

      I have raised the same to SAP and below is the response,

      At this moment, there is only one BADI which controls the From, however it is only responsible for filtering the channels available in the "From" modal dialogue.

      Hope this will also help if someone has the same business requirement.

      Thank you,

      Pratik Shekokar