How to post docusign template in a specified folder? so far as per API I have used
"envelopeTemplateDefinition" => array(
"name"=> 'SpecialTPL_'. 'TestName',
"folderName" => "testFolder",
"folderId" => "A Long ID fetched earlier by API's /folders call",
"folderUri" => "/folders/A Long ID fetched earlier by API's /folders call",
)
But this is posting templates nto default "template" Folder only, and not into "testFolder".
The POST request defaults to the template being placed into the Parent folder (i.e. My Templates) regardless of the fact that you specified your subfolder folderId.
You'll need to first run your template POST call, then a Move Envelope (Template) PUT call after to place the template into the subfolder. Steps would be:
1) POST your Template into the default folder i.e. POST https://demo.docusign.net/restapi/v2/accounts/[account ID]/templates
2) GET your Template Subfolder and Parent Folder folderIds i.e. GET https://demo.docusign.net/restapi/v2/accounts/[account ID]/folders?template=only
3) PUT a Move Template request using the Subfolder and Parent Folder folderIds returned in step 2 i.e. https://demo.docusign.net/restapi/v2/accounts/[account ID]/folders/[subfolder ID]
Your JSON body for step 3 would be:
{
"envelopeIds": ["Template ID returned in step 1"],
"fromFolderId": "Parent Template Folder ID returned in step 2"
}
Note that envelopeIds is a list of template IDs and the IDs themselves need to be wrapped by [ ] even if your only specifying just one template
Related
I am using WordPress to create a website which allows users to upload files of hiking paths (gpx (xml) files).
To do this the user access a page called "Create new track" (this is a WordPress page with a specific template). Via a php created form, the user enters the name of the hike, a short description and chooses the file to upload. My code then makes the usual checks on the entered data and chosen file. If all checks are passed, the file is uploaded to the server and a new post is created (adding the entered title and description and file attached to the post).
I want that once the file has been uploaded and the new post has been created then the user accesses a webpage where he can view the newly created hike. I would like this page to be a second WordPress page called "Edit track" which uses a second specific template.
My current plan is that would use $track_ID (see code - this is the ID of the newly created post) and add this to the url of the "Edit track" url in the form of a url parameter. When the "Edit track page is automatically opened after successful creation of the track then the url param is read and the appropriate track can be edited.
My problem is, what code do I need to write such that once the new post is successfully created the "Edit track" page is accessed??
I am completely stumped! I have tried using php and Javascript, but cannot workout how to do this. All ideas welcome!
The frame of my code is attached.
add_shortcode('sut_form', 'sut_form_shortcode');
function sut_form_shortcode() {
if (isset( $_POST['sut_form_create_track_submitted'] ) &&
wp_verify_nonce($_POST['sut_form_create_track_submitted'], 'sut_form_create_track') ) {
// LOTS OF CHECKS ON WHAT HAS BEEN ENTERED
}
else // ALL CHECKS PASSED, SO WE CAN CREATE THE POST
{
$track_data = array(
'post_title' => $sut_track_name,
'post_content' => $sut_track_text,
'post_status' => 'pending',
'post_author' => $current_user->ID,
'post_type' => 'tracks'
);
// Create track post and attach image
if ($track_id = wp_insert_post($track_data)) { // POST CREATED
wp_set_object_terms( $track_id, (int)$_POST['sut_track_category'], 'track_category'); // CATEGORY ASSIGNED TO POST
update_field('field_5bf39d97d1e8d', $movefile['url'], $track_id); // UPLOADED FILE ATTACHED TO POST
// PROBLEM!!! HOW DO I KNOW ACCESS THE URL FOR POST WHICH HAS JUST BEEN CREATED?
}
}
}
Your function is registered with add_shortcode, so it is executed during page content rendering, it is too late to use header("location... since headers could be already sent to client.
The only solution I can think of, without changing your code and without knowing your entire project is to print a JavaScript snippet, something like this:
$permalink = get_permalink($track_id);
echo("<script>window.location.replace('$permalink');</script>");
It is not too neat but should work.
We are using wordpress for blogs (hosted via Godaddy). I am not a wordpress developer and hence this basic question. We have the wordpress post api like blog.domainname.com/wp-json/wp/v2/posts. This returns a json object of most of the fields. Now i have added a custom field to be returned with this object. i have seen lot of videos and study on what changes that needs to be done especially the one here.
https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/
My Question is - Where do I make these changes? What file do I need add these changes? I am using WP as an admin. I installed a File Explorer plugin and I am able to see three main folders - wp-admin, wp-content, wp-includes.
Is there a particular file i need to make changes? Based on my learning - i wrote the following snippet. not sure where to add this :(
function addCustomField_register_fields() {
register_rest_field('post',
'custom_Field_name',
array(
'get_callback' =>'get_custom_field',
'update_callback' => null,
'schema' => null
));
}
function get_custom_field($object, $field_name , $request) {
return get_post('custom_field');
}
add_action('rest_api_init', 'addCustomField_register_fields');
Also would appreciate if you can let me know if my method is correct.
Typically theme customisations are added to the functions.php file in the root directory of your active theme.
As for your code, what are you trying to do? Your callback in particular doesn't look like it will work. get_post() loads a WordPress post by ID. 'custom_field' isn't a valid post ID, so this will always fail.
Objective: Autopopulate some values using the tabLabel/value key pair for server templates, using the beta Docusign PHP Client.
I've looked at quite a few stackoverflow posts and unfortunately the one that seems to be the closest related to me seems unanswered: Docusign API - prefilling tab values on envelope created from template
I was unable to find this "SecureField" option in any sort of preferences.
Currently, the name field fills in automatically just because of the template role being set accurately. I didn't have to do this with the tabLabel key, this was done automatically. I have tried creating a company tab, and that fails to autopopulate, so does a random text tab I have tried.
I have currently forked the library and made it PSR-4 compatible, and to achieve this objective I changed the following files:
TemplateRole Model: Modified the constructor to include $tabs, and set $this->tabs if $tabs is set. I added two functions getTabs()/setTabs($tabs) that behave the same as get/set RoleName, Name, Email, etc.
RequestSignatureResource: In the foreach ($templateRoles as $templateRole) I added a 'tabs' key to the array_pusy, and put $templateRole->getTabs().
I created a new TemplateRole('role name', 'person name', 'email', $tabs).
I can see the tabs in the JSON request data. Is there anything I'm missing?
I should also note that I used this post for inspiration, too: How to pre-fill tabs on a server template with the DocuSign API. The issue with this is that if I put textTabs:{text:{tabLabel:"something", value:"some value"}} then I get a response from the API that my request was invalid. I can provide that specific error upon request if needed.
The following worked for me :
$templateRole = new DocuSign\eSign\Model\TemplateRole();
$templateRole->setClientUserId($email);
$templateRole->setEmail($email);
$templateRole->setName($recipientName);
$templateRole->setRoleName($templateRoleName);
$textTab = new \DocuSign\eSign\Model\Text();
// I added this text field manually on docuSign site.
$textTab->setTabLabel("Field Label");
$textTab->setValue('Value');
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setTextTabs(array($textTab));
$templateRole->setTabs($tabs);
Iam new in drupal. I want to create a page and want to add data in page directly with out using backend content. I have created a page like this, page-test.tpl.php. How can I call this newly created page in browser?
First you have to create your own custom module.Let the module name be test.Create 2 files namely test.info and test.module.Declare a hook_menu function inside the test.module file.Since your module name is test your hook_menu will be named as test_menu.
Hook_menu enables modules to register paths in order to define how URL requests are handled. Paths may be registered for URL handling only, or they can register a link to be placed in a menu.
Test.module
function test_menu() {
$items = array();
$items['test'] = array(
'title' => 'My Page',
'description' => 'Study Hard',
'page callback' => 'test_simple', //Calls the function
'access arguments' => array('access content'),
);
return $items;
}
function test_simple() {
return array('#markup' => '<p>' . t('My Simple page') . '</p>');
}
Test.info
name = Test
description = Provides a sample page.
core = 7.x
After adding this try clearing the drupal cache and then navigate to /test.Try this link if you are a beginner.Try reading hook_theme which allows you to use your custom template.More about hook_theme here.Hope it might help u mate.. :)
Pages in drupal are stored in the database, not in actual code files like old websites used to. The template files (.tpl.php) are exactly that - templates. So for example, lets say you have blog content. You'd have to create a content type of 'Blog'. you could then create a template file (ex. node--blog.tpl.php) which would format the way the blog pages would look. But you would still need to add new pages through the drupal interface in order to add them to the site. You could always use an input type of PHP if you'd like to include php in the body of the page.
If you simply want to display a php file in your browser from your site, you can just upload a php file of your choice to your sites/default/files directory and access it directly via the file path.
I manage a Drupal 7 based website for my College's Student's Association. Most of it is standard static pages. Each year we run a room ballot for people to choose their rooms and this process will need an application to display current room allocations (in real time) and wiki style information about what the different rooms are like.
I need to be able to serve up static pages of HTML, javascript and css; bypassing the theming module. I need the relative addressing in the html page which serves as the root of the application to work properly (e.g. "javascript/app.js" should pick up that file from within the module). I then need to serve up json data from php using all the drupal APIs for permissions and database access etc.
I have a fair bit of experience in HTML, Javascript etc. and some in PHP, but I'm fairly new to Drupal module development.
You should create a custom module as you suggest, and separately put your HTML5 application in a sub-folder of the module. When it's accessed it will use the same relative paths as you'd normally expect so javascript/app.js will work if the file exists in the path under your HTML5 app's folder.
For the JSON data your custom module will look something like this:
function mymodule_menu() {
$items['my/app/data'] = array(
'page callback' => 'mymodule_ajax_callback',
'access callback' => TRUE,
'type' => MENU_CALLBACK
);
return $items;
}
function mymodule_ajax_callback() {
$type = $_POST['type'];
$nodes = db_query("SELECT nid, title FROM {node} WHERE type = :type", array(':type' => $type))->fetchAllKeyed();
drupal_json_output($nodes);
drupal_exit();
}
That code defines a menu path (using hook_menu()) at mp/app/data which uses mymodule_ajax_callback() as it's page callback.
mymodule_ajax_callback() simply grabs all nodes from the database that match the type parameter passed in the AJAX $_POST and outputs their id and title in a JSON string to the page (which will then be returned as your AJAX response when you request /my/app/path).
Hope that helps