Dynamic Promots Examples in PeopleSoft
Understanding Dynamic
Prompts in PeopleSoft
Every so often during the interviews, we encounter this
question a lot and without a proper understanding we end up improvising the
explanation.
The question is - What do you know about dynamic prompts and how we can create them?
Well, let’s get to the point and try understanding the concept with examples.
Prompts enable user to select a value from the list of predefined control values for a field in a page during transactions.
The question is - What do you know about dynamic prompts and how we can create them?
Well, let’s get to the point and try understanding the concept with examples.
Prompts enable user to select a value from the list of predefined control values for a field in a page during transactions.
For Example, when we create a new department, to select the
company we click on the prompt for company field and select one of the listed
values.
In this case, the list of companies displayed in the prompt is static and is directly pulled from the record COMPANY_TBL.
Below is the record field properties of COMPANY field in the record DEPT_TBL,
In this case, the list of companies displayed in the prompt is static and is directly pulled from the record COMPANY_TBL.
Below is the record field properties of COMPANY field in the record DEPT_TBL,
In this case, there is no control over what are all the values will be prompted to the user, whatever is available in the record COMPANY_TBL, will be listed.
Dynamic prompts on the other hand, enable us to have control over how and what will be the prompt values. i.e., based on a particular field value we can build a prompt dynamically during run time.
Let’s understand it more with two scenarios:
Scenario 1 (Dynamic Prompt using
Dynamic View)
As per delivered PeopleSoft
functionality, Compensation Rate Codes are created to be used by all the
companies. Common set of Compensation Rate Codes result in a huge number of
Compensation Rate Codes being rendered to a HR Users when they define a
person’s compensation on their Job Data.
However business want us
to customize delivered PeopleSoft pages that enable HR Users to access and
view only Compensation Rate Codes which are applicable for person’s company.
You see above, HR user is doing a transaction in the JOB_DATA component for an employee, NZ11SN19 who belongs to the company "107". So, in compensation page when HR user clicks the prompt button for "Rate Code" field, Only the compensation rate codes defined for company 107 should be available for selection.
This is called dynamic prompt, and it can be implemented using record type "Dynamic View" and is one way of implementing dynamic prompts.
Let's find out how to implement this-
Step 1: Create a record of type "Dynamic View" using app designer with the name - FMC_CRCCMP_DVW
Make the fields, COMPANY &
COMP_RATECD as both "Search key" and "List Box
item" and all other fields as "List Box item" only.
Step 2: In the COMPENSATION
record, open the record field property of COMP_RATECD, go to "Edits"
tab and assign the newly created dynamic view FMC_CRCCMP_DVW as the prompt
table edit.
Step :3 Add below peoplecode in
the RowInit record field event of COMP_RATECD field
&Company = JOB.COMPANY.Value;
If %Component = "JOB_DATA" Or Then
&fmccrcdyvwsql = SQL string which fetches the compensation rate codes WHERE COMPANY = &Company (Current person's company)
COMPENSATION.COMP_RATECD.SqlText = &fmccrcdyvwsql;
&fmccrcdyvwsql = SQL string which fetches the compensation rate codes WHERE COMPANY = &Company (Current person's company)
COMPENSATION.COMP_RATECD.SqlText = &fmccrcdyvwsql;
End-If;
Where &fmccrcdyvwsql is SQL string
which will pull the compensation rate codes valid only for the current person's
company.
Note - The above SQL is valid only when the below component is customize to define the Compensation rate codes based on the company:
Navigation - SetUP HRMS -> Foundation tables -> Compensation rules -> Comp rate code table
Note - The above SQL is valid only when the below component is customize to define the Compensation rate codes based on the company:
Navigation - SetUP HRMS -> Foundation tables -> Compensation rules -> Comp rate code table
Scenario 2 (Dynamic Prompt using
Derived Record Field):
You would have noticed many times in JOB_DATA component - Payroll
page, when you select payroll system as "Payroll Interface" and then
click on the prompt for "Paygroup" field you see the prompt as below:
But when you select payroll system as "Global Payroll"
and click on the prompt button for Pay Group field, you see below prompt:
See the difference in two prompt pages, Its because in both cases
the prompt table is different. In first case when you selected
Payroll System as "Payroll Interface" then the prompt table for the
field "Pay Group" was PAYGROUP_TBL whereas when you selected Payroll
System as "Global Payroll" then the prompt table for the same field
"Pay Group" was GP_PYGRP.
This is also called dynamic prompt, and it can be implemented using a field which is defined in record type "Derived/Worked" and is another way of implementing dynamic prompts.
This is also called dynamic prompt, and it can be implemented using a field which is defined in record type "Derived/Worked" and is another way of implementing dynamic prompts.
Now, Let us see how its been implemented.
Step 1: Add a field EDITTABLE6 in the derived record named
- DERIVED.
Step 2: Open the record field properties of the field PAYGROUP in
JOB table
Step 3: Add below PeopleCode in "Field Change" event of
the field PAY_SYSTEM_FLG(Payroll System)
If JOB.PAY_SYSTEM_FLG = "GP" Then
If JOB.PAY_SYSTEM_FLG = "GP" Then
DERIVED.EDITTABLE6.Value = Record.GP_PYGRP;
Else
If
JOB.PAY_SYSTEM_FLG = "PI" Then
DERIVED.EDITTABLE6.Value = Record.PAYGROUP_TBL;
DERIVED.EDITTABLE6.Value = Record.PAYGROUP_TBL;
End-If;
End-If;
So, if you understood both the scenarios explained above, did you find any difference between them ?
Well, Below is the difference:
Scenario 1 - Dynamic prompt is created using "Dynamic View" record definition and the rows selected in the prompt are controlled by SQL query supplied to the SQLTEXT property of record field based on certain condition.
Here, rows displayed in the prompt can be controlled but structure of the prompt remains same because underlying prompt record doesn't change.
Scenario 2 - Dynamic prompt is created using a field added in a record definition of type "Derived/Worked", the field name is used as the bind variable (%FieldName) which is mentioned in the record field properties. Then in the peoplecode, record definitions are assigned to this bind variable based on certain condition which becomes the prompt record.
Here, structure of displayed prompt appears different each time because underlying prompt record is changed.
So, if you understood both the scenarios explained above, did you find any difference between them ?
Well, Below is the difference:
Scenario 1 - Dynamic prompt is created using "Dynamic View" record definition and the rows selected in the prompt are controlled by SQL query supplied to the SQLTEXT property of record field based on certain condition.
Here, rows displayed in the prompt can be controlled but structure of the prompt remains same because underlying prompt record doesn't change.
Scenario 2 - Dynamic prompt is created using a field added in a record definition of type "Derived/Worked", the field name is used as the bind variable (%FieldName) which is mentioned in the record field properties. Then in the peoplecode, record definitions are assigned to this bind variable based on certain condition which becomes the prompt record.
Here, structure of displayed prompt appears different each time because underlying prompt record is changed.
Comments
Post a Comment