Epicor Kinetic columns/ control Value Append

How to append the correct value on a combo change? I am getting duplicate values every time the combo changes in Epicor Kinetic Application studio. The following output is being generated repeatedly.
@dr_dan @GabeFranco

@Evan_Purdy what about this?

VIRGINIA BOHORQUEZ: 9/10/2025 1:33:47 PM
MF031-MF040 2026 HOSE ASSYS - LOCKING IN QUANTITIES
**Approved By Manager on behalf of Yvette Martinez 2/20/2026 **
**Rejected By Manager on behalf of Yvette Martinez 2/20/2026 **
Approved By Manager on behalf of Yvette Martinez 2/20/2026

**Incorrect** 
 VIRGINIA BOHORQUEZ:  12/15/2025 1:47:20 PM
VAMs for MF009 THRU MF029
 Karl Waggoner:  12/15/2025 4:26:05 PM Rejected By Manager on behalf of MINNIE HILL 2/20/2026 Approved By Manager on behalf of MINNIE HILL 2/20/2026 Rejected By Manager on behalf of MINNIE HILL 2/20/2026 Approved By Manager on behalf of MINNIE HILL 2/20/2026 Rejected By Manager on behalf of MINNIE HILL 2/20/2026

**correct: for Approved**
VIRGINIA BOHORQUEZ:  12/15/2025 1:47:20 PM
VAMs for MF009 THRU MF029
 Karl Waggoner:  12/15/2025 4:26:05 PM Approved By Manager on behalf of MINNIE HILL 2/20/2026

**correct: for Rejected**
VIRGINIA BOHORQUEZ:  12/15/2025 1:47:20 PM
VAMs for MF009 THRU MF029
 Karl Waggoner:  12/15/2025 4:26:05 PM Rejected By Manager on behalf of MINNIE HILL 2/20/2026

function return : “{actionResult.ResultMsgText}”

Function Code

string existing = MsgText ?? "";
string prefix = string.IsNullOrWhiteSpace(existing) ? "" : existing + " ";

string user = Session.UserID;
string today = DateTime.Today.ToShortDateString();

if (ApproverResponse == "APPROVED")
{
    ResultMsgText =  prefix + "Approved By " + user + " on behalf of " + BuyerName + " " + today;
}
else if (ApproverResponse == "REJECTED")
{
    ResultMsgText = prefix +"Rejected By " + user + " on behalf of " + BuyerName + " " + today;
}
else
{
    ResultMsgText = existing;
}

Function tested in Postman

1 Like

Can you show the properties for the function widget?

It is a code function


No, this guy - how is it set up?

If you have the network up in browser debugging is your function being called multiple times?

I tested it in Postman, and it also shows the correct value in the popup function, but the control is causing an issue—it is not clearing the existing values

postman test

you are using replace and not merge right?

1 Like

Your function is set up to append, change line 2 from a space to a newline:
Old: string prefix = string.IsNullOrWhiteSpace(existing) ? "" : existing + " ";
New: string prefix = string.IsNullOrWhiteSpace(existing) ? "" : existing + Environment.NewLine;

But then, it also looks like the function is getting called more than once or something, as you are getting multiple lines appended for one click.

2 Likes

Following code is working.

Thanks for the guidance. Actually, I was focusing on the control side, and the issue with the function in Postman confused me to returned the correct values.

I appreciate all your suggestions.

@GabeFranco @Evan_Purdy thanks

// Ensure existing message is not null
string existing = MsgText ?? "";

// Remove previous approval/rejection lines if they exist
existing = System.Text.RegularExpressions.Regex.Replace(
    existing,
    @"(Approved By|Rejected By).*\d{1,2}/\d{1,2}/\d{4}\.?$", 
    "", 
    System.Text.RegularExpressions.RegexOptions.Multiline
).Trim();

// Decide prefix based on whether there is existing content
string prefix = string.IsNullOrWhiteSpace(existing) ? "" : existing + Environment.NewLine;

// User info and date
string user = Session.UserID;
string today = DateTime.Today.ToShortDateString();

// Set the result message based on response
if (ApproverResponse == "APPROVED")
{
    ResultMsgText = prefix + $"Approved By {user} on behalf of {BuyerName} {today}.";
}
else if (ApproverResponse == "REJECTED")
{
    ResultMsgText = prefix + $"Rejected By {user} on behalf of {BuyerName} {today}.";
}
else
{
    ResultMsgText = existing;
}
2 Likes

Maybe mark Gabes post as the solution

2 Likes