I have a custom object in Salesforce called File_Uploaded__c:
When I upload a file in my web application (Symfony2),
I save its information(size, name,...) in Salesforce,
but the file in question is registered in a server.
And when I delete the file from salesforce, I need to delete it from the server after 10 days to gain space in the server but I don't know how to get the deletion date.
I tried to add a filed of type Formula in File_Uploaded__c where I compare the current date with the last modified date and if it's more than 10 days I return true but it doesn't seem to work because last modified date could be update date and not only deletion date.
Mark object in SF as deleted. It will be there for 10 days. After you delete file from server, delete object from SF.
Direct answer on your question:
[Select Id from File_Uploaded__c isDeleted = true ALL ROWS]
Related
I am trying to receive a list of all opportunities that are created/updated/deleted since a given date. When I run query: SELECT Id FROM Opportunity WHERE SystemModStamp >= '2022-09-20' AND isDeleted = TRUE ALL ROWS I get a response stating "message": "ALL ROWS not allowed in this context", "errorCode": "MALFORMED_QUERY".
Going over the salesforce documentation I found out using queryAll() api method we can also get the opportunities which are created/updated/deleted. But I am not able to find an example of how to use this api. Any help in this direction would be highly appreciated.
Salesforce queryAll documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_queryall.htm
Have you tried using queryAll instead of query? Start with
/services/data/v54.0/queryAll?q=SELECT+Id,+Name,+isDeleted,+StageName+FROM+Opportunity+ORDER+BY+isDeleted+DESC+LIMIT+20
and experiment, remove the ORDER BY, put filter by date...
SELECT Id, Name, isDeleted
FROM Opportunity
WHERE LastModifiedDate >2022-09-01T00:00:00Z
There's also dedicated "data replication API" which you can use to get opportunities updated / deleted in given time window (imagine an oppty that's edited 3 times in September, once in October - the last modified date will happily say October, how would you retrieve the fact it was touched in September too?). It'll give you just the IDs, you'd have to collect them and send the query for actual data - but it's something.
I have scheduled to unload data from snowflake to S3 every hour . Data gets uploaded to this path : My_bucket/year=2021/month= /day= /hour = /data.csv
year , month , day and hour gets dynamically updated in the path at every hour run .
Data need not necessarily be there every hour. At that time No folder or path is getting created
I need to have folder for every hour in S3 irrespective of data flowing in .
like hour=1 ,hour=2 ,hour=3 and so on for all 24 hours every time the query runs.
There should be csv file if data is present in table and even if the data is not present path for that hour should be there with empty file
So how should I modify my sql query?
Hi You achieve this by using one workaround.
Since snowflake will not upload any file if the query return zero rows.
This workaround will copy empty-file with headers only if no data is available.
copy into <s3_path>
from (
-- this will act as header for both condition if data present or not.
select 'customer_id','store_id','metro_id','message_type'
UNION
select to_char(customer_id),to_char(store_id),to_charmetro_id(),message_type
from myTable
)
OVERRIDE=TRUE
FILE_FORMAT=(type=csv)
I have Data Driven subscriptions which run # 8 AM on reports and it creates PDFs based on CustomerID.
Below are the few PDF filenames : (Each file has the customer ID appended to the filename, In this case, 12345 and 45678 are the customer IDs for both files)
SampleReport_11_12345
HighlightedReport_9_45678
So, The next day if the same Customer ID (12345 and 45678) report is generated, the file names are being changed like
SampleReport_11_12346
HighlightedReport_9_45679
Next day I want to change the file names as
SampleReport_11_12345_1
HighlightedReport_9_45678_1
It's adding a number to CustomerID, Do you know how to resolve this? Thanks for the help!
I currently use access to store and easily manage gym memberships and customer information etc. I have 3 forms where employees can add a new member, view a current member, and a home page where they can run various other functions like run reports on expired memberships etc.
On the profile form which is what is opened when a member is selected there is an expiry date field which is the date the customers membership expires on. Up until now the employees of the gym have just been manually typing the date +1 month when a customer pays their membership however there have been a few mistakes.
What im trying to do is to create a button which will simply insert todays date +1 month into the expiry text field. To do this i have created a button and use the following VBA Code however this only adds one day, not 1 month, i cant simply add +30 as different months have a different number of days.
++Start VBA Code++
Private Sub cmdAddDate_Click()
On Error GoTo ErrorAddDate
Me.Expiry = Date + 1
ExitAddDate:
Exit Sub
ErrorAddDate:
MsgBox Error.Description
Resume ExitAddDate
End Sub
++End VBA Code++
i can host a copy of the database on my FTP Server if needed but customer information will have to be removed of course.
Thanks in advanced.
Use the DateAdd function:
Me.Expiry = DateAdd("m", 1, Date)
Magento database name convention is not trivial. How to get these fields below for last 7 days?
Last Name
First Name
Address
City
State
Zip
Phone
Email
Amount
Order #
Item #
I could not tell if you were looking for some PHP/Magento code or if you are looking to access the database directly. It might be "better" to create yourself a custom module that fetches this info using the Magento/Zend framework, but since I don't know the code off the top of my head I'll redirect you to the following link which has a very nice SQL query that will pull that info for you (and more).
http://www.magentocommerce.com/wiki/groups/207/fedex_-_shipping_view
You probably just need to add something like this to the end to filter the last 7 days
where so.created_at > NOW() - INTERVAL 7 DAY