How to Bypass Search Page

 

There could be situations when you need to bypass search page depending upon the user logged in. For instance to use self services employees should not see the search page, they should automatically be transferred to their self service data like phone, email, education, address, emergency contact and others. There are also situations when you need to bypass search page depending on the user’s role. Suppose there is a performance review or salary increment module and you want that the manger should be able to see the data of employees below him.

So these are the typical scenarios where you may need to bypass the search page, there could be other situations too. Below I am going to tell you that how can you bypass the search page using PeopleCode.

In the example PeopleCode below using the user’s role we will decide whether to bypass the search page or not.

This code has to be written in the SearchInit event of the search field of the Search record or at the Component level search Record.

&EMP_ROLE = "Y";
For &I = 1 To %Roles.Len;
If %Roles [&I] <> "EMP" Then

&EMP_ROLE = "N";

End-For;

If &FLAG_ROLE = "Y" Then
COMPONENT_SEARCH_RECORD.EMPLID = %EmployeeId;
/*Hide emplid and name so user can not search, as these are the keys used in the search record*/
Hide(COMPONENT_SEARCH_RECORD.EMPLID);
Hide(COMPONENT_SEARCH_RECORD.NAME);
/* To skip search page use below PeopleCode function with parameter “0” */
SetSearchDialogBehavior(0);
AllowEmplIdChg( True);
End-If;

Now if you want to show the search page for those users who have manager role or a role other than employee you can use below code.

&EMP_ROLE = "Y";
For &I = 1 To %Roles.Len;
If %Roles [&I] <> "EMP" Then

&EMP_ROLE = "N";

End-For;

If &FLAG_ROLE = "Y" Then

COMPONENT_SEARCH_RECORD.EMPLID = %EmployeeId;
/*Hide emplid and name so user can not search, as these are the keys used in the search record*/
Hide(COMPONENT_SEARCH_RECORD.EMPLID);
Hide(COMPONENT_SEARCH_RECORD.NAME);
/* To skip search page use below PeopleCode function with parameter “0” */
SetSearchDialogBehavior(0);
AllowEmplIdChg( True);

Else

/*Allow this user to see the search page*/
SetSearchDialogBehavior(1);

/*Unhide emplid,name for user to be able to search */

UnHide(COMPONENT_SEARCH_RECORD.EMPLID);
UnHide(COMPONENT_SEARCH_RECORD.NAME);
End-If;
Else

End-If;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值