Be Good & Do Good!

Tag: Salesforce (Page 6 of 11)

Salesforce Spring ’10 – Changes to Custom Object Permissions

What is the change?
In Spring ‘10, when you create a new custom object, the “Read,” “Create,” “Edit,” “Delete,” “View All,” and “Modify All” permissions for that object will be disabled by default. After the Spring ’10 release, you must specify which users should get access to custom objects.

Note: You can only change the object permissions for custom profiles, not standard profiles. As a result, users with standard profiles (except System Administrator) will not be able to access custom objects created after the Spring ’10 release.

How will this change impact me?
If you have users assigned to standard profiles, clone these profiles and reassign your users to the newly created profiles. Then, when you create a new custom object, you will edit the user profiles to enable object permissions. Additionally, you can use enhanced profile management to edit multiple profiles at once.

Note: For custom objects created before the Spring ’10 release, access to these objects will not change. Therefore, standard profiles will continue to have access to custom objects created prior to the Spring ’10 release.

When is this change taking place?
This change will be made with the Spring ‘10 release. Please check http://trust.salesforce.com/trust/status/#maint to understand when your instance will be upgraded.

Salesforce: Eliminate Scrollbars

Source : http://www.interactiveties.com/b_remove_scrolls.php

Many new salesforce.com AJAX developers ask me how I am able to build my sControls into a frame and get the sizing setup in such a manner to prevent scrollbars. Over the years I’ve tried many different JavaScript functions but found that one works better than any I’ve seen.

For those reading this that might be unfamiliar with what I’m referring too I’ve included a screenshot.
In some instances an AJAX developer may want to build a sControl into salesforce.com whereby the sControl is embedded into the page. Basically there are tabs at the top and the navigation bar on the left-hand side with the sControl on the right-hand side.

When the web tab containing a sControl is setup through the Salesforce.com user interface the developer is allowed to dictate the size of the frame in which the sControl gets loaded. In most cases these new developers will simply alter that frame size to account for the largest height that may occur in the sControl. However, the script that I will eventually share with you will allow these developers to now ignore this pixel height setting and resize the frame dynamically.

I started using the script a year or two ago and a few months ago I altered it a bit because I was still getting scrollbars in Firefox. I found that the scrollbars didn’t always occur but I wanted to account for the percentages and try to eliminate them in entirely. Therefore, I decided to add a line where I determine if the browser is Firefox and then add 10 pixels to the adjusted frame height. I found that this truly eliminates the vertical scrollbars in almost 100% of the instances where I’ve used this script.

//resizes the frame holding the sControl to make up for odd dimensions
function resizeFrame()
{
var sframe = parent.document.getElementById("itarget"); //get id of iframe from parent
if (navigator.userAgent.indexOf("Firefox") != -1)
{ //if Firefox
var nHeight = document.body.scrollHeight+10; //add ten pixels to height of sControl frame
}
else
{ //otherwise
var nHeight = document.body.scrollHeight; //use the returned height of sControl frame
}
sframe.style.height = nHeight+"px"; //set the frame height to correspond to the content
}

And it can be called using this line:
resizeFrame(); //calls function from above

I hope you find this useful or can tweak it to meet your needs.,

Salesforce – URL hack to close an opportunity

Requirement

I’d like to create a button on Opportunities that does several things:
1.) Closes the Opportunity (Stage = Closed Lost)
2.) Makes a custom field have a specific value (Opportunity Lost Reason = “Wrong/Bad Number”

Solution:
Here’s the URL behind the button:

/{!Opportunity.Id}/e?retURL={!Opportunity.Id}&opp11=”Closed Lost”&00N80000002eg5T=”Wrong/Bad Number”&save=x

Where

00N80000002eg5T is the ID of the “Opportuntiey Lost Reason” custom field!
opp11 is the SF field name for Stage standard field in the layout.
save=x will automatically save the record after the changes are made.

Apex Code to Invoke an External Web Service

To invoke an external service after using its WSDL document to generate an Apex class, create an instance of the stub in your Apex script and call the methods on it.

For example, to invoke the StrikeIron IP address lookup service from Apex, you could write a script similar to the following:

// Create the stub
strikeironIplookup.DNSSoap dns = new strikeironIplookup.DNSSoap();

// Set up the license header
dns.LicenseInfo = new strikeiron.LicenseInfo();
dns.LicenseInfo.RegisteredUser = new strikeiron.RegisteredUser();
dns.LicenseInfo.RegisteredUser.UserID = ‘you@company.com’;
dns.LicenseInfo.RegisteredUser.Password = ‘your-password’;

// Make the Web service call
strikeironIplookup.DNSInfo info = dns.DNSLookup(‘www.myname.com’);

Read More @ Salesforce.com

Salesforce Web service Callout Limits(Timeouts)

The following limits apply when an Apex script makes a callout to an HTTP request or a Web services call. The Web services call can be a Force.com Web Services API call or any external Web services call.

  1. A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.
  2. The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 60 seconds. See the following examples for how to set custom timeouts for Web Services or HTTP callouts.
  3. The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction.

The following is an example of setting a custom timeout for Web services callouts:

docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds

The following is an example of setting a custom timeout for HTTP callouts:

HttpRequest req = new HttpRequest();
req.setTimeout(2000); // timeout in milliseconds

Salesforce Java Application to export Attachments – Appreciation …

Following are few appreciation notes from client, manager and team member ….

Ajay Kumar – Chirag chipped in early to find more details about this and got a fix in couple of long working days!! I would like to take this opportunity to appreciate Chirag’s terrific contribution and dedication on this. Bravo Chirag!! 🙂 U ROCK!!

Sue Gausch – I have already sung Chirag’s praises on this one, and will definitely continue to do so

Ajay Kumar – Chirag has been terrific in deliveries through past 6 months with wonderful client feedback. He has been instrumental in making a brand name for TATA’s.

Sunil Chauhan – Last few months have been nothing but great as far as your work is concerned. I have heard many good things about you in Dreamforce and now in Staples. I would love to imbibe your attitude and work ethic in the newbies who join our group. Keep up the good work and thanks for all your hardwork.

Salesforce – Move Attachments from 1 Organization to another

If you want to migrate from one org to another, then you first need to get a Weekly Export Service download. Make sure you check the “Include attachments” box. You will get an attachments.csv and the actual attachments.

The key to importing attachments is a little known feature inside Data Loader. The part that is not documented is that the import wants the actual filename in the BODY field. So for example, the attachments themselves have a ID name, let’s say its 123456789 and it is on your hard drive in the C:\Export folder. So in the BODY field you need to put C:\Export\123456789.

The only fields you need in the import file are – ParentId, Name, IsPrivate, OwnerId and Body.

Salesforce – Stop Recursion of Trigger Execution

Suppose there’s a scenario where in one trigger perform update operation, which results in invocation of second trigger and the update operation in second trigger acts as triggering criteria for trigger one. In that case there will be a recursion and than will be Apex Governor Limits Errors .. bla .. ala .. bla ….

Following are two articles which helps to control or regulate the execution of multiple triggers and prevent recursion.

http://www.tehnrd.com/apex-flow-control-preventing-infinite-loops/

http://blog.jeffdouglas.com/2009/10/02/preventing-recursive-future-method-calls-in-salesforce/

« Older posts Newer posts »