Error when calling RUF from Java step in Activity — "<<Library_Name>> cannot be resolved" | Pega 24.2.1

Hi Team,

I’m following the guide: https://docs.pega.com/bundle/platform/page/platform/data-integration/integrating-sharepoint-online-with-pega-platform-using-azure-active-directory.html

I am using Pega Platform version: Pega Infinity 24.2.1

Issue:

In the activity Java step (Step 7), I am trying to call my RUF like this:

My Library Rule: SP_Library
My Function: SP_Funtion(String, String, String, String, String, String)

I have verified my Library rule exists. Also, saved and generated the Library (Click on “Generate Library”) and cleaned and recompiled the activity.

Is there any additional configuration needed to make the generated Java class available in Pega 24.2.1?

Is there a new recommended way to call RUFs in Java steps in Pega 24.2+ versions?

Am I missing anything specific in this SharePoint integration approach?

TIA

@MaleeshaW :warning: This is a GenAI-powered tool. All generated answers require validation against the provided references.

Below some suggestions that should help resolve the “cannot be resolved” error you’re encountering.

Library Reference Syntax

When calling a RUF from a Java step, the correct syntax should be:

ruleset_name.library_name.function_name(parameters);

In your case, for the SP_Library and SP_Function, you would need to ensure you’re using the correct ruleset name prefix. For example, if your library is in a ruleset called “SharePointInt”, the call would look like:

sharepoint_int_sp_library.SP_Funtion(clientId, tenantId, scope, keyStoreName, authProfileName, "");

Note that the ruleset and library names are converted to lowercase with underscores in Java.

Additional Configuration Requirements

Based on your description, here are some additional configurations to check:

  1. Verify Library Configuration:
    • Ensure the “Library ready to be compiled” checkbox is selected in your library rule
    • Check that you’ve included all necessary Java packages in the “Java packages to Include” section:
    • o ``java.io.*
    • o ``java.security.*
    • o ``java.util.*
    • Any other packages required for SharePoint integration
  2. Regenerate the Library:
    • After making any changes to the library configuration, click “Save” and then “Generate Library” again
    • Restart your application server to ensure the newly generated library is loaded
  3. Check Function Parameters:
    • Ensure the parameters in your Java step match exactly (in number, order, and type) with those defined in your RUF
  4. Verify Ruleset Visibility:
    • Make sure the ruleset containing your library is included in your application’s ruleset list
    • Check that the ruleset version is correct and accessible

SharePoint Integration Specifics

For SharePoint integration with Azure AD in Pega 24.2.1, here are some specific items to verify:

  1. JAR File Import:
    • Confirm you’ve imported the Microsoft Authentication Library JAR file (msal4j.jar)
    • Verify the JAR file is properly imported using Configure > Application > Distribution > Import
  2. Authentication Setup:
    • Ensure you’ve created the keystore file with the certificate
    • Verify the basic authentication profile is properly configured
    • Check that you’ve restarted the server after these configurations
  3. RUF Implementation:
    • For SharePoint integration, your RUF should handle authentication and token management
    • The parameters should include clientID, tenantID, scope, keyStoreName, authProfileName, and token (as output)

Current Best Practices for RUF Calls

The method for calling RUFs from Java steps hasn’t significantly changed in Pega 24.2+. The fundamental approach remains the same as in previous versions. However, Pega generally recommends:

  1. Using declarative approaches when possible instead of Java steps
  2. When Java is necessary, encapsulating complex logic in RUFs rather than inline Java
  3. Ensuring proper library generation and server restarts after changes

Debugging Suggestions

To troubleshoot this specific error:

  1. Check the Exact Library Name:
    • Open your SP_Library rule and note the exact case-sensitive name
    • Verify the ruleset it belongs to
    • In your Java step, use the lowercase version with underscores: ruleset_name_sp_library.SP_Funtion(...)
  2. Inspect Generated Java:
    • After generating the library, you can check the generated Java class in the PegaRULES database
    • This can help confirm if the library was properly generated
  3. Try a Simple Test:
    • Create a simple test RUF that returns a string value
    • Call this from a Java step to verify the basic mechanism works