• RyanAtTGH
  • NEWBIE
  • 10 Points
  • Member since 2021
  • Architect
  • The Great Horizon, LLC


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
A client is over their storage limit due to large media attachments on emails which are related to cases. When exchanging emails, often the attachments are duplicated. I'd like to identify the duplicate email attachments, based on the parent Email Message assosciation with Case, size, and name. 

I can query the attachments, size, and parentId (EmailMessage) using the soql
SELECT Id, Name, ContentType, BodyLength, ParentId, Parent.Type
    FROM Attachment
    WHERE ContentType = 'image/jpeg'
    AND ParentId IN (SELECT Id FROM EmailMessage WHERE HasAttachment = TRUE)

But, I would also like the Email Message's RelatedTo and/or ParentId field(s) as well, which would give me the Case Id. If an attachment has the same CaseId, BodyLength, and Name, it's 99% a duplicate and I can delete it. 

I've tried all the SOQL I know to get it in one query, so I am thinking now I need a custom map or sObject using Apex. 

thoughts? 
Some emails that are related to the Case record have sensitivty information. Is there a way to restrict visibility to those related Email Messages and associated attachments, if the email sender or recipient is a specific email address?
A client is over their storage limit due to large media attachments on emails which are related to cases. When exchanging emails, often the attachments are duplicated. I'd like to identify the duplicate email attachments, based on the parent Email Message assosciation with Case, size, and name. 

I can query the attachments, size, and parentId (EmailMessage) using the soql
SELECT Id, Name, ContentType, BodyLength, ParentId, Parent.Type
    FROM Attachment
    WHERE ContentType = 'image/jpeg'
    AND ParentId IN (SELECT Id FROM EmailMessage WHERE HasAttachment = TRUE)

But, I would also like the Email Message's RelatedTo and/or ParentId field(s) as well, which would give me the Case Id. If an attachment has the same CaseId, BodyLength, and Name, it's 99% a duplicate and I can delete it. 

I've tried all the SOQL I know to get it in one query, so I am thinking now I need a custom map or sObject using Apex. 

thoughts? 
Some emails that are related to the Case record have sensitivty information. Is there a way to restrict visibility to those related Email Messages and associated attachments, if the email sender or recipient is a specific email address?
hi everyone,
i was trying to create a validation rule for date/time field to prevent the entry duplicate record ; in more detail i have created field using the concept of Master detail relationship and i want the the record in the date/time tobe unique i.e., if a user enters a date and time and another user tries to enter the same date and time it should show an error
kindly help me with this scenario 
Thanks Regards
Raviteja 
Hi Experts,

I'm facing below issue while I'm accessing my local website(remote site) to Salesforce application. Assume like https://mystie.com(remote website or localwebsite). I'm trying to make an AJAX call to Salesforce and that gets blocked.

Access to manifest at 'https://hr-mysite.my.salesforce.com/visualforce/session?url=https%3A%2F%2Fhr-mysite--fhcm2.um5.visual.force.com%2Fresource%2F1595939225000%2Ffhcm2__collaborationportal%2Fmanifest.json' (redirected from 'https://hr-mysite--fhcm2.um5.visual.force.com/resource/1595939225000/fhcm2__collaborationportal/manifest.json') from origin 'https://hr-mysite--fhcm2.um5.visual.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Plesae refer Salesforce landing page console error.

Landing page console issue.

Above image if i do clockin post request will come but here post request gets blocked( All are Ajax call). i attached falid request screenshot.

Post request get failed inside salesforce application.
Note: Its was working fine end to end apllication  
I am facing cross domain error on ajax request in javascript

Ajax Request
 
$.ajax({
                    url:"../oppitm/lineitemsort.jsp?id={!oppID}",
                    contentType:"text/html",
                    xhrFields:{withCredentials:true}
                    }).done (
                    function(data){console.log(data)});
Error
XMLHttpRequest cannot load https://ap1.salesforce.com/oppitm/lineitemsort.jsp?id=00690000007jIM1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://nsp-demo.ap1.visual.force.com' is therefore not allowed access.

I have enabled below origin urls in CORS
  • https://*.salesforce.com
  • https://ap1.salesforce.com
  • https://nsp-demo.ap1.visual.force.com
Please suggest or any workarounds how this can be resolved