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.

Peoplecode help

4 replies [Last post]
maheshkundu's picture
User offline. Last seen 9 years 45 weeks ago. Offline
Joined: 05/16/2008
Posts: 12

Hi Folks,

I am facing a people code problem.I am telling my requirement.
In my project..
I have created 2 roles..like P&A & Manchester HRSC...
and I have assigned P&A role for PS user & Manchester HRSC for PSHC user..
and this PS user have all d access on set up page as well as transaction page...and also it allowed 2 visible all d information according 2 case type
of transaction page

But for PSHC user,only able 2 view data....for some particular case type...

for that i've written peoplecode in parent record-rowinit....

Declare Function MatchRoleName PeopleCode FUNCLIB_HR.ROLENAME FieldFormula;

&rolePA = "RBS_PA";
&roleMANC = "Manchester HRSC";
If MatchRoleName(&roleMANC) Then
&S1_CASE_TYPE = GetRecord(Record.S1_CASE_P).GetField(Field.S1_CASE_TYPE);
&S1_CASE_TYPE.ClearDropDownList();
&S1_CASE_TYPE.AddDropDownItem("LR", "Learning");
&S1_CASE_TYPE.AddDropDownItem("PB", "Pay & Benefits");
&S1_CASE_TYPE.AddDropDownItem("RR", "Regulated Resourcing");
&S1_CASE_TYPE.AddDropDownItem("RS", "Resourcing");
&S1_CASE_TYPE.AddDropDownItem("TD", "Telephony Default");
End-If;

it's working fine....but d thing is i'm login with PSHC and entering transaction page through search page....and in search page when i am clicking that field on which user doesn't have any access.....showing just invalid value......

but when i'm clicking that permitted case type then it's showing that correct information.......

everything is okk....when i'm logging with PS user...

i've tried in search init & prebuild also..but not working..
So frnds please suggest me which peoplecode i've 2 write 4 that..

If %UserId = "PSHC" Then

&S1_CASE_TYPE = GetRecord(Record.S1_CASE_P).GetField(Field.S1_CASE_TYPE);
rem. &S1_CASE_TYPE.ClearDropDownList();
&S1_CASE_TYPE.AddDropDownItem("LR", "Learning");
&S1_CASE_TYPE.AddDropDownItem("PB", "Pay & Benefits");
&S1_CASE_TYPE.AddDropDownItem("RR", "Regulated Resourcing");
&S1_CASE_TYPE.AddDropDownItem("RS", "Resourcing");
&S1_CASE_TYPE.AddDropDownItem("TD", "Telephony Default");

End-If;

I wrote this code in prebuild & page activate also...but not able resolve d problem........

I've explained in details so that u can understand my query.....

Regards,
Mahesh

Ashar's picture
User offline. Last seen 4 years 13 weeks ago. Offline
Joined: 03/26/2008
Posts: 227
Re: Peoplecode help

Do you want to display only the relevant values in search page as well?
I guess SearchInit should work well..i'm not sure why it is not working for you though.

Lepa's picture
User offline. Last seen 1 year 31 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Peoplecode help

take the whole "if" check out of there and try it again. you said it works for PS user, so take the "If" out and test it without condition to see if that is what is causing you problem.

comment out this:

If MatchRoleName(&roleMANC) Then

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

maheshkundu's picture
User offline. Last seen 9 years 45 weeks ago. Offline
Joined: 05/16/2008
Posts: 12
Re: Peoplecode help

Hi Lepa,
I've tried it.but it's not working.
RBS_PA role i've assigned for PS user.

Manchester HRSC role i've assigned for PSHC user.

RBS_PA(PS user) should be able to view all data relating to an employee on page.

But Manchester HRSC(PSHC) should not be able to view the following type:

Absence/Disciplinary/Redeployment...and some other fields.....

and i've mentioned the view (for search page) into that search record component properties ....

and my view is like this:
SELECT DISTINCT A.S1_CASE_NUM
,A.S1_CASE_TYPE
,B.EMPLID
,B.MANAGER_ID
,D.NAME
,D.NAME_AC
,B.S1_QRY_CATEGORY
,B.DT_COMPLETED
,C.S1_CASE_CNSLTNT
FROM PS_S1_CASE_P A
, PS_S1_CASE_C B
, PS_S1_CASE_STEP C
, PS_NAMES D
WHERE A.S1_CASE_NUM = B.S1_CASE_NUM
AND A.S1_CASE_NUM = C.S1_CASE_NUM
AND B.EFFDT = C.EFFDT
AND B.EFFSEQ = C.EFFSEQ
AND D.EMPLID = B.EMPLID
AND D.NAME_TYPE = 'PRI'
...when i'm going through search page then all value's r coming.when
i'm clicking Absence/Grievence..which is not accessable for PSHC user..
it's showing invalid value in transaction page.....

that's why i'm telling in which event i've 2 write peoplecode 4 that..
preciously i wrote peoplecode in component-search record-searchinit.....

If %UserId = "PSHC" Then

&S1_CASE_TYPE = GetRecord(Record.S1_CASESRCH_VW).GetField(Field.S1_CASE_TYPE);
rem &S1_CASE_TYPE.ClearDropDownList();
&S1_CASE_TYPE.AddDropDownItem("LR", "Learning");
&S1_CASE_TYPE.AddDropDownItem("PB", "Pay & Benefits");
&S1_CASE_TYPE.AddDropDownItem("RR", "Regulated Resourcing");
&S1_CASE_TYPE.AddDropDownItem("RS", "Resourcing");
&S1_CASE_TYPE.AddDropDownItem("TD", "Telephony Default");

End-If;

but it's not working...then wrote in prebuild...same thing..but not working......
everything is working fine only invalid value is coming in the place of casetype (transaction page)......but if we click in other case type like Resourcing (I've given authorisation to PSHC user to view it's data),
then it's showing correctly....

I am not getting wht's d reason...

Ashar...........I think u under stood my recuirement.......

Please help me out....

Regards,
Mahesh

SPOooON's picture
User offline. Last seen 11 years 14 weeks ago. Offline
Joined: 02/11/2009
Posts: 2
Re: Peoplecode help

Hi Mahesh, im not entirely sure if you can use addxlatitem on search records. Luckily, there is another solution. Add the following to your view:

The field oprid (add this to the top of your list, and make it a key, no search, no list)

Weave psoprdefn into your view to select psoprdefn.oprid into oprid. No need to join it to any table just yet.

create a view (New_View):
oprid(key)
S1_CASE_TYPE (key)
descr (list box item)

select a.roleuser, b.xlatvalue , b.xlatlongname
from psroleuser a, psxlatitem(lang) b
where b.effdt = (select max(etc))
and (a.rolename = 'ROLE1' and b.xlatvalue in ('A','B','ETC')
or a.rolename like 'OTHER_ROLE%' and b.xlatvalue in (you get the point) )

now in your original search record, override the field S1_CASE_TYPE's prompt settings, change it from xlat to table edit and enter your new view(New_View).

And you're set

BTW, this would be made easier by making a record to maintain row level security for S1_CASE_TYPE and adding that to New_View