• pablo Martinez 4
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Whan equipment is assigned to the Employee, the Employee should be copied to Equipment object, so we can see this information in the details screen.

 

Please, help. I don't know how to do this

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

 

 

Hi,

 

I'am a complete newbie to salesforce in fact just got it today.

 

my question is does the PHP toolkit allow file uploads, if so

could somebody show a sample code

 

Thanks in advanced.