Tuesday, 22 November 2016

PeopleCode Events


Below is the list of PeopleCode Events in the order of their execution:

1.  SearchInit  
2.  SearchSave
3.  RowSelect
4.  PreBuild
5.  FieldDefault
6.  FieldFormula
7.  RowInit
8.  PostBuild
9.  Activate
10. FieldEdit
11. FieldChange     
12. RowInsert
13. RowDelete
14. SaveEdit
15. SavePreChange.
16. WorkFlow
17. SavePostChange


Above mention events can be written on the following PeopleCode event locations:

1.  Page Event
2.  Menu Event
3.  Record Event
4.  Component Event
5. Component Record Level
6. Component Record Field Level



Wednesday, 9 November 2016

Auto increment of sequence number


Sometime in grid or scroll, we need to write peoplecode on a field which stores unique number every time when we click on add new row button. Below code can be used to achieve this functionality:

Local Rowset &rowset;

&rowset = GetLevel0()(1).GetRowset(Scroll.TEST);

&count = 0;

For &i = 1 To &rowset.ActiveRowCount
   If &count < &rowset(&i).TEST.SEQNBR.Value Then
      &count = &rowset(&i).TEST.SEQNBR.Value;
   End-If;
End-For;

&rowset(CurrentRowNumber()).TEST.SEQNBR.Value = &count + 1;


TEST is name of grid or scroll. Auto increment number will start from 0 if you want that it will start from 1 or any other number, assigned that value &count variable after declaring rowset.