0

I have created a PeopleTools Application Engine program to insert/update employee National ID data in the PS_PERS_NID table. I am using a PeopleTools File Layout definition to insert data into a staging table and then using an Application Engine Do Select to read data from a stating table and load through a PeopleTools Component Interface (CI) definition via PeopleCode. When the data is clean it works fine. I have written a query in the exception peoplecode to update the data in the staging table with processing status and Error message.

When I tested it with an invalid SSN, it returns message Error changing value, and causes the application engine to fail. I have all peoplecode in a try-catch block that gets created by default.

Can someone please provide sample logic code through I can capture error message in staging record without abending the process.

qyb2zm302
  • 6,458
  • 2
  • 17
  • 17
angel
  • 47
  • 8
  • "Can someone please provide sample logic code through I can capture error message in staging record without abending the process."? This is a flag that the question is off-topic. You're supposed to do the research, write code, then ask a specific question about a specific problem, not ask us to write code for you which is off-topic. Please read "[ask]" and "[mcve]" and their linked pages. – the Tin Man Feb 19 '22 at 20:53

3 Answers3

1

In the Application Engine Definition, does your Step have the 'On Error' option set to 'Abort'?

Set it to 'Ignore' or 'Suppress' and handle the error in peoplecode.

Check the 'Setting up properties' section in the Application Engine PeopleBooks for more info on these options.

Based
  • 950
  • 7
  • 18
  • I tried using 'Ignore' on 'On Error' on step level where Component Interface is loading data into PS_PERS_NID table. Please let me know if I need to add code to handle this case. – angel Jan 31 '22 at 12:54
  • 1
    Handle the case? Do you want the invalid SSN to be inserted even though it is invalid? Setting 'Ignore' should ignore the error, and continue with the next step. The SSN will obviously not be inserted as it's invalid. Capturing the error is done in the catch statement. – Based Feb 01 '22 at 10:10
1

I adopted this method to resolve this situation:

  1. Create new fields to capture the error text in the staging record.

  2. Before calling the Component interface code, check if the provided SSN value is valid or not. I used the delivered function check_nid. If the value does not fulfil the criteria, mark the row as an "Error" row and capture the error text in the staging field.

  3. Ignore the "Error" row.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
angel
  • 47
  • 8
1

The problem here is that your session is in an errored state and it is trying to continue processing. You need to clean up your session messages before continuing. When you create the CI, make sure you set interactive to false, else you have to check for messages every time you set a value. Then after your 'save' call, check for messages, report them, and clear them.

ZeusT
  • 515
  • 2
  • 8