how to pass login credentials between pages in oracle apex? - oracle-apex

I am creating a banking application using oracle apex. once the user have logged in using his customer id in page 2, his account details table should be displayed in the next page. I've tried with
select acc_no, bal from acc_details where cust_id= :P2_USERNAME
but I'm getting 'NO DATA FOUND'.
is this the correct way to do this? I've tried to use branches too. That was also not working.

On your first page, under the "Behavior"(APEX 5)/"Action When Button Clicked"(APEX 4) attribute of your log in button set "Action" to "Redirect to page in this Application". Then set the Target page number. Under that, you'll see the 'Set Items' part. Fill up that part by setting the "Name"(APEX 5) / "Set these Items"(APEX 4) with :P2_USERNAME and then "Value"(APEX 5)/ "With these Values"(APEX 4) with :P1_USERNAME. Get rid of the "branches" that you've created before or disable them at least for now.

if your user login name and userid is same (like email address)
you may use
apex_authentication.get_login_username_cookie
for getting username/user id at each page
or you can create an application item in shared component and assign user id to this item as
:MY_APP_ITEM := 'Hello';
after login and call it from all pages

Have you tried using :APP_USER? If that didn't work you could try creating an Application item as a value container for your cust_id. Just go to Shared Components >> Application Items then create an item. This way you could reuse the value on the application item until your session expire or you clear its value.
Say you've created an Application Item named "G_CUST_ID", you want to store your cust_id's value to G_CUST_ID. Create a PL/SQL process on your log in page and write the code below:
apex_util.set_session_state('G_CUST_ID', :P2_USERNAME);
The value set on G_CUST_ID will reset automatically on session expire. Don't forget to reset the value manually on Log Out.
apex_util.set_session_state('G_CUST_ID', NULL);

Related

Apex Oracle : How to refresh Page Item?

I have a page Item on Apex 19.2
In page validation where i'm setting the value of the item : P1_MyItem. The value is set properly in session state. However it's not reflected immedialy in the html item. I still need to reload the page to get the right value in the item.
Is there any way to reflect it immediatly please ? (without reloading the page)
Thanks.
Cheers,
You need to ensure Items to Return lists any item that is updated within the PL/SQL, that you would also like updated within the web page once the dynamic action is completed.
As opposed to 'Items to Submit', which sends any information in pages items the browser is aware of to the database, before execution of the PL/SQL block.
Page processing now defaults to using Ajax. So, if a validation error occurs, the page is no longer re-rendered by default because the assumption is that validations will not change session state. If you want to see your changes, you'll need to locate the page property named Reload on Submit and set that to Always.
But, of course, that means the page will be re-rendered/re-loaded which is what you're trying to avoid.
Also, it's not possible to set the page property to Reload on Submit if you want to use an Interactive Grid on the same page. It requires the option Only for Success, so you have to refresh the page item somehow else.

Will this cookie track what visitors do after they have clicked on a rep url? The pages they go to, until they leave the site?

As I have no idea of code, html or the programs I am using, I would like to know if this cookie will work the way I want it to.
I would like to know what pages the user visits in the session after he/she has arrived to the website via the url containing: repid.
I have a custom html tag that I have set up in Google tag Manager and the code is:
<script>
var cookieName = "RepUrl";
var cookieValue = "true";
setPersistentCookie(cookieName, cookieValue, 365); // set for 1 year
</script>
The Trigger Type is Page View, Some Page Views, Page Url, Contains, repid
I then went to google analytics and created a Custom Dimension called Rep Url the scope was Session.
After this I go back to google tag manager and create a variable called: Cookie-Page..., Variable type: 1st party cookie and linked to the cookieName: RepUrl (as in the above code).
Then I make another tag, this time it is a google analytics tag type, track type: page view. I then enable overriding settings in this tag and enter my google analytics id UA-xxxxxxxxx-x . I go to more settings, custom dimensions and enter the index number of the custom dimension I created in google analytics and in the dimension value, I enter the variable I created in tag manager called: Cookie-Page...
After all this I then went to customization, custom reports in analytics created one for the custom dimension (Rep Url) with added filters: Sessions, Avg. Session duration, Entrances/Pageviews, Pages/Session, Users.
I would like to know from start to end if this cookie will work the way I would like it to. All help would be greatly appreciated!
The GTM/GA setup will work, but you might not get the results that you were hoping for in the custom reports.
One reason is that you're setting the cookie once the user, enters the site and arrives at the page with RepUrl, but by that time, the hit for the page view would already be sent to GA thus not capturing into the custom dimension until subsequent hits. This would throw off the sessions, entrances metric in the custom reports.
You could consider looking into creating a custom segment that isolates sessions with the parameter "repurl". This would work if repurl would always be how the user enters the site/starts the session.
Another solution would be to abandon the javascript for setting the cookie, but instead, user the URL variable in GTM and capture the RepUrl parameter that way and set it on pageview.

