Approvals names before submitting OAF Custom page
Hi,
I have posted the below question in Workflow forums but i haven't received any answer so thought of posting it here. please read.
I have created a new workflow which is fired when a custom OAF page is submitted. This workflow is based on dynamic approvals and i have created this workflow without using AME. Now, how to display the list of approvers in the submit page? Please let me know.
Thanks
PK
How are you generating the approval list?
If you have sql query then create a view object using that sql query.
Create a table and associate it with the View object.
Initialize the query in the processRequest().
Now the approvers list would be displayed in the page.
--Prasanna
Similar Messages
-
SSO Validation from OAF custom page.
Hi All,
We have 11.5.10Cu2 configured with Single Sign On.
Both are running in different servers.
I have a custom OAF Page(Approval Page) from that page I want to validate
a Single Sign on user id.
ie, I don't want to set any session value or cookies just want to validate a SSO username from my OAF Controller or from my AMImpl.
Like giving a request to SSO Server with username/password and get true or false according to the validation and return to my custom page.
Thanks.
With Regards,
Kali.
OSSI.Yes Tapash,
Here is the sample code,
Spec:
CREATE OR REPLACE PACKAGE APPS.xxpo_oa_pdt_ordering_pkg AS
PROCEDURE authenticate_user
(p_username IN VARCHAR2
,p_password IN VARCHAR2
,p_validation_type IN VARCHAR2 DEFAULT 'SSO'-- FND or SSO
,p_check_approver IN VARCHAR2 DEFAULT 'Y'
,x_return_status IN OUT NOCOPY VARCHAR2
,x_msg_data IN OUT NOCOPY VARCHAR2
,x_msg_count IN OUT NOCOPY NUMBER
Body:
PROCEDURE authenticate_user
(p_username IN VARCHAR2
,p_password IN VARCHAR2
,p_validation_type IN VARCHAR2 DEFAULT 'SSO' -- FND or SSO
,p_check_approver IN VARCHAR2 DEFAULT 'Y'
,x_return_status IN OUT NOCOPY VARCHAR2
,x_msg_data IN OUT NOCOPY VARCHAR2
,x_msg_count IN OUT NOCOPY NUMBER
AS
l_return PLS_INTEGER;
ldap_host VARCHAR2(256);
ldap_port PLS_INTEGER;
ldap_user VARCHAR2(256);
ldap_passwd VARCHAR2(256);
ldap_base VARCHAR2(256);
retval PLS_INTEGER;
my_session DBMS_LDAP.SESSION;
subscriber_handle DBMS_LDAP_UTL.HANDLE;
sub_type PLS_INTEGER;
subscriber_id VARCHAR2(2000);
my_pset_coll DBMS_LDAP_UTL.PROPERTY_SET_COLLECTION;
my_property_names DBMS_LDAP.STRING_COLLECTION;
my_property_values DBMS_LDAP.STRING_COLLECTION;
user_handle DBMS_LDAP_UTL.HANDLE;
user_id VARCHAR2(2000);
user_type PLS_INTEGER;
user_password VARCHAR2(2000);
my_mod_pset DBMS_LDAP_UTL.MOD_PROPERTY_SET;
my_attrs DBMS_LDAP.STRING_COLLECTION;
user_dn VARCHAR2(256);
BEGIN
write_to_log(FND_LOG.LEVEL_PROCEDURE,'Start of authenticate_user');
write_to_log(FND_LOG.LEVEL_STATEMENT,'Parameters: p_username='||p_username||' p_validation_type='||p_validation_type||' p_check_approver= '||p_check_approver);
x_return_status := FND_API.G_RET_STS_SUCCESS;
x_msg_data := NULL;
x_msg_count:= NULL;
IF p_check_approver = 'Y' THEN
IF xxpo_oa_pdt_util_pkg.is_valid_approver(xxpo_oa_pdt_util_pkg.get_fnd_user_id(p_username)) <> 'Y' THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: User is not a valid approver.');
x_return_status := FND_API.G_RET_STS_ERROR;
x_msg_data := 'XXPO_OA_PDT_INVALID_APPR';
x_msg_count:= 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
END IF;
IF p_validation_type = 'FND' THEN
l_return := FND_SSO.authenticate_user
(p_user => p_username
,p_password => p_password
IF l_return <> 0 THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: Invalid FND user name and password.');
x_return_status := FND_API.G_RET_STS_ERROR;
x_msg_data := 'XXPO_OA_PDT_INVALID_USER';
x_msg_count:= 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
ELSE
--verify that the XXPO%LDAP% profiles are set
IF FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_HOST') IS NULL OR
FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_PORT') IS NULL OR
FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_ADMIN_USER') IS NULL OR
FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_ADMIN_PWD') IS NULL OR
FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_BASE') IS NULL OR
FND_PROFILE.VALUE('XXPO_OA_PDT_LDAP_USER_TYPE') IS NULL THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: One or more of XXPO%LDAP% Profiles are not set.');
x_msg_data := 'XXPO_OA_PDT_LDAP_PROF_MISSING';
x_msg_count := 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
-- Please customize the following variables as needed
ldap_user := gc_ldap_user;
ldap_passwd := gc_ldap_passwd;
sub_type := DBMS_LDAP_UTL.TYPE_DEFAULT;
subscriber_id := NULL;
user_type := gc_ldap_user_type;
user_id := p_username;
user_password := p_password;
-- Choosing exceptions to be raised by DBMS_LDAP library.
DBMS_LDAP.USE_EXCEPTION := TRUE;
write_to_log(FND_LOG.LEVEL_STATEMENT,'Input Parameters: ');
write_to_log(FND_LOG.LEVEL_STATEMENT,'LDAP HOST: ' || gc_ldap_host );
write_to_log(FND_LOG.LEVEL_STATEMENT,'LDAP PORT: ' || gc_ldap_port);
write_to_log(FND_LOG.LEVEL_STATEMENT,'LDAP BIND USER: ' || ldap_user);
write_to_log(FND_LOG.LEVEL_STATEMENT,'USER ID : ' || user_id);
write_to_log(FND_LOG.LEVEL_STATEMENT,'----------------------------------');
-- Connect to the LDAP server
-- and obtain and ld session.
write_to_log(FND_LOG.LEVEL_STATEMENT,'Connecting to ' || gc_ldap_host || ' ...');
my_session := DBMS_LDAP.init(gc_ldap_host, gc_ldap_port);
write_to_log(FND_LOG.LEVEL_STATEMENT,': Connected.');
-- Bind to the directory
write_to_log(FND_LOG.LEVEL_STATEMENT,'Binding to directory as ' || ldap_user || ' ... ');
retval := DBMS_LDAP.simple_bind_s(my_session, ldap_user, ldap_passwd);
write_to_log(FND_LOG.LEVEL_STATEMENT,': Successful.');
-- Create Subscriber Handle
write_to_log(FND_LOG.LEVEL_STATEMENT,'Creating Subscriber Handle ... ');
retval := DBMS_LDAP_UTL.create_subscriber_handle(subscriber_handle,
sub_type,
subscriber_id);
IF retval != DBMS_LDAP_UTL.SUCCESS THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: create_subscriber_handle returns : ' || TO_CHAR(retval));
x_msg_data := 'XXPO_OA_PDT_SUBS_HANDLE_ERROR';
x_msg_count:= 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
write_to_log(FND_LOG.LEVEL_STATEMENT,': Successful.');
-- Create User Handle
write_to_log(FND_LOG.LEVEL_STATEMENT,'Creating user handle for ' || user_id || ' ... ');
retval := DBMS_LDAP_UTL.create_user_handle(user_handle,user_type,user_id);
IF retval != DBMS_LDAP_UTL.SUCCESS THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: create_user_handle returns : ' || TO_CHAR(retval));
x_msg_data := 'XXPO_OA_PDT_USER_HANDLE_ERROR';
x_msg_count:= 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
write_to_log(FND_LOG.LEVEL_STATEMENT,': Successful.');
-- Set user handle properties
-- (link subscriber to user )
retval := DBMS_LDAP_UTL.set_user_handle_properties(user_handle,
DBMS_LDAP_UTL.SUBSCRIBER_HANDLE,
subscriber_handle);
IF retval != DBMS_LDAP_UTL.SUCCESS THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error: set_user_handle_properties returns : ' || TO_CHAR(retval));
x_msg_data := 'XXPO_OA_PDT_USER_SUBS_ERROR';
x_msg_count:= 1;
RAISE FND_API.G_EXC_ERROR;
END IF;
-- Authenticate User
write_to_log(FND_LOG.LEVEL_STATEMENT,'Authenticating user ' || user_id || ' ... ');
retval := DBMS_LDAP_UTL.authenticate_user(my_session,
user_handle,
DBMS_LDAP_UTL.AUTH_SIMPLE,
user_password,
NULL);
IF retval != DBMS_LDAP_UTL.SUCCESS THEN
-- Handle Errors
write_to_log(FND_LOG.LEVEL_ERROR,'Authentification error : ' || TO_CHAR(retval));
x_msg_data := 'XXPO_OA_PDT_INVALID_USER';
x_msg_count:= 1;
-- below only for debugging purpose
IF retval = -5 THEN
write_to_log(FND_LOG.LEVEL_ERROR,'User unknown');
ELSIF retval = -16 THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Incorrect password');
ELSIF retval = DBMS_LDAP_UTL.PARAM_ERROR THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Invalid input parameters.');
ELSIF retval = DBMS_LDAP_UTL.GENERAL_ERROR THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Authentication failed.');
ELSIF retval = DBMS_LDAP_UTL.NO_SUCH_USER THEN
write_to_log(FND_LOG.LEVEL_ERROR,'USER doesn''t exist.');
ELSIF retval = DBMS_LDAP_UTL.MULTIPLE_USER_ENTRIES THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Multiple NUMBER OF USER DN entries exist IN the DIRECTORY FOR the given USER.');
ELSIF retval = DBMS_LDAP_UTL.INVALID_SUBSCRIBER_ORCL_CTX THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Invalid Subscriber Oracle Context.');
ELSIF retval = DBMS_LDAP_UTL.NO_SUCH_SUBSCRIBER THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Subscriber doesn''t exist.');
ELSIF retval = DBMS_LDAP_UTL.MULTIPLE_SUBSCRIBER_ENTRIES THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Multiple NUMBER OF subscriber DN entries exist IN the DIRECTORY FOR the given subscriber.');
ELSIF retval = DBMS_LDAP_UTL.INVALID_ROOT_ORCL_CTX THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Invalid Root Oracle Context.');
ELSIF retval = DBMS_LDAP_UTL.AUTH_PASSWD_CHANGE_WARN THEN
write_to_log(FND_LOG.LEVEL_ERROR,'PASSWORD should be changed.');
ELSIF retval = DBMS_LDAP_UTL.ACCT_TOTALLY_LOCKED_EXCEPTION THEN
write_to_log(FND_LOG.LEVEL_ERROR,'USER account IS locked.');
ELSIF retval = DBMS_LDAP_UTL.PWD_EXPIRED_EXCEPTION THEN
write_to_log(FND_LOG.LEVEL_ERROR,'USER PASSWORD has expired.');
ELSIF retval = DBMS_LDAP_UTL.PWD_GRACELOGIN_WARN THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Grace login FOR USER.');
ELSE
write_to_log(FND_LOG.LEVEL_ERROR,'Authentification error : ' || TO_CHAR(retval));
END IF ;
RAISE FND_API.G_EXC_ERROR;
ELSE
write_to_log(FND_LOG.LEVEL_STATEMENT,'Authentication: Successful.');
END IF;
-- Free Mod Propertyset
DBMS_LDAP_UTL.free_mod_propertyset(my_mod_pset);
-- Free handles
DBMS_LDAP_UTL.free_handle(subscriber_handle);
DBMS_LDAP_UTL.free_handle(user_handle);
-- unbind from the directory
write_to_log(FND_LOG.LEVEL_STATEMENT,'Unbinding from directory ... ');
retval := DBMS_LDAP.unbind_s(my_session);
IF retval != DBMS_LDAP_UTL.SUCCESS THEN
write_to_log(FND_LOG.LEVEL_ERROR,'unbind_s returns : ' || TO_CHAR(retval));
x_msg_data := 'XXPO_OA_PDT_UNBIND_ERROR';
x_msg_count:= 1;
ELSE
write_to_log(FND_LOG.LEVEL_STATEMENT,': Successful.');
END IF;
write_to_log(FND_LOG.LEVEL_STATEMENT,'OK' ) ;
END IF;
write_to_log(FND_LOG.LEVEL_PROCEDURE,'End of authenticate_user');
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
x_return_status := FND_API.G_RET_STS_ERROR;
--message already set
WHEN OTHERS THEN
write_to_log(FND_LOG.LEVEL_ERROR,'Error code : ' || TO_CHAR(SQLCODE));
write_to_log(FND_LOG.LEVEL_ERROR,'Error Message : ' || SQLERRM);
write_to_log(FND_LOG.LEVEL_ERROR,'Exception encountered .. returning');
x_return_status := FND_API.G_RET_STS_ERROR;
x_msg_data := 'XXPO_OA_PDT_INVALID_USER';
x_msg_count:= 1;
END authenticate_user;
Hope this help others.
Thanks.
With Regards,
Kali.
OSSI. -
How to Register OAF Custom Page on oracle application.
can any one help me out in how to register OAF page in oracle application.
By using AOL u need to create a Function eg. TestFunc with type as SSWA... and attach the page path as OA.jsp?page=/compName/oracle/apps/per/ijp/webui/TestPG
After creating the function u need to create a menu and attach this TestFunc with the menu.. -
Custom control in custom page layout not getting shown
Hi,
I have created a site column for Date field:
<Field ID="{GUID}" Name="MyCustomPageLayoutDate" StaticName="MyCustomPageLayoutDate" Group="TestGroup" Type="DateTime" Format="DateOnly" DisplayName="Date" Required="FALSE" ><Field ID ="{guid}" Name ="MyCustomLayoutDateDisplay" DisplayName="Date Display"
Group="TestGroup"
Type="Calculated"
ResultType="Text"
ReadOnly="TRUE"
Required="FALSE">
<Formula>=TEXT([Date],"MMMM dd, yyyy")</Formula>
</Field>
This is added in the page layout content type:
<FieldRef ID="{guid}" Name="MyCustomPageLayoutDate" /> <FieldRef ID="{guid}" Name ="MyCustomLayoutDateDisplay" />
In the custom page layout, it is added as below:
<Publishing:EditModePanel ID="EditModePanel5" runat="server" CssClass="edit-mode-panel">
<tr>
<td>
Date
</td>
</tr>
</Publishing:EditModePanel>
<PublishingWebControls:EditModePanel ID="DateEditModePanel" runat="server" PageDisplayMode="Edit" SupressTag="True">
<tr>
<td >
<PageFieldDateTimeField:DateTimeField ID="DateTimeField1" FieldName="GUID" runat="server">
</PageFieldDateTimeField:DateTimeField>
</td>
</tr>
</PublishingWebControls:EditModePanel>
<PublishingWebControls:EditModePanel ID="DatePublishModePanel" PageDisplayMode="Display" runat="server">
<tr>
<td>
<SharePoint:CalculatedField ID="CalculatedDateField" FieldName="guid" runat="server" />
</td>
</tr>
</PublishingWebControls:EditModePanel>
In the edit mode, the date is getting shown, and I am able to select a date. When the page is published, the entered date is not getting displayed.
How to fix this?
ThanksHi,
I tried to reproduce this issue like this:
1. Create a DateTime site column “MyDateTimeCol01”;
2. Create a Calculated site column “MyCalculated03” with formula “=TEXT(MyDateTimeCol01,"MMMM dd, yyyy")”;
3. Create a Page Layout content type contains the two site columns above;
4. Create a Page Layout with the Page Layout content type, the source code of this page layout as below:
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Edit">
<SharePointWebControls:DateTimeField FieldName="9492c1ff-851f-4d1c-bcbf-5637b69ebd63" runat="server"> </SharePointWebControls:DateTimeField>
</PublishingWebControls:EditModePanel>
<br/>
<PublishingWebControls:EditModePanel runat=server id="EditModePanel2" PageDisplayMode="Display">
date time text:
<br/>
<SharePointWebControls:CalculatedField FieldName="9c00c4dc-6a53-4abd-9fa4-6b4dd266c898" runat="server"></SharePointWebControls:CalculatedField>
</PublishingWebControls:EditModePanel>
</asp:Content>
5. After that, create a publishing page with this custom page layout:
In Edit mode:
In Display mode:
I suggest you follow the steps above to make another test to see if the issue persists.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
OAF Tutorial Extension - To add Site Name in Purchase Order Summary Page
I have gone through all steps for adding Supplier Site Name for Purchase Order Summary Page. It works but seems it shows SiteID instead of Site Name.
The main instructions says
Step 2.3 Create Your New View Object (VO)
Make a copy the PoSummaryVO query statement before you begin creating your new VO. Expand the oracle.apps.fnd.framework.toolbox.tutorial.server package in the Navigator pane and edit PoSummaryVO. In the View Object Editor, select Query to display the query statement for this VO. Make a copy of the query statement.
Create a new VO, named <YourName>PoSummaryVO, that extends oracle.apps.fnd.framework.toolbox.tutorial.server.PoSummaryVO.
Create the VO in the <yourname>.oracle.apps.fnd.framework.toolbox.tutorial.server package.
Add the oracle.apps.fnd.framework.toolbox.schema.server.SupplierSiteEO entity object. Leave the Read Only and Reference checkboxes checked. We are going to use this entity object only for read-only purposes.
Add the SupplierSiteId and SiteName attributes from the SupplierSiteEO entity object.
Paste the query statement that you copied from PoSummaryVO into the query statement field for <YourName>PoSummaryVO. Now append the following SQL phrases to the copy of the PoSummaryVO query statement to compose the query statement for the <YourName>PoSummaryVO.
SELECT ...,
SupplierSiteEO.SUPPLIER_SITE_ID,
SupplierSiteEO.SITE_NAME
FROM ...,
FWK_TBX_SUPPLIER_SITES SupplierSiteEO
WHERE ...
AND SupplierEO.SUPPLIER_ID = SupplierSiteEO.SUPPLIER_ID
Step 2.8 Personalize the UI to Display Your New Attribute
Rebuild the ExtendLab project and make sure you have no errors.
Run the <Yourname>PoSummaryCreatePG.xml page with personalization turned on (see Personalizing Your Pages and Portlets for more information on how this is done).
Select the Personalize Page global link.
In the Choose Personalization Context page, select Page: <Yourname> Framework Toolbox Tutorial: Multistep Create from the Scope poplist and select the Apply button.
In the Personalize Page page, check the Complete View radio button for the Personalization Structure. Expand the Stack Layout: Purchase Order Summary Region node, locate the Table: Purchase Orders Table entry in the page hierarchy and select the Create Item icon.
In the Create Item page:
Set the Item Style to Message Styled Text.
Set the ID to SiteName.
Set the Prompt to Supplier Site
Set the View Attribute to SiteName
Set the View Instance to PoSummaryVO1
Select the Apply button
In the Personalize Page Hierarchy page, locate the Table: Purchase Orders Table entry again and select the Reorder icon.
In the Reorder Contents of Table page's Site list, move the Supplier Site item to be sequenced immediately after the Supplier item.
Select the Apply button.
In the Personalize Page Hierarchy page, select the Return to Application link. Now you should see the Supplier Site column added to the Orders Table as shown in Figure 1 (you should see your name in the page title).
Note: We set the View Instance to PoSummaryVO1 and not <YourName>PoSummaryVO1. The BC4J substitution will take care of properly creating an instance of <YourName>PoSummaryVO1 at runtime in place of the PoSummaryVO1.
It does not show site name, it shows site id after havig done personalization.
Any idea why it would show site id and not site name.
KDWhat I found is there are 2 variables SiteName and SiteName1, if you use SiteName1 then it shows proper value as a site description. I replaced SiteName with SiteName1 and it works. This might help to all who are like me and trying Tutorial example.
I am not sure how many may have tried OAF - Tutorial examples. They are really complicated and not easy and in most cases they are not coming out in first try but if you really try then it will give lot of understanding. -
Why doesn't default CREATE USER form show a "Check" Page before submitting
Hi
Interesting question.
When I create a User (using my Customized Create User Form), and I press SAVE, the Form is submitted immediately. There is no "stop-and-check" page, which allows one to review the entries made BEFORE submitting the form itself.
For example : when EDITING or UPDATING a User, and you press "Save", the form is not submitted right away. Instead, a new page opens, where you can review the changes you made, to ensure that they are correct. In fact, at the bottom of this new page, there are 4 standard buttons : SAVE...........RETURN TO EDIT............CANCEL
This is a very good system, because it allows you to check your entries, and make sure they are correct, before pressing SAVE again to submit.
However, the "Create User" form does not have this same arrangement.
Is there any way to customize the Form, so that, when creating a User, and you press SAVE, a "check-page" first shows up (just like when updating/editing a user) ?
ThanksHi
Interesting question.
When I create a User (using my Customized Create User Form), and I press SAVE, the Form is submitted immediately. There is no "stop-and-check" page, which allows one to review the entries made BEFORE submitting the form itself.
For example : when EDITING or UPDATING a User, and you press "Save", the form is not submitted right away. Instead, a new page opens, where you can review the changes you made, to ensure that they are correct. In fact, at the bottom of this new page, there are 4 standard buttons : SAVE...........RETURN TO EDIT............CANCEL
This is a very good system, because it allows you to check your entries, and make sure they are correct, before pressing SAVE again to submit.
However, the "Create User" form does not have this same arrangement.
Is there any way to customize the Form, so that, when creating a User, and you press SAVE, a "check-page" first shows up (just like when updating/editing a user) ?
Thanks -
SharePoint custom page it is asking login name and password
Hi Friends,
I have created custom pages in SharePoint 2013.When ever if I click any custom page it is asking login name and password every time.But for SharePoint admin page it is not asking every time login name and password.
How can we fix this issue.It is very urgent.Please can anyone help to fix this issue.
Thanks,
Tiru
TiruYes Inder is correct.
http://social.technet.microsoft.com/Forums/office/en-US/0e08f9cb-1939-428d-9194-d21975ef70d3/created-sharepoint-2010-custom-login-pagewindows-authentication-but-it-asks-me-for-credentials?forum=sharepointgeneralprevious
Use fiddler to check the root cause of the autentication issue.
Please remember to click 'Mark as Answer' on the answer if it helps you -
Custom page with internal id as parameters: convert to names
Hi,
I am new to OAFramework... just so that you know.
I have a custom page, called from a link on a notiification, which has a number of parameers coming in. These parameters are internal ids. Do I use validation view object to translate those id's into names and numbers? Or is that usually done via a different technique?
thanks
RonnyOk, here is what I did.
I have a number of internal id's coming in as parameter.
Created 2 VVO's.
- InvoiceDataVVO
- personDataVVO
Actually I created 3 VVO's, because I thought I would be able to use a VVO a second time for another translation but that seemed to be wrong thinking.
So, third VVO (which is identical to personDataVVO)
- ccPersonDataVVO
Connected them to the AM (NotifySupplierAM).
Created the initQuery method in the corresponding VVOImpl classes
public void initQuery(String PersonId)
setWhereClauseParams(null); // Always reset
setWhereClauseParam(0, PersonId);
executeQuery();
In the controller NotifySupplierCO I added the following in the processRequest
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
initMailData(pageContext, webBean);
code for initMailData
* Display the proper mailing info on the page
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void initMailData(OAPageContext pageContext, OAWebBean webBean)
Enumeration num = pageContext.getParameterNames();
Hashtable hm = new Hashtable();
while (num.hasMoreElements()) {
String element = num.nextElement().toString();
hm.put(element, pageContext.getParameter(element) );
String InvoiceId = hm.get("invoiceId").toString();
String VendorId = hm.get("vendorId").toString();
String AccountantUserId = hm.get("accountantUserId").toString();
String SenderUserId = hm.get("senderUserId").toString();
String RespId = hm.get("respId").toString();
String RespApplId = hm.get("respApplId").toString();
String OrgId = hm.get("orgId").toString();
System.out.println("InvoiceId : " + InvoiceId);
System.out.println("VendorId : " + VendorId);
System.out.println("AccountUserId : " + AccountantUserId);
System.out.println("SenderUserId : " + SenderUserId);
System.out.println("RespId : " + RespId);
System.out.println("RespApplId : " + RespApplId);
System.out.println("OrgId : " + OrgId);
// Translate the parameter values into names and stuff
OAApplicationModule am = pageContext.getApplicationModule(webBean);
Serializable[] parameters = { InvoiceId, AccountantUserId, SenderUserId };
am.invokeMethod("queryMailDataById", parameters);
// Put the values to the page fields (for the items which are not mapped
// to a VVO
OAMessageTextInputBean itemMailBodyTextBean = (OAMessageTextInputBean)webBean.findChildRecursive("MailBodyText");
OAMessageCheckBoxBean itemIncludeAttachmentBean = (OAMessageCheckBoxBean)webBean.findChildRecursive("IncludeAttachment");
itemMailBodyTextBean.setValue(pageContext,null);
itemIncludeAttachmentBean.setValue(pageContext, 'Y');
} // initMailData
This calls queryMailDataById in the AM, which looks like this.
* Translate the incoming id values into the nessecary data values
* to be displayed on the page
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void queryMailDataById( String InvoiceId
, String AccountantId
, String SenderId
InvoiceDataVVOImpl voInv = getInvoiceDataVVO1();
voInv.initQuery(InvoiceId);
personDataVVOImpl voSend = getpersonDataVVO1();
voSend.initQuery(SenderId);
ccPersonDataVVOImpl voAccount = getccPersonDataVVO1();
voAccount.initQuery(AccountantId);
The input fields on the page are mapped to the VVO's.
example:
View Instance: InvoiceDataVVO1
View Attribute: VendorEmail
That did the trick.
regards
Ronny
Edited by: Ronny Eelen on 11-Jul-2011 01:12 -
Unable to run existing custom page in OAF
Dear Friends ,
I have to develop one page as similar to a existing custom page.
First to run the existing custom page , I have down loaded all the files (custom folder ) from server to local directory ,and rebuilt...... still Iam not able to run the existing page .
Even I tried to run a NEW sample page (in the same directory ) , iam not able to run.
Can any one suggest in this.
let me know for any clarifications.
Thanks
AravindaHello Aravinda,
First of all, in order to run the custom pages in your local machine, you need to copy the xml files and .class files in your respective folder.
Then, the .class files of EO,VO ,Controller,etc should be decompiled and .java files should be generated. These files should be in your myprojects.
This is just the abstract view of what needs to be done.
For developing the OAF pages, I reccomend you to go through this following blog. Its really nice for a newbie..
https://blogs.oracle.com/prajkumar/entry/oaf_developer_guide
Thanks,
Yadnesh
(Hit Helpful or correct if you feel so.. It encourages user to participate) -
How to deploy a custom page using OAF
Hi,
I need to deploy a custom page using OAF
can anyone suggest me
Thanks in AdvanceHi,
you could try posting on the OA Framework forums:
OA Framework
Deployment is covered in the Oracle Application Framework Developer’s Guide Release 11.5.10 RUP4 which can be found on Metalink. See note 269138.1 which is the full PDF
Brenden -
Error while calling standards OAF page from Custom page
Hi,
Using personalization, from a custom page, I am trying to open a standard Iexpense page using the following inthe Destincation URI in messagestyledtext as
OA.jsp?OAFunc=OIEMAINPAGE&startFrom=ActiveSubmitted&ReportHeaderId=380705855&OIERefreshAM=Y
The original page has OA.jsp?OAFunc=OIEMAINPAGE&startFrom=ActiveSubmitted&ReportHeaderId={!ReportHeaderId}&OIERefreshAM=Y in the message styled text
But when click on this from the custom page, the page opens with tabbed regions above and then gives error as below. Please let me know how to resovle this issue.
Profiles 1) FND_VALIDATION_LEVEL and 2) FND_FUNCTION_VALIDATION_LEVEL are already set to None.
Error is:
Page Security cannot be asserted. The page has either expired or has been tampered. Please contact your System Administrator for help.
Thanks,
SrikanthHi,
R u still facing the issue?
If So can you please tell me:
Have u added your called function to the current user? That means by navigating to the responsibility you can access the same page directly, with out doing any transaction? If so then create your custom function with your required URL and attach to a menu ; then check if you are able to view that page from the menu navigation?If these thing is not working then I think you need to create a custom page that will extend the std region , that time hopefully it will work.
Please post your result/thought!!
Regards
Apurba K Saha -
Hi I am facing the three questions below.
1. How to use default RTE in custom page in Sharepoint hosted app.
I saw the article of Rich text Editor (ribbon based) in a webpart in SharePoint 2013 and tried it. But it did not work well. I guess it needs code-behind setting, however sharepoint hosted app does not support code-behind.
Does anybody know how to do this?
2. In above case, I placed the below code on custom page and tried to get the field's value when submit button was clicked.
<SharePoint:InputFormTextBox ID="rftDefaultValue"
RichText="true"
RichTextMode="FullHtml" runat="server"
TextMode="MultiLine" Rows="5">
</SharePoint:InputFormTextBox>
In debugger, the returned value was 'undefined'.
var note = $('#hogehoge').val();
Is it possible to get the RTE value? If yes, please let me know how to do this.
3. I need to submit the RTE value using REST call.
In this
article in MSDN, the item creation sample treats single line text field. Does anybody know the sample for RTE?Hi,
According to your description, you might want to use Rich Text Editor control in your SharePoint hosted app.
First of all, I would suggest you post one question in one thread to make it easier to be discussed, which would also help you get a quick solution.
Though we can add this control into a SharePoint hosted app, however, as we can’t add code behind for it, plus with the potential compatibility issues in different
browsers, I would suggest you use other JavaScript Rich Text Editor plugins instead.
Two JavaScript Rich Text Editor plugins for your reference:
http://quilljs.com/
http://nicedit.com/
If you want to submit the value of Rich Text Editor control to a SharePoint list using REST call, since the content in the Multiple Line of Text column is wrapped
with nested HTML tags, the similar requirement would also be applied to the content to be submitted.
Here is a code snippet about how to update a Multiple Line of Text column for your reference:
updateListItem(_spPageContextInfo.webAbsoluteUrl, "List018", 1);
function updateListItem(siteUrl, listName, itemId)
var itemType = GetItemTypeForListName(listName);
var item = {
"__metadata": { "type": itemType },
"MultiTextEnhanced": "<div><a href='http://bing.com/'>Bing</a><br></p></div>",
"Title": "123"
$.ajax({
url: siteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
console.log(data);
$.ajax({
url: data.d.__metadata.uri,
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(item),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "MERGE",
"If-Match": data.d.__metadata.etag
success: function (data) {
console.log(data);
error: function (data) {
console.log(data);
error: function (data) {
console.log(data);
// Getting the item type for the list
function GetItemTypeForListName(name)
return"SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support -
How to add a custom page in WF process?
Hi,
I have to add a custom page in a workflow process. The process is a copy of a seeded WF process.
There are 3-4 seeded pages in the process. Now I want to insert my page in between them.
Like you ppl know, this is how the seeded process works:
A function node is present and we can see "HR Activity Type" value in Node Attributes tab. This value will be present in regionMap.xml in PER_TOP/mds. This is how the page's path and node is mapped.
Similarly if I create a new node, how can I map my custom page. It wont be present in regionMap.xml
Regards,
Pradeep .Hi Pradeep,
I know its been a while since you had posted this, but I have a few questions. I am working on something very similar. I have created a custom OAF page that I would like to launch from HR Line Manager Self Service. When I followed your suggestion of "HR Activity Type" = Page, and "HR Activity Type value" = name the AOL registered function, it brings up a blank page for me. Any idea why that might be?
When the manager clicks the "Action" icon next to the selected employee, it starts the WF and my node is the first one in the WF process. But instead of showing my custom OAF page, it shows a blank page that reads "Create Process". Does it make any difference whether the node is inserted between existing nodes or if its the first one? Did you have to write anything in the processRequest of your CO ? I have not yet added the suggested wfaactivity call in my PFR, but since my page is not displaying in the first page, I figure the PFR logic doesn't matter at this point.
Can you share the exact values for your node attributes if you don't mind, and if there's anything specific to WF you had added in your PR of the CO?
Thanks in advance.
Sameer -
Problem deploying Custom Page to E-Business Server
Hi All,
We have the below setup:
- Single Instance of Oracle E-Business Suite 12.1.3 with Database 10.2.0.5 running on RHEL 5.
I have developed a custom page which has a "drop down box" with a few selections (type of the file) and a "file upload" item and tested it in JDeveloper (Patch# 9879989) and it works fine.
Now, I need to deploy and test it on the server and link it to a menu and a responsibility.
I am trying to understand how to use the Import tool (oracle.jrad.tools.xml.importer.XMLImporter) to deploy this simple page, but I am unable to set the parameters to correct values for import.bat file.
On my local PC, the directory structure is as follows:
Classes folder:
C:\SOFTWARE\ORACLE\JDEVOA\JDEVHOME\JDEV\MYCLASSES\
└───mycompany
└───oracle
└───apps
└───fnd
└───upload
└───webui
│ CustomAppModule.xml
│ CustomAppModuleImpl.class
│ CustomAppsListEO.xml
│ CustomAppsListEOImpl.class
│ CustomAppsListEOView.xml
│ CustomAppsListEOViewImpl.class
│ fndUploadPkg.xml
│ NjmcLobs.xml
│ NjmcLobsCollImpl.class
│ NjmcLobsImpl.class
│ NjmcLobsView.xml
│ NjmcLobsViewImpl.class
│ webui.xml
│ xxUploadPG.xml
│
├───common
│ bc4j.xcfg
│
└───webui
xxUploadCO.class
Projects folder
C:\SOFTWARE\ORACLE\JDEVOA\JDEVHOME\JDEV\myprojects
└───mycompany
└───oracle
└───apps
└───fnd
└───upload
└───webui
│ CustomAppModule.xml
│ CustomAppModuleImpl.java
│ CustomAppsListEO.xml
│ CustomAppsListEOImpl.java
│ CustomAppsListEOView.xml
│ CustomAppsListEOViewImpl.java
│ fndUploadPkg.xml
│ webui.xml
│ xxUploadPG.xml
│
├───common
│ bc4j.xcfg
│
└───webui
xxUploadCO.javaOn the server we have a custom application xxnjmc in $APPL_TOP folder
How do set the -rootdir, -rootPackage, and -mmddir parameters for the import.bat file?
I appreciate any comments.
Thanks,
SinanThanks, Prince,
I figured it all out. I did rename it as xxnjmc as you suggested:
Here are the steps I typed up for my own reference and just wanted to share:
DEPLOYING CUSTOM OAF Pages:
1. Zip "C:\Software\Oracle\JDEVOA\jdevhome\jdev\myclasses\xxxxxx" folder as xxxxxx.zip
2. Login to middle-tier server with applprod/password
3. Navigate to $JAVA_TOP
4. Upload xxxxxx.zip file into $JAVA_TOP and unzip
5. chmod -R 775 xxxxxx
6. Navigate to "/u0/oracle/prod/apps/apps_st/appl/xxxxxx/12.0.0/"
7. mkdir mds
8. Upload "C:\Software\Oracle\JDEVOA\jdevhome\jdev\myclasses\xxxxxx\oracle\apps\fnd\upload\webui" (with the webui folder) into "/u0/oracle/prod/apps/apps_st/appl/xxxxxx/12.0.0/mds"
9. chmod -R 775 /u0/oracle/prod/apps/apps_st/appl/xxxxxx/12.0.0/mds
10. On the local PC
cd C:\Software\Oracle\JDEVOA\jdevbin\oaext\bin>
import C:\Software\Oracle\JDEVOA\jdevhome\jdev\myprojects\xxxxxx\oracle\apps\fnd\upload\webui\xxUploadPG.xml -username APPS -password APPS -rootdir C:\Software\Oracle\JDEVOA\jdevhome\jdev\myprojects -dbconnection "(description = (address_list = (address = (community = tcp.world) (protocol = tcp)(host = 10.1.0.6)(port = 1521)))(connect_data = (sid = PROD)))"
BOUNCE APACHE
adapcctl.sh stop
adapcctl.sh start
11. Login to E-Business Suite with SYSADMIN/SYSADMIN user and "Application Developer" responsibility
12. Navigate to Application-> Function
13. Add xxxxxx_FILEUPLOAD function with the following values:
User Function Name: Company File Upload
Description : Company File Upload
In the Properties tab:
Type : SSWA jsp function
In the Web HTML tab:
HTML Call : OA.jsp?page=/xxxxxx/oracle/apps/fnd/upload/webui/xxUploadPG
14. Switch to System Administrator responsibility
Navigate to Application-> Menu
Query for the menu you want to add this function to
Add the following menu item:
Prompt: File Uploader
Function: Company File Upload
Description: Upload files for custom applications
Sinan -
Social comment control in custom page layout stucks at "Working" for read access users
Hi,
I created a custom page layout which is attched to my custom content type.
i have a custom field control which is derived from RichImageField.
i have also added a social comment control to the page layout using
<SharePointPortalControls:SocialCommentControl ID="SocialCommentControl1" runat="server" />.
Now the problem is, an user who have read access for a pages library should post comments. but its not working and when the user clicks post button it stucks at working. but when the user is given contribute access then it works and the comments are posted.
And one more thing is if i remove my custom field control from the page layout, then user with read access can post the comment without any issues.
i am sure the issue is caused by my custom field control but dont know how to solve it. i dont want to give contribute access to the users as they can edit the content of the page also. Any help would be appreciated.
This is the custom field control code.
public class mycompanyRichImageField : RichImageField
public static string webimage = null;
#region Private variables
/// <summary>
/// File upload control used to upload image.
/// </summary>
private FileUpload fileUpload;
/// <summary>
/// Upload button.
/// </summary>
private Button btnSave;
/// <summary>
/// Delete button.
/// </summary>
private Button btnClear;
/// <summary>
/// Article image.
/// </summary>
private Image imgPicture;
/// <summary>
/// Image width.
/// </summary>
private DropDownList ddlWidth;
/// <summary>
/// Temporary store image url.
/// </summary>
private Label lblFileName;
/// <summary>
/// Image text.
/// </summary>
private TextBox txtImage;
/// <summary>
/// Value of image field.
/// </summary>
private ImageFieldValue pageImage;
/// <summary>
/// List item - current article.
/// </summary>
private SPListItem ArticlePage = SPContext.Current.ListItem;
/// <summary>
/// The first image width dropdown list options, default value 240 px.
/// </summary>
// private int imageWidthWide = 400;
//private int height = 225;
/// <summary>
/// The second image width dropdown list options, default value 120 px.
/// </summary>
private int imageWidthNarrow = 126;
/// <summary>
/// Picture library to store the image files.
/// </summary>
private string imageLibrary = "Images";
/// <summary>
/// List field to store Article image.
/// </summary>
private string imageField = "Page Image";
/// <summary>
/// List field to store image text.
/// </summary>
private string imageTextField = "Image Text";
private string preview = "Preview";
/// <summary>
/// List field to store rollup image.
/// </summary>
private string rollupImageField = "Rollup Image";
/// <summary>
/// Whether to update the rollup image using the current image.
/// </summary>
private bool updateRollupImage = false;
/// <summary>
/// Whether to display image text.
/// </summary>
private bool enableImageText = true;
#endregion
#region Properties
/// <summary>
/// Gets or sets the first choice of image width.
/// </summary>
//public int ImageWidthWide
// get
// return this.imageWidthWide;
// set
// this.imageWidthWide = value;
//public int ImageHeight
// get
// return this.height;
// set
// this.height = value;
/// <summary>
/// Gets or sets the second choice of image width.
/// </summary>
public int ImageWidthNarrow
get
return this.imageWidthNarrow;
set
this.imageWidthNarrow = value;
/// <summary>
/// Gets or sets the name of the picture library that is used to store image files.
/// </summary>
public string ImageLibrary
get
return this.imageLibrary;
set
this.imageLibrary = value;
/// <summary>
/// Gets or sets the field name of image.
/// </summary>
public string ImageField
get
return this.imageField;
set
this.imageField = value;
/// <summary>
/// Gets or sets the field name of image text.
/// </summary>
public string ImageTextField
get
return this.imageTextField;
set
this.imageTextField = value;
/// <summary>
/// Gets or sets the field name of rollup image.
/// </summary>
public string RollupImageField
get
return this.rollupImageField;
set
this.rollupImageField = value;
public string Preview
get
return this.preview;
set
this.preview = value;
/// <summary>
/// Gets or sets a value indicating whether to update rollup image using current image.
/// </summary>
public bool UpdateRollupImage
get
return this.updateRollupImage;
set
this.updateRollupImage = value;
/// <summary>
/// Gets or sets a value indicating whether the image text should be displayed.
/// </summary>
public bool EnableImageText
get
return this.enableImageText;
set
this.enableImageText = value;
#endregion
#region Override methods
/// <summary>
/// Using get method instead of set method to set the value.
/// set method cannot be used here.
/// </summary>
public override object Value
get
ImageFieldValue value = new ImageFieldValue();
value.ImageUrl = string.IsNullOrEmpty(this.lblFileName.Text) ? this.imgPicture.ImageUrl : this.lblFileName.Text;
// value.Width = string.IsNullOrEmpty(this.ddlWidth.Text) ? this.ImageWidthWide : Convert.ToInt32(this.ddlWidth.Text);
// value.Height = this.ImageHeight;
////update the page rollup image.
if (this.UpdateRollupImage)
this.ArticlePage[this.RollupImageField] = value;
if (this.EnableImageText)
this.ArticlePage[this.ImageTextField] = this.txtImage.Text;
this.ArticlePage.SystemUpdate(false);
return value;
set
base.Value = value;
/// <summary>
/// Intialize all controls.
/// </summary>
protected override void CreateChildControls()
this.pageImage = (ImageFieldValue)this.ArticlePage[this.imageField];
this.ddlWidth = new DropDownList();
this.ddlWidth.Width = 99;
// this.ddlWidth.Items.Add(this.ImageWidthWide.ToString());
this.ddlWidth.Items.Add(this.ImageWidthNarrow.ToString());
if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
// if (this.pageImage.Width >= this.ImageWidthWide)
// // this.ddlWidth.SelectedIndex = 0;
//else
// // this.ddlWidth.SelectedIndex = 1;
// this.Controls.Add(this.ddlWidth);
this.imgPicture = new Image();
if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
this.imgPicture.ImageUrl = SPContext.Current.Site.Url + this.pageImage.ImageUrl;
this.Controls.Add(this.imgPicture);
this.fileUpload = new FileUpload();
this.fileUpload.Width = 180;
this.Controls.Add(this.fileUpload);
this.btnSave = new Button();
this.btnSave.Text = "Upload";
this.btnSave.CausesValidation = false;
this.btnSave.Visible = string.IsNullOrEmpty(this.imgPicture.ImageUrl) ? true : false;
this.Controls.Add(this.btnSave);
this.btnSave.Click += new EventHandler(this.BtnSave_Click);
this.btnClear = new Button();
this.btnClear.Text = "Delete";
this.btnClear.CausesValidation = false;
this.btnClear.Visible = !this.btnSave.Visible;
this.Controls.Add(this.btnClear);
this.btnClear.Click += new EventHandler(this.BtnClear_Click);
this.lblFileName = new Label();
this.Controls.Add(this.lblFileName);
if (this.EnableImageText)
this.txtImage = new TextBox();
this.txtImage.TextMode = TextBoxMode.MultiLine;
this.txtImage.Rows = 4;
this.txtImage.Text = this.ArticlePage[this.ImageTextField] == null ? string.Empty : this.ArticlePage[this.ImageTextField].ToString();
this.Controls.Add(this.txtImage);
/// <summary>
/// Render the field in page edit mode.
/// </summary>
/// <param name="output">Output stream.</param>
protected override void RenderFieldForInput(System.Web.UI.HtmlTextWriter output)
output.Write("<div style='padding-bottom:12px'>");
if (!string.IsNullOrEmpty(this.imgPicture.ImageUrl))
output.Write("<br />");
// this.imgPicture.Width = ((ImageFieldValue)this.Value).Width;
// this.imgPicture.Height = ((ImageFieldValue)this.Value).Height;
this.imgPicture.RenderControl(output);
if (this.EnableImageText)
this.txtImage.Width = this.imgPicture.Width;
if (this.EnableImageText)
output.Write("<br />");
this.txtImage.RenderControl(output);
output.Write("<br /><br />");
this.fileUpload.RenderControl(output);
this.btnSave.RenderControl(output);
this.btnClear.RenderControl(output);
output.Write("<br /><br />");
//output.Write("Width:");
//this.ddlWidth.RenderControl(output);
output.Write("</div>");
/// <summary>
/// Render the field in page display mode.
/// </summary>
/// <param name="output">Output stream.</param>
protected override void RenderFieldForDisplay(System.Web.UI.HtmlTextWriter output)
if (this.ListItemFieldValue != null)
output.Write("<div style='padding-bottom:12px'>");
base.RenderFieldForDisplay(output);
if (this.EnableImageText && this.ArticlePage[this.ImageField] != null
&& this.ArticlePage[this.ImageTextField] != null)
//string strImgWidth = string.IsNullOrEmpty(this.ddlWidth.Text) ? this.ImageWidthWide.ToString() : this.ddlWidth.Text;
//string strImgHgt = this.ImageHeight.ToString();
output.Write("<div style='width:");
// output.Write(strImgWidth);
// output.Write(this.imgPicture.ImageUrl);
// output.Write("<div style='height:");
// output.Write(strImgHgt);
output.Write(";margin-right:4px;' align='left'>");
output.Write(this.ArticlePage[this.ImageTextField].ToString());
output.Write("</div>");
output.Write("</div>");
#endregion
#region Button events
/// <summary>
/// Delete image file from the library and empty the image field.
/// </summary>
/// <param name="sender">Delete button.</param>
/// <param name="e">No arguments.</param>
protected void BtnClear_Click(object sender, EventArgs e)
////remove the image file from the Images library
using (SPSite site = new SPSite(
SPContext.Current.Web.Url,
SpSecurityHelper.GetSystemToken(SPContext.Current.Site)))
using (SPWeb currentWeb = site.OpenWeb())
SPDocumentLibrary imageList = (SPDocumentLibrary)currentWeb.Lists[this.ImageLibrary];
SPFolder rootFolder = imageList.RootFolder;
try
currentWeb.AllowUnsafeUpdates = true;
rootFolder.Files.Delete(this.imgPicture.ImageUrl);
rootFolder.Update();
catch
////cannot delete specified file, this means file doesn't exist, the file must be deleted
////directly in the Images library by someone
////don't do anything here
finally
currentWeb.AllowUnsafeUpdates = false;
if (this.pageImage != null)
this.pageImage.ImageUrl = string.Empty;
this.imgPicture.ImageUrl = string.Empty;
this.lblFileName.Text = string.Empty;
this.btnClear.Visible = false;
this.btnSave.Visible = true;
/// <summary>
/// Upload image file to library and fullfilled the image field.
/// </summary>
/// <param name="sender">Upload button.</param>
/// <param name="e">No argument.</param>
protected void BtnSave_Click(object sender, EventArgs e)
this.ArticlePage[this.ImageTextField] = this.txtImage.Text;
this.ArticlePage.SystemUpdate(false);
string fileName = this.fileUpload.FileName;
////validate file name
if (fileName == string.Empty || !this.fileUpload.HasFile)
this.lblFileName.Text = string.Empty;
if (this.pageImage == null)
this.Page.ClientScript.RegisterStartupScript(typeof(string), "NoImage", "<script>alert('No image found, please select an image.')</script>", false);
else
using (SPSite site = new SPSite(
SPContext.Current.Web.Url,
SpSecurityHelper.GetSystemToken(SPContext.Current.Site)))
using (SPWeb currentWeb = site.OpenWeb())
SPDocumentLibrary imageList = (SPDocumentLibrary)currentWeb.Lists[this.ImageLibrary]; ////Images
SPFolder rootFolder = imageList.RootFolder;
////the image file name must be unique except for the file name extension
string imageName = this.ArticlePage.UniqueId.ToString("N") + this.FieldName + Path.GetExtension(fileName);
////first delete the image file from the Images library.
////if a file with different file name extension is uploaded, the old file won't be overwritten,
////and will never be deleted from this page, so it must be deleted before adding a new one.
if (this.pageImage != null && !string.IsNullOrEmpty(this.pageImage.ImageUrl))
try
currentWeb.AllowUnsafeUpdates = true;
rootFolder.Files.Delete(this.pageImage.ImageUrl);
rootFolder.Update();
catch
////cannot delete specified file, this means file doesn't exist, the file must be deleted
////directly in the Images library by someone
finally
currentWeb.AllowUnsafeUpdates = false;
try
currentWeb.AllowUnsafeUpdates = true;
SPFile imageFile = rootFolder.Files.Add(imageName, this.fileUpload.FileBytes, true);
finally
currentWeb.AllowUnsafeUpdates = false;
// this.lblFileName.Text = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/" + imageName;
this.lblFileName.Text = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/_w/" + imageName.Substring(0, imageName.LastIndexOf(".")) + "_" + imageName.Substring(imageName.IndexOf(".") + 1) + "." + imageName.Substring(imageName.IndexOf(".") + 1);
// webimage = currentWeb.Site.Url + imageList.RootFolder.ServerRelativeUrl + "/_w/" + imageName.Substring(0,imageName.LastIndexOf("."))+"_"+imageName.Substring(imageName.IndexOf(".")+1) +"." + imageName.Substring(imageName.IndexOf(".")+1);
this.imgPicture.ImageUrl = this.lblFileName.Text;
this.btnClear.Visible = true;
this.btnSave.Visible = false;
#endregion
This is how i used it in my page layout
<Article:mycompnayRichImageField runat="server" ID="RichImageField1" InputFieldLabel="Keep image text short and precise" FieldName="PublishingPageImage" UpdateRollupImage="true"/>
ArunaHi,
For this issue, I'm trying to involve someone familiar with this topic to further look at it.
Thanks,
Jason Guo
TechNet Community Support
Maybe you are looking for
-
Handling VI templates with executables (after Application Builder)
I've got an application in which I dynamically open a *.vit (VI template). I can open several instances of a user-configurable graph. It works great when running in the Labview environment, but when I create an executable... it doesn't work. Is there
-
UIX Submit Validation - Internal Server Error
My UIX page (lean test page) contains the following code: <contents> <form name="test"> <contents> <textInput text="Norbert" name="Norbert" > <onSubmitValidater> <regExp pattern="Norbert" /> </onSubmitValidater> </textInput> <submitButton text="Submi
-
Can I use Apple StyleWriter with OS X
After getting good input from the board, I installed OSX and am now learning to use it. With OS 9.2.2 I used two printers, the Apple StyleWriter 2500 and the EPSON 777. I would like to continue using the Apple StyleWriter with OSX, but don't know how
-
I cant send messages just to one number
Hi, I can't send a sms, mms or imessage to one number only (my partner...no she has not blocked me). Not sure what to do....she is using my old iphon 4s that has been linked to my apple id in past... i have create an separate account for her now... A
-
Input Help Frame too Narrow in WAD
Hi everyone, We have a problem with some of our Web Applications. When we want to select values by using the input help in the variable screen, we can't see the values we have selected at the right side of the selector screen because the frame is ver