• davidleckenby
  • NEWBIE
  • 30 Points
  • Member since 2016
  • Salesforce Analyst
  • OES

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi All - This is a tricky one that I am hoping to get some assistance with. We have a managed package that has some custom pages and rollup fields. There is a vendor supplied 'events admin' permission set that when users have applied all the rollups work fine. However, when using our customised permission sets the rollup calculations do not work. What I did was to clone the vendor supplied permission set and then systematically take away all of the pemissions and rights whilst checking that the roll up functionality still works. I realise this may be difficult to conceptualise from my brief overview, but the main point is that I stripped all of the CRUD object permissions, apex class access and visualforce access and everything visible from the cloned permission set and the roll up functionality works. So it is possbile that a permission set can 'carry' more infomation that can be seen purely from a UI perspective? I dont know what is going on? Can anyone assist? thank you!
I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and then deletes the original file (whilst returning the link to it). Everything is working fine. Within the trigger context I have the Trigger.new collection that I can query against and use in as a part of my code.
I am now wanting to replicate this logic but as part of a scheduled job. The logic is that if the trigger doesn't work for whatever reason (web server not available etc) then the files remain within Salesforce and then every hour this batch job will run collect all of the records that didn't work and then repeat the exercise to try to get the files across to the DMS.
So essentially what I need is to be able to query the ContentDocumentLink object and pull back a list of records that I need. Its proving to be a more difficult task to do and I am getting the following error:-
"Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator."
How am I able to get a collection of records that I can work with? - Many thanks :)
Hi -   I am wanting to pass back the response string from this Webservice class, which is void by nature, to the trigger that is calling it. I have tried various methods by using a primitive string reference and also creating a new class with s string variable inside it but havent been able to get the string result back. Below is the code for the Webservice class.
public with sharing class ELO_Webservice {
    @future (callout=true)
    public static void CallWebService(String body, String respStr)
    {
       Http http = new Http();
		HttpRequest request = new HttpRequest();
		request.setEndpoint();
		request.setMethod('POST');
		request.setHeader('Content-Type', 'application/json;charset=UTF-8');
		// Set the body as a JSON object
		//System.debug(body);
        request.setBody(body);
       	');
        
        HttpResponse response = http.send(request);

		// Parse the JSON response
		if (response.getStatusCode() != 200) {
    		System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
		} else {
    		System.debug(response.getBody());
		} 
       
        respStr.responsestr = response.getBody();
        System.debug('responsestr = ' + respStr.responsestr);
        
    }


This is the call from the trigger
ELO_Webservice.CallWebService(body, eResponse.responsestr);
Hope this is clear. Many thanks

 
We need to simulate running monthly scheduled batch apex jobs over multilple months/year to see mutiple records instances being recaluculed over time.

I can see that there are some comments from 2011 saying that this is not possible but just wanted to check in 2019? I am guessing not but just thought to ask.
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId = '0692O0000003CSTQA2']; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}
Hi Guys - I am working with ContentFiles and am trying to get a list to populate with some values from the ContentDocumentLink object. The code above (with hardcoded value) works fine and returns the values. However when trying to do it referencing the set variable (contDocId) in the code below I get no values returned. The contDocId is being pulled correctly too (which is the hardcoded value).
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId IN :contDocId]; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}

Also here is the trigger so you can see all the code involved.
trigger ELOUpload_Trigger on ContentDocument (after insert) {
     ELOUpload_Class.ELOUpload_Method1 (Trigger.new);               
  }

Thank you!
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId = '0692O0000003CSTQA2']; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}
Hi Guys - I am working with ContentFiles and am trying to get a list to populate with some values from the ContentDocumentLink object. The code above (with hardcoded value) works fine and returns the values. However when trying to do it referencing the set variable (contDocId) in the code below I get no values returned. The contDocId is being pulled correctly too (which is the hardcoded value).
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId IN :contDocId]; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}
Now sure how to proceed? - many thanks for any assistance


 
Hi All - This is a tricky one that I am hoping to get some assistance with. We have a managed package that has some custom pages and rollup fields. There is a vendor supplied 'events admin' permission set that when users have applied all the rollups work fine. However, when using our customised permission sets the rollup calculations do not work. What I did was to clone the vendor supplied permission set and then systematically take away all of the pemissions and rights whilst checking that the roll up functionality still works. I realise this may be difficult to conceptualise from my brief overview, but the main point is that I stripped all of the CRUD object permissions, apex class access and visualforce access and everything visible from the cloned permission set and the roll up functionality works. So it is possbile that a permission set can 'carry' more infomation that can be seen purely from a UI perspective? I dont know what is going on? Can anyone assist? thank you!
Hi -   I am wanting to pass back the response string from this Webservice class, which is void by nature, to the trigger that is calling it. I have tried various methods by using a primitive string reference and also creating a new class with s string variable inside it but havent been able to get the string result back. Below is the code for the Webservice class.
public with sharing class ELO_Webservice {
    @future (callout=true)
    public static void CallWebService(String body, String respStr)
    {
       Http http = new Http();
		HttpRequest request = new HttpRequest();
		request.setEndpoint();
		request.setMethod('POST');
		request.setHeader('Content-Type', 'application/json;charset=UTF-8');
		// Set the body as a JSON object
		//System.debug(body);
        request.setBody(body);
       	');
        
        HttpResponse response = http.send(request);

		// Parse the JSON response
		if (response.getStatusCode() != 200) {
    		System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
		} else {
    		System.debug(response.getBody());
		} 
       
        respStr.responsestr = response.getBody();
        System.debug('responsestr = ' + respStr.responsestr);
        
    }


This is the call from the trigger
ELO_Webservice.CallWebService(body, eResponse.responsestr);
Hope this is clear. Many thanks

 
We need to simulate running monthly scheduled batch apex jobs over multilple months/year to see mutiple records instances being recaluculed over time.

I can see that there are some comments from 2011 saying that this is not possible but just wanted to check in 2019? I am guessing not but just thought to ask.
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId = '0692O0000003CSTQA2']; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}
Hi Guys - I am working with ContentFiles and am trying to get a list to populate with some values from the ContentDocumentLink object. The code above (with hardcoded value) works fine and returns the values. However when trying to do it referencing the set variable (contDocId) in the code below I get no values returned. The contDocId is being pulled correctly too (which is the hardcoded value).
public class ELOUpload_Class {
   
    public static void ELOUpload_Method1 (List<ContentDocument> lstContentDoc) {
      
       //Create a set of all the incoming IDs
        Set<Id> contDocId = new Set<Id> (); 
            
        for (ContentDocument contDoc : lstContentDoc ) {
            
           contDocId.add(contDoc.Id);
          
        }
        system.debug('contDocId = ' + contDocId );  
        
        List <ContentDocumentLink> contDoclink = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId IN :contDocId]; 
        
        system.debug('contDoclink   = ' + contDoclink );      

    }
}
Now sure how to proceed? - many thanks for any assistance