PeopleCode Event: FieldChange

FieldChange PeopleCode EventPeopleCode FieldChange event fires just after a change to the contents of a field has been made. It fires on the particular field that has changed. You can find the FieldChange event in Record Fields as well as Component Record Fields.

Typical use of the FieldChange PeopleCode is to perform re-calculations and control the appearance of elements on a page.

FieldChange PeopleCode is often paired with RowInit PeopleCode. In these RowInit/FieldChange pairs, the RowInit PeopleCode checks values in the component and initializes the state or value of page controls accordingly. FieldChange PeopleCode then rechecks the values in the component during page execution and resets the state or value of page controls.

For example, consider 3 fields Quantity, Price, Total where Total is calculated as Quantity * Price.
Now, if we want the Total to be recalculated whenever the value of Price or Quantity changes, we can write PeopleCode in the FieldChange event of both Quantity and Price fields that calculates Total as Quantity * Price.

If Total is a Devived/work record filed and we are not storing its value to the database, we will have to calculate its value from Quantity and Price, each time the row of data is shown, for this, we write the required PeopleCode in the RowInit Event.

Subscribe to Comments RSS Feed in this post
5 Responses
  1. i want people code for calculating total programme

    • You can write this code in the FieldChange event of both Quantity and Price fields as well as in the RowInit of Total field.

      I assume the following names for the fields / records.

      Quantity – QTY
      Price – PRC
      Total – TOT
      Record – GK_SAMPLE

  2. I have a question. I’m new to peoplesoft.
    1. I created a record with 4 fields.
    2. Emplid, Emarks,Rmakrs,total.
    3. After i enter first 3 fields , i want to see the total in Total as soon as i tab out from 3rd field(Rmarks). I have written the same code as you mentioned above. When i hit enter thats when it is displaying the value, but i would like to see as soon as i tab out of the third field.

    How do i do ?Please suggest.

    • @Sunny – Disable the deferred processing by unchecking it on the page field properties.

  3. I need to use field change in a grid. When a user checks a check box, it need to inactivate two other fields on the page in the same row.

    How do I do that?

Leave a Reply

Your email address will not be published. Required fields are marked *