Suppose that in the Calls function (GESCLL) we want to add a field that will show the position of the selected contact in his organization. Like this:
The field we need is CNTFNC in the Contacts table. First we create the corresponding screen field in the Screens function (GESAMK), screen CLL0:
After we validate the screen, from the General tab we access the SPECLL file, where we enter the following code:
$ACTION
Case ACTION
When "OUVRE" : Gosub OUVRE
When "LIENS" : Gosub LIENS
When Default
Endcase
Return
$OUVRE
If clalev([CNT])=0 : Local File CONTACT [CNT] : Endif
Return
$LIENS
Read [CNT]CNT0=1;[M:CLL0]CLLCMP;[M:CLL0]CLLCCN
If !fstat
[M:CLL0]CNTFNC=[F:CNT]CNTFNC
Endif
Return
Case ACTION
When "OUVRE" : Gosub OUVRE
When "LIENS" : Gosub LIENS
When Default
Endcase
Return
$OUVRE
If clalev([CNT])=0 : Local File CONTACT [CNT] : Endif
Return
$LIENS
Read [CNT]CNT0=1;[M:CLL0]CLLCMP;[M:CLL0]CLLCCN
If !fstat
[M:CLL0]CNTFNC=[F:CNT]CNTFNC
Endif
Return
In the opening action OUVRE we make sure to open the CONTACT table, if it is not already opened. Then, in the action LIENS which is called on each screen update but before the screen is displayed, we read in the contact and, if there are no errors, assign his function in the organization (CNTFNC field) to our custom field of the same name.
You might need to logout/login before this custom development becomes active. Also, do not forget to save and compile the SPECLL file, as well as to validate the CLL0 screen.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.