GetGENAIPromptText

You can use the GetGenAIPromptText function to retrieve GenAI prompt text associated with a specified prompt code from the Prompt Manager. The function can return the complete prompt by combining the configured Goal, Prompt, Security & Trust Boundaries, Output Contract, and Normalization fields.

Note: Only the fields containing values are included in the final prompt.

When to use

You can use this function to:

  • Retrieve the value of a specific field from the Prompt Manager form for a given prompt code.
  • Integrate GenAI prompts programmatically within a scripting context.

When not to use

You cannot use this function when the prompt code is not configured or registered in the system.

Syntax

string GetGenAIPromptText(string promptCode);
string GetGenAIPromptText(string promptCode, string FieldName);

Parameters

Parameter Type Required Description
promptCode string Yes The name of the prompt manager record whose text is to be retrieve.
Note: This must match a valid PROMPT_CODE in the FSPROMPTMANAGER table.
FieldName string Optional The name of a field in the Prompt Manager form. When provided, the function returns the value of that specific field rather than the full prompt text.

Return Value

The application returns the GenAI prompt text as a string corresponding to the specified prompt code and field name, if provided.

Prerequisites

  • The FieldName value needs to match a valid field name defined in the Prompt Manager form.
  • If the prompt code does not exist, the function may return null or an empty string.
  • An unrecognized field name may result in a default or empty value being returned

Examples

Example 1
Retrieve prompt text by code only/
using System;

class ActionScript : FcProcFuncSetEventWF
{
    public long wf_start()
    {
        string promptText = GetGenAIPromptText("TRANSLATE_RICH_TEXT");
        MessageList(promptText);
        return 1L;
    }
}
Description
This example retrieves the GenAI prompt text associated with the TRANSLATE_RICH_TEXT prompt code and stores the result in the promptText variable.
Example 2
Retrieve prompt text by code only.
using System;

class ActionScript : FcProcFuncSetEventWF
{
    public long wf_start()
    {
        string promptText = GetGenAIPromptText("TRANSLATE_RICH_TEXT", "Goal");
        MessageList(promptText);
        return 1L;
    }
}
Description
This example retrieves the value of the Goal field from the Prompt Manager form for the TRANSLATE_RICH_TEXT prompt code.