• Varsha
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello,
 
I have distributed a unmanaged package with custom feilds in the past. Now I want to go for the managed package without custom fields. I am using custom feilds in the Scontrol. But when I add this component in the package it takes customes fileds as well and does not allow me to delete it. Is there any way by which I can prevent the addition of custom feilds to the package.
 
Looking forward for the help....
I've promised to post a how-to kind of document after the Winter '06 release, but my time is rather short at the moment. I'll get to it eventually with some example, in production code, but it won't be for a bit yet... Given the number of posts here and elsewhere asking how to do this I thought I'd give some of you a head start. But first a small disclaimer:


WARNING: READ THIS FIRST

THIS TECHNIQUE IS NOT SUPPORTED BY SALESFORCE.COM -- IF YOU HAVE ANY PROBLEMS, DON'T EVEN BOTHER CALLING
READ THIS ENTIRE POST BEFORE ATTEMPTING THESE CHANGES. If you make a mistake you may render your page layout unuseable and uneditable. Possibly even undeleteable.

USE AT YOUR OWN RISK


You can modify actions in the UI on the following pages:
Any Standard or Custom Object Display, Edit, or Print Preview Page, and the user's Home Page

You cannot modify the UI using this method on report pages, the setup pages, and probably several other locations I can't think of at the moment.


What you will need to do is to write some JavaScript code that will execute on the client-side that will locate using the browser DOM the elements you want to edit. For example I change the destination of a "New" button on one of my related list entries. Because there are multiple "New" buttons on the page you will need to check the SFDC-provided destination of the link. It so happens that the related list is a custom object who's id's start with "a00", so I check the link for the string "/a00" and then alter accordingly.

Once you have your JS code you need to get it to execute on the browser.

First create a new Custom S-Control in setup. Give it an appropriate name, and paste your JS code you've written into the "HTML Body" section. Don't include any HTML in the JS, but do include the HTML/JS comment delimiter open/closings on your code. Save your control and view it. You should have a URL that starts with https://na1.salesforce.com/01N... Take note of the object ID (the 01N...
part) and continue on...

If this code will execute on the home page you'll need to have the "Messages and Alerts" home page component enabled. Edit it, and create a HTML script tag with the src url:

/servlet/servlet.Integration?lid=01N...&enc=UTF-8

Replace 01N... with the object ID you saved above.

That's pretty easy, and really doesn't push the limits too far, but how do we get the code to execute on the individual object pages? Ah ha...

WARNING: Again, this is not supported by SFDC, and if done improperly could break your page layout(s). SFDC may decide this is a bug and patch the system, breaking this method. Proceed at your own risk.

In the Page Layout you can give section headers custom names (with some exceptions). These section names are allowed to be very long, and allow you to use unfiltered HTML. One word of caution, when you make these changes below, use a copy of your page layout. If you make a typo, like forgetting a less then or greater then symbol you will break the HTML on the page and very likely break the ability to delete the section or edit it further. You have been warned!

1. After cloning your page layout, edit it and edit a section name. 2. If your section name before was "Section" insert an HTML script tag in front or behind the section name in the same format as the one above in the HTML message box. 3. Save your layout.

Some cautionary words - again, do this at your own risk, but the abilities this leaves us are seemingly unlimited. Do note that straight JS code will execute as the page is loading, not after it completes. You'll need to hook an on-load event to the page to delay execution until after the load is complete.

I'm sorry I couldn't post the actual script tags and whatnot but the forum tends to actually render those as HTML, not as text.
  • January 12, 2006
  • Like
  • 1