Does anyone have any idea how to retrieve deleted records data from Apex data loader or otherwise from Salesforce except from the Web service?
Check the documentation: https://na7.salesforce.com/help/doc/en/salesforce_data_loader.pdf
If using the GUI version v20 or above, you'll have the Export All button.
From the Command Line version, the process-config.xml file should have the process.operation attribute value set equal to "extract_all" (the documentation states "Extract All" but that doesn't work).
Using either of these above options will extract soft deleted records, and will allow you to filter on IsDeleted = true or false. (You can include this filter regardless, but without using the above options, IsDeleted=true will always return zero records).
Hope that helps.
P.S. In Apex, it's slightly different. Your SOQL query will be [Select Id from Account where IsDeleted=false all rows] The 'all rows' appendage is the Apex equivalent of 'extract all'.
In Dataloader, use the EXPORT ALL button, not the EXPORT button
This gives you access to deleted & archived records.
You can't. The only way to get deleted records through the API is to use queryAll, and DataLoader doesn't use queryAll ever.
(Sorry for the resurrection here.)
Roll them back with a few lines of Apex code in the System Log. For instance:
Account[] a = [select id from Account where isDeleted=true ALL ROWS];
undelete a;
system.debug(a);
This should work as long as you didn't use emptyRecycleBin() (which will still return query results, but won't allow undelete as the records would now be marked for physical deletion). Take a few of the ids from the USER_DEBUG results for a to confirm that it worked.
Try extract, extract_all, hard_delete.
I hope it's not to late.
There are three ways to do it.
Recycle bin. In recycle bin change the option to all recycle bin. It is like soft delete we can get the record. If you didn't get your record from recycle bin
Workbench. In workbench select soql query and your required object and create a query like this example.
SELECT Id,Name,AccountId,Isdeleted,CreatedDate,StageName
FROM Opportunity where isdeleted =true
in this section we didn't get the record we know the information of the opportunity record.
Dataloader. It also works like workbench and you can retrive the information of the record. Select exportall option and select the required fields and put a filter like is deleted is true.
Related
I know this works on the workbench:
SELECT Id,bizible2__BizibleId__c FROM Task
where bizible2__BizibleIid__c is on the activity table.
This works too:
SELECT Id,bizible2__BizibleId__c,owner_manager__c FROM Task
but it doesn't work in simple_salesforce. No clue why. So I tried to simulate it because owner_manager__c is a calculated field that equals:
Owner:User.Manager.FirstName &" " & Owner:User.Manager.LastName
the owner is a standard relationship for the task table and presumably the activity table. My attempt:
SELECT Id,bizible2__BizibleId__c,Owner.name FROM Task
works, but
SELECT Id,bizible2__BizibleId__c,Owner.Manager.FirstName FROM Task
Didn't work. Manager is a hierarchy thingy. I thought it could be because the owner relationship is user,calendar,something else and not just user, so I tried
SELECT Id,bizible2__BizibleId__c,LastModifiedBy.Manager.FirstName FROM Task
and that didn't work.
I figured it out. You have to go to the directory simple_salesforce is in: site-packages\simple_salesforce\api.py. then in the line DEFAULT_API_VERSION = '42.0', change 42.0 to 51.0. That, of course, is a terrible hack, so I asked this question:
How do I change the api version of Simple Saleforce
But so far there is no answer other than what I did.
From what I remember "simple salesforce" uses REST and this API respects field level security. Are you sure you have access to the field? Just because you're sysadmin and bypass stuff in UI doesn't mean your Profile is all right. Workbench might be using SOAP API which is bit old and doesn't enforce the fields (yet).
What does this do for you?
SELECT Id,
TYPEOF Owner
WHEN User THEN Username, Manager.Name
END
FROM Task
On mutant fields sometimes you need to use polymorphic SOQL to get the fields you want. But still, the formula should work OK.
I'm a little stuck.
I am trying to generate a report that determines whether anyone has made a manual change to certain fields within our order framework. I have figured out the proper fields and structures to audit, and even how to make the report, but I used a combination of extracts from the Dataloader and Excel xlookups to make it. Now, I'm being asked to find a way to automate the generation of the report, and I suspect that means I need to write a SOQL query to figure it out. I'm having trouble traversing multiple relationships based on these ID fields. Essentially, what I'm trying to do is make multiple "left joins" based on the 18 digit Salesforce IDs and extract some related piece of information from those other objects.
For example, if I'm starting with order_product_history (with a field OrderProductID to identify the order product) and I want to bring in "Product Name", I have to first match OrderProductID with the ID field in my order_product "table", then I have to match the Product2ID field in my order_product "table" with the ID in my product "table", then I have to get the matching Product Name as a column in my report:
Matching/Traversal Process
Desired Result
That's one example for one field. I also have to bring in things like User Name from the users "table", and order number from the orders table, but once I get the general idea, I think I'll be OK. I also want to filter the results to only include my Fee__c and UnitPrice fields, ignore the automated users and set a date filter--not sure if I have to do that using a WHERE clause just in my main query, or if I have to filter the subqueries as well.
I am not a programmer and I have no formal Salesforce training; I am just an analyst who is technically inclined and sort of fell into the role of Salesforce Admin. I am familiar with programming concepts and have been writing things using the flow application and have even dipped my toes into some Apex stuff, but it can be a bit of a struggle. I am not asking you to do my job for me and I am willing to work at the problem and learn; any help is appreciated. Sorry about the links; SO won't let me embed images yet.
There's high chance you don't have to write any code for it. I'll give you some tips, experiment a bit and edit the question or post new one?
This diagram might help: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_products.htm
Developer way
It's all about writing the right query. You can play with it in Developer Console or Workbench for example. Read up about relationship queries in SF.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_query_hist.htm
I don't have org with orders enabled but this should be a good start:
SELECT CreatedById, Created.Name,
Parent.Name, Parent.Product2.Name, Parent.Order.Name,
Field, OldValue, NewValue, CreatedDate
FROM OrderItemHistory
If it throws errors about "Parent" see if "OrderItem" will work. Once you have it - WHERE Field IN ('UnitPrice', 'Fee__c') AND CreatedDate = LAST_WEEK might be good next step. (dates can be filtered by date but there are few "constants" that are more human-readable too)
You could even export this with Data Loader, you just have to start the wizard on Order Product history table. But you can ignore the whole query creator and paste a query you've created.
Admin way
Have you ever created a report in Salesforce? There are self-paced trainings (for Lightning and Classic UI) and tons of YouTube videos. Get a feel of making few reports.
What you want might be doable with built-in report type (see if there's new report -> order product history). If nothing exciting - as admin you can make new report type in setup. For example Orders -> Order Products -> Order Product History. Screenshots from here might help.
Just wanted to update this for anyone looking for a solution in the future.
Turns out you can traverse these as a parent-child relationship in the SOQL query. Here's the query I ended up using:
SELECT CreatedBy.Name, FORMAT(CreatedDate), OrderItem.Order.OrderNumber, OrderItem.Product2.Name, OrderItem.Product2.ProductCode, Field, OldValue, NewValue
FROM OrderItemHistory
WHERE (Field = 'Fee__c' OR UnitPrice) AND (CreatedBy.Name != 'Integration User') AND (Created Date >= 2020-11-24T00:00:00.000Z) ORDER BY CreatedDate DESC
I am about to do the process of mass de-duping in Salesforce. However, our team uses excel spread sheets where they have Account IDs. When I will merge accounts, then some of them won't exist in Salesforce anymore. I would like to get merged Account IDs to use vlookup in Excel, to replace invalid values.
I tried to pull this data out via Account History report... I wasn't able to do this. Also I went to Recycle Bin, where deleted Accounts are stored. However, there I can find only Account names instead of Account IDs
Does anyone know how can I get the merged Account IDs?
You could use some screenscraping thingie to inspect the HTML of Recycle Bin page. The Id of deleted record is hidden in the checkbox you click.
<input id="ids0" name="ids" onclick="..."
title="Select Sample Account" type="checkbox" value="001xxxxxxxxxxxx">
But that's a very crappy solution.
Better would be to use an API tool (I usually recommend Real Force Explorer but if it's an one-time action the web-based workbench.developerforce.com might do too).
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_merge.htm
To find all records that have been merged since a given point in time,
you can use queryAll() with a SELECT statement similar to the
following:
SELECT Id FROM Contact WHERE isDeleted=true and masterRecordId != null
AND SystemModstamp > 2006-01-01T23:01:01+01:00
In your case something like this should give you both old and new Id - perfect for mapping in Excel!
SELECT Id, Name, MasterRecordId, MasterRecord.Name
FROM Account
WHERE isDeleted=true and MasterRecordId != null
Use a soql query tool or apex with soql query. The old accounts should be there and marked with IsDeleted true
I work on Mac and use SOQLExplorer
You can also use th SF Workbench. Log onto SF and under your name look for it
I am new in Salesforce and I would like to know how to generate an invoice.
I think to different solutions and I don't know if there are possible, time-consuming, difficult...
A service has different steps.
The service must be invoiced when the step is "completed". a new record have to be added in the table "Invoice" and a link to the invoice document (PDF or Word format)
For the moment, I think to use the section "Note and Attachment Fields". but perhaps that the object "document" is better...
Invoice Creation: I can use the standard button to create a new record but I would like to create it automatically when the status of the file is changed to "completed" for example.
1.I have read the workflow description but I am not sure that it could be use to create automaticaly a specific record in a table.
2.I have also thought to use a button that could fill in the fields and create the record. I fand information to update field with onclick javascript code. But I don't know how to add a record.
Electronic invoice: how can I generate the invoice in PDF or Word format ? and make it available from the record "Invoice n°10" ?
For exemple, the record "Invoice_10" would have an attachment field that contain a link to the document "Inv_010.pdf". The user could open the document from the link.
You might also consider using the standard quote object for your purpose. It comes with a neat PDF generator that is easy to set up. If you set it up right you can (ab)use the quote functionality for creating invoices related to an opportunity. Customizing the New Quote button would allow you to enable this functionality only after the opportunity is closed (using JavaScript). Regarding MS Word generation I recommend DocMocracy: http://www.cloudgizmos.com/salesforce-sfdc-word-excel-document-generator since it is really cheap and you can create read-only word documents.
To answer your first question, you want to write an Apex trigger — run it on your service object (sounds like Opportunity) after insert, and after update, and if the status has been changed to completed then generate your invoice record.
As for generating a PDF invoice you can do this by creating a Visualforce Page and using the renderAs="pdf" attribute in the <apex:page> tag. Storing it against a record will be a bit more tricky, though I suggest you look at examples of how you can attach a Visualforce PDF to an email, you can likely use the same blob object (which stores the content) as a document in Salesforce.
There is already an application: Invoices for Salesforce listed on the Appexchange that automatically creates invoices - records and PDF, straight out of your sales data. The application includes an invoice template editor that gives you complete freedom to design your invoice documents. In addition, the application can automatically deliver the invoices via email, or can group the invoices in files for batch printing in case you need to send them by post or fax.
Check it out: http://www.invoicesforsalesforce.com
I haven't been able to find any information regarding the best way to handle record editing with approval in CakePHP.
Specifically, I need to allow users to edit data in a record, but the edited data should not overwrite the original record data until administrators have approved the change. I could put the edited records in a new table and then overwrite the originals when I approve them but I wonder if there is an easier way since this idea doesn't seem to play well with the cake philosophy so to speak.
You are going to need somewhere to store that data until an administrator can approve it.
I'm not sure how this can be easier than creating another table with the new edits and the original post id. Then when an administrator approves the edit, the script overwrites the old record with the edited version.
I'm working on a similar setup and I'm going with storing the draft record in the same table but with a flag set on the record called "draft". Also, the original record has a "draft_id" field that has the id of the draft record stored in it.
Then in the model when the original record is loaded by the display engine it shows it normally. But when the edit or preview actions try to load the record, it checks the "draft_id" field and then loads the other record if it's set.
The "draft" flag is used to keep list and other group find type actions from grabbing the draft records too. This might also be solved by a more advanced SQL query but I'm not quite that good with SQL.