Resubmit form error

I made a JSF web application. It was generated in netbeans ide.
To prevent pages being unresponsive I've set pages to auto-refresh in a set time interval.
I have a list page like this
List of records
And I can create a record like this
create a record
Say, I have set auto-refresh to every 30 seconds. I create a new record and return to list page. After 30 seconds it will give me this error: "Resubmit form? To refresh this page, your browser needs to repeat any actions you've already taken. For example, if you've already entered info into a form, your info will be resubmitted to the site".
This only happens if I access from another computer. From localhost it just redirects to list page without error popping up.
It seems like when I click to load create page, this action is remembered and when list page is refreshed it refreshes the create page.
I fixed it by redirecting to index after submitting.
FacesContext.getCurrentInstance().getExternalContext().redirect("../../faces/index.xhtml");

Ref to FSP_AFTER_LOGIN_URL causes ora-01422

Oracle Apex 4.2.5, Oracle 12c database issue. The Oracle Apex application I'm working on is a single workspace with two parsing schemas. The main back office application is made up of a number of workspaces parsed by one schema.
The application having the error is parsed by the second schema, consisting of 3 applications (12000, 12001, 12006) and is used for internet facing pages. One application contains common pages to handle security, login and dashboard page and the other contain the product specific pages.
Navigating from the dashboard page to a product specific page will display the generic login page on the first attempt. The login page url has FSP_AFTER_LOGIN_URL set to the f?p=APP:PAGE of the page to be navigated to. On successful login the ora-1422 exact fetch returns more than requested number of rowserror is . Switching on and checking the debug shows the error is being thrown by the v function.
Looking in wwv_flow_data I can see 3 rows for FSP_AFTER_LOGIN_URL
"FLOW_INSTANCE" "ITEM_ID" "ITEM_FILTER" "SESSION_STATE_STATUS" "FLOW_ID"
11304209855061 -162893176 "N" "I" "FSP_AFTER_LOGIN_URL" "N"
11304209855061 -162893176 "N" "I" "FSP_AFTER_LOGIN_URL" "N"
11304209855061 1456968448934338870 "N" "I" 12000 "FSP_AFTER_LOGIN_URL" "N"
FSP_AFTER_LOGIN_URL is an application item in each of the applications. All have scope set to APP. Session State protection had been set but switching off has intermittent results.
FSP_AFTER_LOGIN_URL is an application item used internally by Apex. Apex automatically adds this item to each apex application.
Setting the value in FSP_AFTER_LOGIN_URL to a target page allows the developer to define which page to redirect the user to once they have been authenticated by a login page. See https://community.oracle.com/message/10271816?#38;#10269816
v is an Oracle Apex supplied function to return the value of an item for the session the page is currently in. Buried deep in the Oracle code is a SELECT INTO statement,
SELECT D.ITEM_VALUE_CLOB,
D.ITEM_VALUE_VC2
INTO L_VALUE_CLOB,
L_VALUE_VC2
FROM WWV_FLOW_DATA D,
WWV_FLOW_SESSIONS$ S
WHERE D.FLOW_INSTANCE = S.ID
AND D.FLOW_INSTANCE = NVL(P_SESSION_ID,WWV_FLOW_SECURITY.G_INSTANCE)
AND D.ITEM_ID = C_ITEM_ID -- GET_GLOBAL_ITEM_ID(P_ITEM_NAME)
AND D.ITEM_NAME = P_ITEM_NAME -- FSP_AFTER_LOGIN_URL
AND S.SECURITY_GROUP_ID = WWV_FLOW_SECURITY.G_SECURITY_GROUP_ID;
The query will return more than one row in if the data above exists in WWV_FLOW_DATA because it does not consider the FLOW_ID.
As this is Oracle internals there's not much I can do. Other customers who use the software do not have any problems. Is there an Apex setting that is causing this problem for this particular customer?
What setting is allowing the 2 rows with item_id=-162893176 and flow_id=null to be created?
What is the purpose of them?
How do I workaround this issue?
Other customers who use the software do not have any problems. Is there an Apex setting that is causing this problem for this particular customer?

Populate current user display name in a text box in SharePoint 2013

I have created one custom list and customize it using Info path 2013.I have created data connection using User profile service UserprofileByName.I added one text box in which i want show the current user's display name(e.g. Das, Aditi).The name should populate when user open the form in SharePoint 2013.So I set the default vale of text box as "Value(Name=PreferredName)".
But this is not working.
Please help me to configure out this.
Thanks
You can find good step by step instruction how to achieve this on MSDN (Including User Information section).
One possible reason why your current code does not work could be that you didn't put "Automatically retrieve data when form is opened" in data connection to user profile service. Id you don't put it then you need to add additional rule to FormLoad event to query service.