• J. Poston
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 2
    Replies
I've created a custom Related List lightning component for a Custom Object with master-detail to Case because of some special behaviors needed.
When I add or delete Items, my component does not know to refresh.

I've tried to 'listen' for changes by using Lightning Data Service on Case object but it's not triggered by changes in related list.

Is there another easy way to accomplish what I'm trying to do, other than some sort of PushTopic/Streaming API solution?
I am rendering a Knowledge Article rich-text body field on a visualforce page in an apex:outputText field. Some of these articles have wide images that are getting cut off on the right side of the pdf page.

Is there a way to wrap this field or specify something via CSS to fit the images to the page width? Or, to expand the page width to the image width?

I am trying to avoid searching all articles and manually resizing all images.
Something broke in a Napili community I'm developing and not sure why or how I can fix it.

Any links to Case object are redirecting to the generic Record Detail page instead of the Case Detail page.

When I start a new Napili Community from scratch, Case links go to Case Detail as expected but I'd rather fix what I have than rebuild everything. Especially in case something like this happens in production.

Any ideas?
I recently had to refresh my sandbox which wiped out my sandbox specific connected apps.

I've recreated them and cannot get past this error. In the past I was able to go to https://test.salesforce.com/services/oauth2/authorize?client_id=[client_id]&redirect_uri=[redirect_uri]&response_type=code and accept the app. I have done this. The user even shows up in the "Connected App User's Usage" list. But no matter what I do or how many times I create new apps or change this or that setting I continue to get the same error:
"invalid_grant" "user hasn't approved this consumer"

I am at wits' end.

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}

 

I had a bit of trouble finding the solution to my relativley simple problem, set up a bunch of default objects via a static resource instead of using the data loader.

 

This page was useful, it focuses on creating and reading from a csv via apex:inputFile

http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html

 

Turns out you can simply query the static resources and split it all up manually so long as you know the order of the fields in the CSV (my static resource is a straight-up csv, no zip)

 

 

        StaticResource defaultResource = [Select  s.Body From StaticResource s where s.Name LIKE 'resourceName%'];
        blob tempB = defaultResource.Body;
       	String contentFile = tempB.toString();
       	String[] filelines = contentFile.split('\n');
    	List<object_to_Create__c> defaults = new List<object_to_Create__c>();
       	for (Integer i=1;i<filelines.size();i++)
        {
        	object_to_Create__c temp = object_to_Create__c();
                String[] inputvalues = filelines[i].split(',');
        	temp.Field1__c = inputValues[0];
        	temp.Field2__c = inputValues[1];
        	defaults.add(temp);	
        }
        insert defaults;

 I hope this saves some developers time, because i was suprised as to how little i was able to find out there