Monthly or weekly report of PayPal Completed Payments automatically - csv

We can download a CSV or XLS of PayPal Completed Payments by manually going to https://business.paypal.com/merchantdata/reportHome and doing "Activity download":
But how to get this CSV report, automatically (via email or with an API), each week or each month, without having to manually log in on the website?
Note:
I've already looked at PayFlow reports and download-reports but it seems quite complex, and there is no full example (only XML samples but it's unclear how to use them)
I don't want to use IPN for this (I do use it for another task, but it's not perfectly reliable for other reasons, etc.)
Example of desired output:
"Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Shipping Address","Address Status","Item Title","Item ID","Shipping and Handling Amount","Insurance Amount","Sales Tax","Option 1 Name","Option 1 Value","Option 2 Name","Option 2 Value","Reference Txn ID","Invoice Number","Custom Number","Quantity","Receipt ID","Balance","Address Line 1","Address Line 2/District/Neighborhood","Town/City","State/Province/Region/County/Territory/Prefecture/Republic","Zip/Postal Code","Country","Contact Phone Number","Subject","Note","Country Code","Balance Impact"
"3/1/2018","04:52:07","CET","John Doe","Website Payment","Completed","EUR","100.00","0","100","johndoe#gmail.com","contact#example.com",...
"3/1/2018","16:29:30","CET","Mike Abcd","Website Payment","Completed","EUR","100.00","0","100","mikeabc#example.com","contact#example.com",...

You will have to do it through the XML api. Basically, you make a post request with the example XML in the link you gave but with your data. The response will be in XML and you take the returned reportId and then call the get report api and it will return in xml the report data.

Related

Send HTML formatted mail from Pentaho

I need to loop through a database table and send a html formatted mail.
Nothing complex, a text value followed by a hyperlink.
I tried with xml and xsl transformation but couldn't get desired results.
ALso, advise on whether its better to construct hyperlink in PostGressql or is it okay from Pentaho
I tried with a Table Input and a Javascript step. Thing is it outputs for each row. i need to combine and concatenate each row output to form result HTML
With Pentaho: get your data with a table input, make the html (for example with a java script), get the mail parameters (addresse, attachement, etc,...) from a grid or a constant step, and give the whole to the mail step.
With the javascript you built a -tag by row named html, but you need only one message. So you group them with a Group by step (no Group field, subject=html, type=Concatenate strings separated by, value=empty). You can then drop it in the Mail step.
But the Mail step needs some more information (recipient, sender, subject, server, port,...). You can put them in the flow with a Constant step.
In view of your use-case, it may surprise you that you have to put this data in the flow rather than to feed a box in the Mail step. This is because this step is designed to send a mail personalized for each recipient.
And now that you know how to do it, refrain from sending 100000 mails to every one you can.

Mass Upload Files To Specific Contacts Salesforce

