Genpact AP Knowledge Center

Support

AI-based Work Item (Invoice) Prioritization for Buyer Portal

V1.0

Overview

Using AI, we aim to provide users with clear visibility into high-priority invoices demanding immediate action. This approach enhances workflow efficiency and facilitates timely payments to vendors.

With the power of AI, the system thoroughly reviews all work items in users' buckets, transcribe the key invoice information, and provide actionable recommendations.

How AI based prioritization works?

  • Users have visibility into a separate queue for shortlisted high-priority invoices by AI, positioned at the forefront of the queue list.

  • Users get the invoice list view with one click on the dashboard.

  • Accompanying this separate queue is a summary that provides detailing why invoices within it are deemed most critical by AI.
  • Users get the rationale behind the prioritization of invoices that helps in understanding the urgency assigned by the AI system.
  • Users can view on the edit page, the AI banner & ranking based on condition for the queue.

  • Feedback section is available in the user action section, for all queues along with AI if it is configured from Admin.
    However, the Feedback section is not prefilled and is optional for users.

Configure Processor portal

As an administrator, set up the configurations for batch processing of the invoices such as invoice filter criteria, invoice current states (for which Gen AI priority ranking responses are essential), and Invoice field APIs that need to be included for the prioritization.

Also, to enable gen AI services for a customer, configure the subscription or trial status and the allotted tokens with a unique client identifier in Azure Proxy Services. The same client identifier must be included in the Named Credential as a custom header using the key "client_token”.

To implement trial-based Gen AI Services for Genpact AP Advance, create the Azure Proxy Services. During the trial phase, buyers have access to an AI-powered queue, allowing them to swiftly address invoices requiring urgent attention. Once the trial concludes, the AI-powered queue is temporarily disabled, prompting the users to contact the Admin for subscription options to unlock the full AI feature.

1. Setup AI configurations

Create a new record of ‘Gen AI System Configuration’ custom metadata with the name given in the AP_GenAICustomMetadataRecordNameForBP label. 

  1.  Log in to Salesforce as an administrator.
  2. Go to Setup and type and select Custom Metadata types from the quick find box.
  3. Click Manage Records for Gen AI System Configuration >> GenAI_System_Config_BP (Name should be in sync with the label AP_GenAICustomMetadataRecordNameForBP)>> Edit.
  4. Modify AI related configurations.
    • AP Integration Record Name: Use this field to add name (API_Name__c) of the AP Integration record to use for AI Integration configurations.
    • Recalculate Ranking Enabled: Use this field to enable or disable recalculation of Priority Ranking on the Invoice. The criteria for recalculations can be configured in ‘Recalculate Ranking Field APIs’ field.
    • Recalculate Ranking Field APIs: Use this field to add Invoice field APIs as ‘,’ separated, which are used for recalculation of the Priority Ranking. The change in these field values while the invoice is still eligible for the AI response, invokes recalculation, which is evaluated in the next batch processing.
    • Exclude Few Shot Examples: Use this field to exclude Invoice Few Shot Examples from AI request, which are used as Priority Ranking reference.
    • System Instruction Prompt: Use this field to add System Instruction prompt to give directives to AI model. Changes in this field are recommended for periodically prompt improvement purposes only.
    • Query Prompt: Use this field to add Query Instruction prompt to give directives to AI model. Changes in this field are recommended for periodically prompt improvement purposes only.
    • Response Format Prompt: Use this field to add Response Format prompt to give directives to AI model. Changes in this field are recommended for periodically prompt improvement purposes only.

2. Create a Named Credentials

Create a Named Credentials to integrate with generative AI API callouts.
For details on creating Named credentials, see this document.

NOTE
In case we want to use Endpoint URLs directly instead of creating Named Credentials, create a remote site setting for the given URL.

3. AI Integration Setup

As an administrator set up one-time configurations (defined in Setup Configuration section) for batch processing of the invoices such as invoice filter criteria’s, invoice current states for which Generative AI priority ranking responses are essential, and invoice field APIs that need to be included for the prioritization.

