I know it is possible to send mail through oracle apex using apex mail with an attachment with the following code -
DECLARE
l_id NUMBER;
BEGIN
l_id := APEX_MAIL.SEND(
p_to => 'fred#flintstone.com',
p_from => 'barney#rubble.com',
p_subj => 'APEX_MAIL with attachment',
p_body => 'Please review the attachment.',
p_body_html => '<b>Please</b> review the attachment');
FOR c1 IN (SELECT filename, blob_content, mime_type
FROM APEX_APPLICATION_FILES
WHERE ID IN (123,456)) LOOP
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => c1.blob_content,
p_filename => c1.filename,
p_mime_type => c1.mime_type);
END LOOP;
COMMIT;
END;
/
but ,I want to attach a file on the disk(OS) to a mail sent through oracle apex instead of blob content
p_attachment => c1.blob_content,
i.e., i want to attach a file for example D:\sample.pdf as attachment in the mail.
I want to know if it is possible and if possible then how?
I got the answer from my post here
I sent the mail using the below method
DECLARE
l_id NUMBER;
l_bfile BFILE;
l_blob BLOB;
BEGIN
DBMS_LOB.createtemporary(l_blob, TRUE); -- Initialize the BLOB.
l_bfile := BFILENAME('TEST', 'test.pdf');
DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
l_id := APEX_MAIL.SEND(
p_to => 'account#host.com',
p_from => 'account#host.com',
p_subj => 'APEX_MAIL with attachment',
p_body => 'Please review the attachment.',
p_body_html => '<b>Please</b> review the attachment');
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => l_blob,
p_filename => 'test.pdf',
p_mime_type => 'application/pdf');
DBMS_LOB.fileclose(l_bfile);
DBMS_LOB.freetemporary(l_blob);
COMMIT;
END;
Related
I want to create a user in apex from db(in oracle).
this is my code:
declare
l_workspace_id number;
l_group_id number;
begin
l_workspace_id := apex_util.find_security_group_id('MS');
apex_util.set_security_group_id(l_workspace_id);
l_group_id := apex_util.get_group_id('Developer');
apex_util.create_user(p_user_name => 'MS',
p_first_name => 'Mona',
p_last_name => 'Sh',
p_email_address => 'ms#...',
p_group_ids => l_group_id,
p_web_password => 'MS',
p_default_schema => 'MS',
p_change_password_on_first_use => 'N');
end;
It runs successfully, but I cant see the user in apex application in web.(workspace name, schema name and username are MS)
what is problem?
By default all successfull request on ORDS respond with status code 200 Ok. it is well.
But on occassion I need respond with on customizable error code, ie. 201 , 202 etc.
Are there any mode to respond a customizable error code on ORDS on PUT request?
regards
Pedro
Yes, absolutely.
Simply add a parameter called X-ORDS-STATUS-CODE, and assign it to a :bind, that you have as an OUT RESPONSE HEADER, of type INTEGER.
Then in your POST or PUT handler code, assign the status code you want.
:status := 201;
So...
Here's the full module export -
-- Generated by Oracle SQL Developer REST Data Services 20.2.0.147.0319
-- Exported REST Definitions from ORDS Schema Version 20.2.0.r1611903
-- Schema: HR Date: Mon Jun 22 16:41:15 EDT 2020
--
BEGIN
ORDS.DEFINE_MODULE(
p_module_name => 'status',
p_base_path => '/status/',
p_items_per_page => 25,
p_status => 'PUBLISHED',
p_comments => NULL);
ORDS.DEFINE_TEMPLATE(
p_module_name => 'status',
p_pattern => '201',
p_priority => 0,
p_etag_type => 'HASH',
p_etag_query => NULL,
p_comments => NULL);
ORDS.DEFINE_HANDLER(
p_module_name => 'status',
p_pattern => '201',
p_method => 'POST',
p_source_type => 'plsql/block',
p_items_per_page => 0,
p_mimes_allowed => '',
p_comments => NULL,
p_source =>
'declare
new_record integer;
begin
insert into demo201 (column2) values (:words) returning column1 into new_record;
commit;
:status := 201;
end;'
);
ORDS.DEFINE_PARAMETER(
p_module_name => 'status',
p_pattern => '201',
p_method => 'POST',
p_name => 'X-ORDS-STATUS-CODE',
p_bind_variable_name => 'status',
p_source_type => 'HEADER',
p_param_type => 'INT',
p_access_method => 'OUT',
p_comments => NULL);
COMMIT;
END;
Here's a somewhat better example where I've caught my exception and set the HTTP Response Status code to '400'
Is there a limitation on the Oracle APEX ords template?
Currently mapping a GET Request to
Works : URI Template: /history/{PLATAFORM}/{CONTEXT}/{APPLICAT}/
Works : URI Template: /history/{PLATAFORM}/{CONTEXT}/{APPLICAT}/test/
405 Method Not Allowed: URI Template: /history/{PLATAFORM}/{CONTEXT}/{APPLICAT}/{test}/
Can't find documentation about this scenario, wonder if it's Oracle APEX limitation/Bug? Or Maybe some configuration somewhere?
Any help would be appreciated,
Regards.
No limitations other than please switch to using : syntax over {}. We changed that a while back.
-- Generated by Oracle SQL Developer REST Data Services 18.1.0.051.1417
-- Exported REST Definitions from ORDS Schema Version 17.4.0.18.13.50
-- Schema: KLRICE Date: Tue Apr 03 15:03:00 EDT 2018
--
BEGIN
ORDS.ENABLE_SCHEMA(
p_enabled => TRUE,
p_schema => 'KLRICE',
p_url_mapping_type => 'BASE_PATH',
p_url_mapping_pattern => 'klrice',
p_auto_rest_auth => FALSE);
ORDS.DEFINE_MODULE(
p_module_name => '/history/',
p_base_path => '/history/',
p_items_per_page => 25,
p_status => 'PUBLISHED',
p_comments => NULL);
ORDS.DEFINE_TEMPLATE(
p_module_name => '/history/',
p_pattern => ':PLATFORM/:CONTEXT/:APPLICAT/test',
p_priority => 0,
p_etag_type => 'HASH',
p_etag_query => NULL,
p_comments => NULL);
ORDS.DEFINE_HANDLER(
p_module_name => '/history/',
p_pattern => ':PLATFORM/:CONTEXT/:APPLICAT/test',
p_method => 'GET',
p_source_type => 'json/collection',
p_items_per_page => 25,
p_mimes_allowed => '',
p_comments => NULL,
p_source =>
'select :PLATFORM,:CONTEXT,:APPLICAT from dual'
);
COMMIT;
END;
I am trying to use query string structure in drupal services API. it's not working for me.
I have also search most of the solutions, but all failed.
here is m drupal code:
function rapid_services_resources() {
$resources = array(
'get_data' => array(
'operations' => array(
'retrieve' => array(
'help' => t('Gets user email of uid passed.'),
'callback' => 'my_module_get_user_email',
'args' => array(
array(
'name' => 'nid',
'type' => 'int',
'description' => 'The display ID of the view to get.',
'source' => array('param' => 'nid'),
'optional' => TRUE,
'default value' => 'default',
),
),
'access arguments' => '_blog_access_provide_access',
'access callback' => '_blog_access_provide_access',
//~ 'access arguments append' => FALSE,
),
),
),
);
return $resources;
}
function _blog_access_provide_access() {
return TRUE;
}
function my_module_get_user_email($nid){
var_dump($args);die;
}
I want url like this.:
http://localhost/drupaltest/rapidapi/get_data/?nid=111
Please let me know where i did wrong.
thanks in advance.
Hi here are to reference that will be useful
http://pingv.com/blog/an-introduction-drupal-7-restful-services
https://www.drupal.org/node/783460
Also I am not sure about the query string, but for the retrieve operation you can set it as part of the url
ex:
http://localhost/drupaltest/rapidapi/get_data/<nid should be here>
http://localhost/drupaltest/rapidapi/get_data/111
Also using the source path as source
'source' => array('path' => '0'),
I would think that source param only works for an index operation and not retrieve
I need to display Mail subject in Related tab Grid of Lead module
I have checked getRelationQuery() function in that I got a subject, but while on the EmailRelatedlist.tpl file, the subject data is not displayed.
How we can display the Subject on the Related tab?
can you please go to below file and change below code
modules\Emails\Emails.php
var $list_fields = Array(
'Subject' => Array('activity' => 'subject'),
'Related to' => Array('seactivityrel' => 'parent_id'),
'Date Sent' => Array('activity' => 'date_start'),
'Time Sent' => Array('activity' => 'time_start'),
'Assigned To' => Array('crmentity', 'smownerid'),
'Access Count' => Array('email_track', 'access_count')
);
var $list_fields_name = Array(
'Subject' => 'subject',
'Related to' => 'parent_id',
'Date Sent' => 'date_start',
'Time Sent' => 'time_start',
'Assigned To' => 'assigned_user_id',
'Access Count' => 'access_count'
);