• RJ Palombo
  • NEWBIE
  • 0 Points
  • Member since 2010
  • Solutions Architect
  • Fiserv


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
I am going through the rigorous process to do trailhead on my personal account and not my work account. I've revieced 100% on everything on my old account... Going through https://developer.salesforce.com/trailhead/force_com_dev_beginner/starting_force_com/starting_tour
i got 50% and the app said I need to fill out one of the questions which was already filled and for some reason unchecked my answer leaving NO response for 1 question. 

I've been deducted 50 points which I think is terrible. Any chance on getting this rectified? I don't like knowing and submitting the 100% correct answers only to get less points.

Hi folks,

 

We've got an application that is running through a bunch of job items in an Apex Batch execution.  We're wondering if there might be a general understanding on the relative speed at which Apex Batches are executed in sandbox environments versus production environments.  We're assuming that sandboxes probably get less resources thrown at them, and would likely be slower to process Apex Batches.

 

While I figure SFDC isn't going to have hard numbers on this, do other developers have a general sense based on experience? 

What do I need to set if I want a gzippped CSV result response for a bulkapi query ?  I can get the CSV but cannot seem to get it compressed.

 

I have tried setting the Content-Type of the GetResult GET to gzip but that has no effect.

 

I have also tried changing the ContentType of the JobInfo to ZIP_CSV but that does not work either.

 

Thanks,

 

Bill

Hi,

 

I've got a batch job that works well in manual testing, processing multiple records in each batch without any issues. However my unit test fails if I set the scope greater than just 1 record with a "System.UnexpectedException: Error processing messages". I'm stumped, does anyone know what this cryptic exception means?

 

Thanks a lot,

Mike

Hey all,

 

This is one of those questions when I feel like I'm probably going about a simple process the wrong way and over complicating it, but I'm not sure the alternative. So I'll ask my question and if you have a better approach, please feel free to share.

 

The deal is that I have an Apex REST service that allows a user to pass in an object type, and any field values in the URL.

EX : http://na2.salesforce.com/apex/reservice/contact?firstname=frank&lastname=jones&age__c=21

 

My code works fine for any string values, but chokes on numerics. Because I instantiate a new instance of the type of object they pass in, then I loop over all the fields in the query string and dynamically add them to the sObject. Of course as far as apex is concerned all those arguments in the query string are in fact strings, so when adding non string things to the sObject it explodes. 

 

Ideally I could use the get describe info about the field I'm inserting to find it's type and cast the value to be inserted to the correct type, but as far as I know there isn't a way to do dynamic casting at runtime. A series of if statments is about the only alternative I see, but that feels really dirty. 

 

This is what I have currently (you can see I'm kind of using the if statment path, trying to make it as simple as possible).

 

Just to be clear, this code works, it's just not as efficient/dynamic as I'd like.

 

    public static sObject saveSObject(string objectType, string recordid, RestRequest req)
    {
        //create a generic sObject to contain the update values.
        sObject updateObj;      
                
        //get the describe object for the type of object passed in (its just passed in as a string from the URL)
        Schema.sObjectType objectDef = Schema.getGlobalDescribe().get(objectType).getDescribe().getSObjectType();
        
        //find all the fields for this object type
        Map<String, Schema.SobjectField> ObjectFieldsMap = objectDef.getDescribe().fields.getMap();
        
 
        //this method can handle updates or inserts. If a record ID was passed in, 
        //cast the object as the type represented by the ID. If not, just create a
        //new object of the type found in the object describe.
        if(recordId != null)
        {
            updateObj = objectDef.newSobject(recordid);
        }
        else
        {
            updateObj = objectDef.newSobject();
        }    
        // populate the object's fields by looping over all the params in the rest request.
        for (String key : req.params.keySet())
        {
            // only add params if they are valid field on the object
            if (ObjectFieldsMap.containsKey(key))
            {
                //figure out the type of this field so we can cast it to the correct type
                string fieldType = ObjectFieldsMap.get(key).getDescribe().getType().name().ToLowerCase();
                
                //since I don't know how to do, or if it's even possible to do dynamic casting we need a 
                //series of if statments to handle the casting to numeric types. I think all the others should
                //be fine if left as a string. Dates might explode, not sure.
                
                
                if(fieldType == 'currency' || fieldType == 'double' || fieldType == 'percent' || fieldType == 'decimal' )
                {
                    updateObj.put(key, decimal.valueOf(req.params.get(key).trim())); 
                }
                else if(fieldType == 'boolean')
                {
                    updateObj.put(key, Boolean.valueOf(req.params.get(key))); 
                }                   
                else if(fieldType == 'date')
                {
                    updateObj.put(key, date.valueOf(req.params.get(key))); 
                }                
                else
                {
                    updateObj.put(key, req.params.get(key));
                }
            }
            else
            {
                system.debug('Invalid field: '+ key + ' for object type ' + objectType);
            }
        }
        //update/insert the object
        upsert updateObj;
        
        //return the saved object.
        return updateObj;
        
    }

 

I use a dark color scheme with debian and it's made it difficult to see the eclipse IDE (force IDE). Is there no way to customize the color settings? Seems silly, as *every* other editor I use allows this.

I would like a user to be able to click a link to increase the size of the page layout section (iframe). Is this possible?

 

Im having trouble but this is what I am trying. I see I am able to return the size of the document and window, and the returned size is correct but I am not sure how to set the height or if I can.

 

in my scenario the iframe is 500px in sf page layout editor and jQuery returns the document size as 3900px.

 

I notice sf is not using css for the iframe instead their using the actual height attribute in the iframe. is the problem that jQuery is trying to change the css height value and it cannot find any css height value to begin with?

 

	   	jQuery("#more").click(function() {
	   		
	   		var i = jQuery(document).height();
	   		
	   		jQuery(window).height(i);
	   		
	   	});

 

 

ive tried targeting the actual ID of the iframe i want to change instead of "window" but its doing the same thing , which is nothing.

 

thank you for any advice.

So what I am trying to accomplish is to upsert  List<sObject> with a field specification of what the external Id is. However this is the error message I get back when I try to save the class.

 

List<sObject> newlist = new List<sObject>();

 

upsert newlist ext_Id__c; (Error Msg: "Upsert with a field specification requires a concrete sObject type)

 

 

Any idea of a way around this?

 

 

Hello,

 

Does any one know if there is a way to setup a default dashboard for all users? We would like a specific dashboard to display on users' homepage. Is there a way to do this easily?

 

Thank you!

SB

  • April 23, 2009
  • Like
  • 0