The existing AP Integration tab is used for configurational setup of Genpact AP Advance integration with Azure OpenAI. Enable AP Integration tab in the org, if it is not enabled already. Below is the list of required configurations and how they are provided using the AP Integration page.

  • Integration name:
    • AP Integration Tab UI Field: Integration Name
    • Use this field to add the name of the AP Integration record. 
    • This field value should be used in Setup -> Custom Metadata -> Gen AI System Configuration -> Manage Records -> Edit record -> AP Integration Record Name field value to get integration configurations.
  • Enable generative AI callout:
    • AP Integration Tab UI Field: Active/Inactive toggle
    • This field is used to enable or disable Genpact AP Advance - Generative integration.
  • Named credentials name: 
    • AP Integration Tab UI Field: End Point
    • Use this field to add the name of the Named Credentials used to integrate with Generative AI Services.
  • End point URL:
    • AP Integration Tab UI Field: Token End Point
    • Use this field to add the Endpoint URL to connect with Generative AI-Genpact AP Advance Azure Proxy services. Use this field if named credentials are not created.
  • Client token:
    • AP Integration Tab UI Field: Static Header Param (#Separator)
    • Use this field to add the unique client identifier for the customer. The same identifier is configured in Azure Proxy Service along with trial/subscription status and respective tokens. Use this field when named credentials are not created.
  • Batch start current states: 
    • AP Integration Tab UI Field: Batch State (ML Scenario)
    • Use this field to add the current states of the invoice as ‘,’ separated values for which Generative AI prioritization response is required.
  • Invoice field APIs to Include: 
    • AP Integration Tab UI Field: Code Prediction
    • Use this field to provide invoice critical/key fields that are required to determine priority.
      Add field APIs with namespace in the below format.
{
    "System_Default": "Field_API_1, Field_API_2, Field_API_3"
 }
  • Batch size:
    • AP Integration Tab UI Field: Batch Size
    • Add the size of the batch chunks in which invoice records get processed to invoke generative AI response. Make sure the batch size doesn't exceed callout limits of Generative AI model.
  • Invoice filter criteria to invoke AI response:
    • AP Integration Tab UI Field: Entity/Object Configuration
    • Use this field to filter invoices for which Generative AI response will be invoked. Use the Entity JSON in the following manner.
      • Choose object – Select Invoice object from the picklist.
      • Field – Chose Invoice field from the invoice.
      • Entity name – Add invoice field condition operator as string literal.
      • Entity value – Add invoice field value.
Operator String literal
= equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to


NOTE
Custom Metadata ‘Gen AI System Configuration’ record for Buyer Portal will be created as part of the salesforce package by the name given in the Label ‘AP_GenAICustomMetadataRecordNameForBP’, which can be modified as per the requirements.

A record of AP Integration will be created using post install script by the name provided in the custom metadata record field. By editing the given record, the above configuration can be done.

Once the configuration set up is complete, schedule the batch class ‘APGenerativeAIBatch’ periodically as per the business requirements. The batch class will generate priority rankings using Generative AI for the eligible invoices.

Set up Invoice Few Shot examples

Buyer Subject Matter Experts (SMEs) need to create an Invoice Few Shot Examples Excel file for the examples. This document contains sample data of key invoice fields, which are configured in the Setup Configuration, with the expected Priority Ranking from 1 to 5 (where 1 signifies highest priority and 5 signifies lowest priority). Considerations for creating these examples are defined in the Sample Invoice Few Shot Example section. 

The system with Integration Daemon stores the data from the Invoice Few Shot Example Excel file as records of Invoice Reference Data object.

Invoice Few Shot examples are sample invoice records with key/critical fields data with their expected Priority Ranking provided by SMEs. These examples will work as a reference basis for Generative AI.

These examples should be created in CSV/Excel format which will be inserted in the system as Invoice Reference Data records using Integration Daemon.

Considerations while creating Invoice Few Shot Examples:

These records consist of critical/key fields of invoices, serving as the basis for Generative AI to determine Priority Ranking.

NOTE
These key fields are the same that have been configured in the setup configuration in Code Prediction (Invoice Field APIs to Include).

Based on the records data, Priority Ranking should be provided by SMEs.

Include realistic but diverse examples – Create invoice records that reflect realistic scenarios but also vary in complexity, size, and characteristics.

Ensure a balanced distribution of attributes/fields values across the sample records to prevent bias and provide a fair representation of different Invoice scenarios.

Sample Invoice Few Shot Example

InvoiceIdentifierField KeyField1 KeyField2 KeyFeild3 Priority Ranking
invoice1


1
Invoice2


3
Invoice3


2
Invoice4


5
Invoice5


1
Invoice6


4
Invoice7


3

See a sample format here.

NOTE
  • The example CSV should not contain more than 1500 words.
  • The file will work for both Buyer and Processor portal.

Procedure to configure Buyer portal

1. Set up SObjects

  1. Log in to the Buyer Portal as an administrator.
  2. Go to Setup >> SObjects >> Manage sObjects.
  3. Add Invoice Extension and Invoice Priority Feedback from Salesforce SObjects to Local SObjects as shown below:

2. Create AI dashboard queue

  1. Go to Components >> Dashboard Components >> Create Component. 
  2. Create AI dashboard queue following highlighted configurations as shown in example screenshots below:
NOTE
Make sure the value of CoraAP__AP_Type__c in Where clause is “BuyerPriority”, as it comes from the label in Salesforce.
Points to note for highlighted fields shown above:

Added a new configuration for LIMIT at queue level. If there is data available in the limit configuration then only that number of invoices will be fetched.

Points for Where Clause field:

If the Where Clause of a queue contains a nested query (or the queue is AI queue because in this case, we create a nested Where Clause at the backend) group by field should be a mandate if we are giving a LIMIT because of a salesforce limitation.

For AI queue we are combining the Where Clause of all the invoice queues (except for special queues or if any queue contains a nested query) in OR and then adding the Where Clause of AI queue in AND.

If there is no Where Clause on AI queue all the invoices present in all other queue will be accessible from AI queue.

if there is a Where Clause present in that queue, Only the invoices which satisfy the AI queue condition, and all other queue condition will be accessible from AI queue.

Enable “Gen AI Suggested Queue ?” toggle. Also, configure the “Gen AI Color Coding” as shown above.

Configure Component fields to be shown on UI.

Configure the Detail SObject Component fields to be displayed in UI.


NOTE
Grant access to this queue for the necessary user-profiles and include the queue in the dashboard configuration section. For detailed instructions, please consult the Genpact AP Advance Buyer Portal configuration guide, which provides information on setting up dashboard queues and managing user profile access.

3. Configure Related Lists objects on Invoice Edit layout

  1. Go to Layouts.
  2. Click edit for Invoice Edit Layout.
  3. Drag and drop AP INVOICE EXTENSIONS and AP INVOICE PRIORITY FEEDBACKS from RELATED LISTS widget and configure:

  4. Go to settings for AP INVOICE EXTENSIONS related lists object and configure as highlighted in the example screenshot below:

  5. Now go to settings for AP INVOICE PRIORITY FEEDBACKS related lists object and configure as highlighted in example screenshot below:

NOTE
It is mandatory to set up the trial version.

4. Procedure to Configure Buyer Portal Trial

To set up the trial version for AI, as an administrator configure the following. 

  1. Login to the Buyer portal.
  2. Go to Components >> Dashboard Components >> open High Priority queue >> Gen AI Integration Config will contain the below JSON by default (you can copy and edit the JSON as per your requirements).
{
 "genAIIntergrationName":"Azure OpenAI",
 "genAISubscriptionValues":[ 
 {"fieldApiName" : "CoraAP__State__c"},
 { 
 "underTrial" : "under Trial",
 "trialExpired" : "trial Expired",
 "trialGoingToExpire" : "Trial Going to Expire",
 "subscription" : "subscription",
 "subscriptionExpired" : "subscription Expired",
 "subscriptioGoingToExpire" : "Subscription is going to be expired."
 }],
 "TokenExpiryField" : "CoraAP__AP_Token_Expiry_Alert__c"
 }

Description of fields mentioned in above JSON:

  • genAIIntergrationName: Mention the API_Name__c field Value of the AP Integration record in salesforce which is used for configured setup for AI integration (for example “API_Name__c' = 'Azure OpenAI”).
  • genAISubscriptionValues - 'fieldApiName': Mention the field api name of AP integration object of salesforce which stores trial/subscription status (for example "fieldApiName" : "CoraAP__State__c").
  • TokenExpiryField: Mention the field api name of invoice extension object which is used is used as a flag to indicate sub/trial about to expire. (For example, “TokenExpiryField" : "CoraAP__AP_Token_Expiry_Alert__c”).

On Salesforce, 'AP_Integration__c' object requires the following fields to get trial status:

  • API_Name__c: Indicates which record is being used for getting trial status (for example 'API_Name__c' = 'Azure OpenAI').
  • 'State__c': Contains the trial values. Map the values according to JSON. (right side values in JSON should be on Salesforce).
Points to Note
  • If there is some mismatch in configuration then the status is 'trialExpired'.
  • If status is trialGoingToExpire or trialExpired or subscriptionExpired, then export for AI queue is disabled thus disabling the export of invoices.
  • For a blur invoice, data isn't copied and tooltip is disabled.
  • The product/support team needs to provide the required number of tokens to be configured for the required Customer as per Trial/Subscription.
Copyright © 2025 Genpact. All rights reserved.