I need to upload some 2000 documents to specific users in salesforce. I have a csv file that has the Salesforce-assigned ContactID, as well as a direct path to the files on my desktop. Each contact's specific file url has been included in the csv. How can I upload them all at one and, especially, to the correct contact?
You indicated in the comments / chat that you want it as "Files".
The "Files" object is bit more complex than Attachments, you'll need to do it in 2-3 steps. What you see as a File (you might see it referred to in documentation as Chatter Files or Salesforce Content) is actually several tables. There's
ContentDocument which can be kind of a file header (title, description, language, tags, linkage to many other areas in SF - because it can be standalone, it can be uploaded to certain SF Content Library, it can be linked to Accounts, Contacts, $_GOD knows what else)
ContentVersion which is well, actual payload. Only most recent version is displayed out of the box but if you really want you can go back in time
and more
The crap part is that you can't insert ContentDocument directly (there's no create() call in the list of operations) .
Theory
So you'll need:
Insert ContentVersion (v1 will automatically create for you parent ContentDocuments... it does sound bit ass-backwards but it works). After this is done you'll have a bunch of standalone documents loaded but not linked to any Contacts
Learn the Ids of their parent ContentDocuments
Insert ContentDocumentLink records that will connect Contacts and their PDFs
Practice
This is my C:\stacktest folder. It contains some SF cheat sheet PDFs.
Here's my file for part 1 of the load
Title PathOnClient VersionData
"Lightning Components CheatSheet" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf"
"Process Automation CheatSheet" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf"
"Admin CheatSheet" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf"
"S1 CheatSheet" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf"
Fire Data Loader, select Insert, select showing all Salesforce objects. Find ContentVersion. Load should be straightforward (if you're hitting memory issues set batch size to something low, even 1 record at a time if really needed).
You'll get back a "success file", it's useless. We don't need the Ids of generated content versions, we need their parents... Fire "Export" in Data Loader, pick all objects again, pick ContentDocument. Use query similar to this:
Select Id, Title, FileType, FileExtension
FROM ContentDocument
WHERE CreatedDate = TODAY AND CreatedBy.FirstName = 'Ethan'
You should see something like this:
"ID","TITLE","FILETYPE","FILEEXTENSION"
"0690g0000048G2MAAU","Lightning Components CheatSheet","PDF","pdf"
"0690g0000048G2NAAU","Process Automation CheatSheet","PDF","pdf"
"0690g0000048G2OAAU","Admin CheatSheet","PDF","pdf"
"0690g0000048G2PAAU","S1 CheatSheet","PDF","pdf"
Use Excel and magic of VLOOKUP or other things like that to link them back by title to Contacts. You wrote you already have a file with Contact Ids and titles so there's hope... Create a file like that:
ContentDocumentId LinkedEntityId ShareType Visibility
0690g0000048G2MAAU 0037000000TWREI V InternalUsers
0690g0000048G2NAAU 0030g000027rQ3z V InternalUsers
0690g0000048G2OAAU 0030g000027rQ3a V InternalUsers
0690g0000048G2PAAU 0030g000027rPz4 V InternalUsers
1st column is the file Id, then contact Id, then some black magic you can read about & change if needed in ContentDocumentLink docs.
Load it as insert to (again, show all objects) ContentDocumentLink.
Woohoo! Beer time.
Your CSV should contain following fields :
- ParentID = Id of object you want to link the attachment to (the ID of the contact)
- Name = name of the file
- ContentType = extension(.xls or .pdf or ...)
- OwnerId = if empty I believe it takes your user as owner
- body = the location on your machine of the file (for instance: C:\SFDC\Files\test.pdf
Use this csv to insert the records (via data loader) into the Attachment object.
You will then see for each contact, that records have been added to the 'Notes & Attachments' related list.

Unable to retrieve unlimited number of record via API

We are struggling to mine all time records for this year via API.
We have tried to include the :dont_limit_result GET variable and set it to 1, however it did not help us.
The version that we use is ACTIVE COLLAB 5.11.0, the URL we are hitting: projects?dont_limit_result=1&page=$page
Please give me some advise on how to proceed.
Most of API responses are paginated, and pagination can't be turned off using a GET switch. Instead, you should check following headers:
X-Angie-PaginationCurrentPage - indicates current page
X-Angie-PaginationItemsPerPage - indicates number of items per page
X-Angie-PaginationTotalItems - indicates number of items in the entire data set.
and walk through pages until you reach the end of data set.
Another option is to give project's filter a try. Here's an example request that will return all projects:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter"
This one will return all active projects:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter&completed_on_filter=is_not_set"
I'm using the php API wrapper 3.0 - how do i get the headers back to know there are more pages and then what is the correct form of the query to get further pages?
For example my basic query is:
$timeRecords = $client->get('projects/22/time-records')->getJson();
to get time records - but this only returns 100 and there are more!
Thanks,
P

Export to pdf SSRS

I've some questions regarding SSRS:
I want to create Account Statements of each client
Is it possible in SSRS to do so that I will pass AccountID as a parameter for each client, and it will form and save pdf files in C drive for each AccountID. How can I automate that?
I've e-mail table of each client. Is it possible to send account statements to clients according to this e-mail list? In other words, can I query recipients of account statements and send them an e-mail with their account statements.
Thanks
If you want to do this on a regular basis, you need to utilize a feature called Data Driven Subscription.
Basically, it looks at a table(Parameter, EmailAddress) in a SQL Server.
For instance, let's say you have:
ID - Name ------ Parameter ---------------- Email
1 - SalesGuy1 - 123123123 - SalesGuy1#emailaddress.com
2 - SalesGuy2 - 111111111 - SalesGuy2#emailaddress.com
3 - SalesGuy3 - 222222222 - SalesGuy3#emailaddress.com
It then, according to this table, executes with a parameter and sends report to appropriate user.
There is no short way of describing step-by-step, so please have a look at a well-written Microsoft KB article: https://technet.microsoft.com/en-us/library/aa237461%28v=sql.80%29.aspx
There is also slightly newer version (but basically the same content):
https://msdn.microsoft.com/en-us/library/ms169673.aspx
Note: You cannot use Shared Data source with data driven subscription. You have to configure email settings inside SSRS for this to work.

How to specify the report pdf name at run time?

I have a report named "Debt Report ". It runs for every month and a pdf is generated at the first of the month by subscription option.
If I am running the report for the month then the report name of the pdf should be "Debt Report for April" and like wise if I run it for may then the name of the pdf should be "Debt Report for May".
How can I do this?
Assuming you are scheduling the report to a file share, you can set the name of the file share to be Debt Report for #timestamp - this will name the file in the format Debt Report for YYYY_MM_DD_HRMINSS .
If you only want the month name (not the entire timestamp) to appear in the filename, you will need to use a Data Driven Subscription.
Another option, although a bit more technical, is to use the rs.exe utility to generate the report. This involves:
creating a script file that generates the report (this is where you can set the filename to your preference)
creating a batch file that calls rs.exe with the script file as a parameter
running the batch file on a schedule e.g. with Windows scheduler or SQL Server Agent
There is an example here of how to do this (to create Excel files but the principle is the same) http://skamie.wordpress.com/2010/08/11/using-rs-exe-to-render-ssrs-reports/
The solution for this problem is "Data Driven Subscription"
http://msdn.microsoft.com/en-us/library/ms169972(v=sql.105).aspx
http://www.kodyaz.com/reporting-services/create-data-driven-subscription-in-sql-server.aspx
the following link helped me alot but the query given in the link creates trouble- cast the datatype of the getdate and it will solve the problem
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/0f075d9b-52f5-4a92-8570-43bbdaf2b2b1
I have had to do the same thing ( well almost )
I had to generate a weekly report to file and save it as REPORT-Week01.pdf, then REPORT-Week02.pdf etc.
The mechanism I used was to change the parameter column in the Schedule table via a scheduled job. This computed the required file name and simply replaced it. Then when the scheduled job runs, it writes to the file name setup when the schedule was created ( except that was changed at 1 minute past midnight to what I wanted it to be )
I have since implemeted another set of reports that write to a folder, whihc changes each month the the next months folder name ( currently writing all reports to a folder called 202103 ) tonight the job will run and the output folder will change to 202104 and the scheduled jobs will never need changing