You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Value should not get saved

2 replies [Last post]
Guest's picture


i've written peoplecode on fieldchange event where there's a field amount which should not exceed $1000.

If LOAN_TRK.AMT.Value > 1000 Then
Error ("Loan amount cannot exceed $1000");

the error message is shhoting but on save the page is storing the amount in excess of 1000.

Do i need to use DoCancel() exactly after the Error message so the the page sould not get saved with amount more then $1000 ?

Nitin's picture
User offline. Last seen 4 years 2 weeks ago. Offline
Joined: 06/30/2008
Posts: 73
Re: Value should not get saved

Put you code in FieldEdit instead of FieldChange.

Nitin Bhatia

Lepa's picture
User offline. Last seen 31 weeks 3 days ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Value should not get saved

Nitin is correct.

Use the Error function in FieldEdit or SaveEdit PeopleCode to stop processing and display an error message.
• In FieldEdit, Error stops processing, displays a message, and highlights the relevant field.
• In SaveEdit, Error stops all save processing and displays a message, but does not highlight any field.

It is clearly stated in PeopleBooks not to use the Error function in a FieldChange event.
I would also strongly recommend storing your message error into a message catalog instead of hard coding it. Look at the MsgGet function in PeopleCode to see how you can retrieve your message and define the “Severity” level as well. Or take a look at the following post for a quick example

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog