May I customize 'edit custom object records' page layout on SalesForce? - salesforce

For example, to create or edit an object, when I want to add or change some value to one specific field, I need to refer another website to retrieve some info.In this way, may I add one button or link on the edit page?
The help link of SalesForce is here: https://help.salesforce.com/apex/htviewhelpdoc?id=co_edit.htm&language=en_US
Thanks.

Custom buttons and links don't display on new/edit page layouts so even if you'd make one, it will be visible only on detail view.
Not too invasive option would be to create a URL or text fied, set it's default value to your link, make sure it's displayed on the page but readonly. Haven't tried it but should work (you'll have to test it as somebody other than System Administrator because you'll bypass the readonly property of the page layout).
More invasive option would be to override the new and edit page layouts with Visualforce. More work but somewhat clean solution.
Really crazy option would be to embed a piece of Javascript into section header on the standard page layout or even into sidebar. It's an ugly hack but it works, I've used it for example to disable editing of Name field.
To use method #3:
create new section header, add something to the section (blank space is fine, you need something otherwise headers for blank sections aren't rendered), mark the section as visible on edit pages only.
Section name has limit of 80 characters but can contain code like <script>document.getElementById('Name').disabled = true;</script>. You need longer script though to somehow create an URL at runtime and append it somewhere on the page near your "special" field.
Upload a static resource with your script, then use this as the section header: <script src="filename.js" type="text/javascript"></script>
I'm not too proud of this hack and if you can - go with custom Visualforce new & edit page. It's quick & dirty, probably should be used only when you're not allowed to override pages.. but it works.

Related

Custom Theme template in Drupal 7

I know, if you want to check the names of the Display Output of the view page then we need to click on the Information Link near by Theme of Advance Theme of the view, it will list all the files.
After clicking on this, it will list.
Display Output : (View Machine name is add_to_cart)
views-view.tpl.php, views-view--add-to-cart.tpl.php, views-view--default.tpl.php, views-view--default.tpl.php, views-view--page.tpl.php, views-view--add-to-cart--page.tpl.php
So, could you please suggest which files should be best for creation of the Display Output template of the view page ?
If you want specific theming to your page display of add_to_cart view, then choose
to override views-view--add-to-cart--page.tpl.php.
I'll also want to add the importance of naming convention for templates, so that, next time, you can choose the template name yourself:
views-view.tpl.php: called for every view.
views-view--add-to-cart.tpl.php: called for only add_to_cart view.
views-view--default.tpl.php: called for the display: default(master display) of every view.
views-view--page.tpl.php: called for the display: page of every view.
views-view--add-to-cart--page.tpl.php: called for the display: page of only add_to_cart view. (the specific suggestions are always last)
Note:
Template naming suggestion flow: general to specific.
Also when you click the display output, you can copy the code for the template. This way you get all the variables that are available to you.
Hope this help else comment for queries.
Understanding how default, page comes in template names:
Within a view, you can create many displays as shown below.
Each display has a Machine Name, for eg: System display has a machine name: system_1. So, a view with system_1 display will be overrided using views-view--system-1.tpl.php. Note: the underscore('_') is replaced with hyphen('-'). The by default view display or master display in a view has a machine name: default.

Salesforce Custom field in Edit Page ONLY

I wanted to display a custom field as Read-Only on the Edit page ONLY of a custom object. This field should be hidden on the detail page. I tried wrapping the field in a section and display the section in Edit Page only(Page layout editor). That didn't work. I don't want to create a custom visual force page for the EDIT Page. Please suggest.
Thanks
Kumar
Unfortunately, there's no way to put a field on just edit or just detail. It's both or neither.
You have two options, custom Visualforce page as an Edit override is the easiest one, but if you want to leave the page layout editor as something useful to admins, there's also a very hacky option...
Create two record types, one that displays the field and one that doesn't. Create a new button that launches a Flow (with a return URL of the edit page for that object). The Flow should change the object's recordtype to the one that displays the field. Additionally, create a Process or trigger that changes the recordtype back to the one that does not display the trigger after you save the object.
I definitely recommend the VF page...

Drupal 7 - how can I control content layout in a view?

I've been handed a design spec which requires a news listing in a specific format - e.g. image floating to the left, with the main title and content on its right.
I've created the articles listing using the views module and embedded the view as a block on the front page. However, I need to change the layout of the resulting list of items at an html level, as the items are not provided in the order or within the html tags that I need in order to deliver the design.
In order to style the output, I really need the views module to give me fine-grained control over the html tags being wrapped around each field for each article.
Is this possible in Drupal?
(edit: please note, this is not a css question - I know how to float and position things in css. I need to be able to modify the html tags applied to fields in a view - thanks!)
When you go to your view, you will see FORMAT. You can change the Format to HTML list with corresponding settings. Under Show, you will say Fields. In the FIELDS area, choose which content you want enabled. Let me know if this helps, or if you want more of an explanation. Go back into your view and click on your field. The next window that pops up should be to configure that field. You'll see style settings where you can define the HTML tags, classes, wrappers, etc.

Visualforce Custom lookup visualforce page

I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.
Here's what I'm trying to achieve:
When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.
Is this even possible? What other ways would you suggest going about this?
Here's a screen shot of what I'm trying to change:
Thanks for all your help!
It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.
If you really need a custom solution:
You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.
yeah its possible by javascript as i did by visual force page that will show the records of related lists and upon selection id of that record passed to parent window by jscipt. and performed same functionality ..
As far as I know - NO.
As a workaround you can use JavaScript.
What we did in our situation? We implement everything in JavaScript. We created an inputText and right on the right of this inputText we placed image with this lookup icon. On image click we create ExtJS popup window (I think you can simply create VF page and show this page in popup window). After window was closed you fill in the inputText field.
There's no out-of-the-box override for this button, last I checked, so something custom would be required. If you're set on having a popup and do not want an inline solution, I'd recommend reviewing this tutorial to get familiar with some of the issues with popups in Visualforce.
But considering what you are looking to accomplish, you could also have your account and filtered list of all contacts associated with that account appear inline on your page when the user clicks a new, custom search button. Of course that page would itself be in Visualforce (or inline Visualforce in a standard page layout) - which you may or may not want to have to code and maintain.
The AJAX Toolkit might also be a good place to start if you want to go with a custom JavaScript button placed on a standard page layout.

Drupal 7 add block of text to front page

I'm new to Drupal but I've found my way around it pretty easily. There's just one thing I haven't found out how to do, and it's so simple it has to be possible.
I created a template for the site's homepage as it will have a different layout (did it creating page--front.tpl-php). This page will display only the main menu, an image and a text of the company's mission statement. I've done everything but the mission text and I have no idea how to do just that: simply put a block of text there.
I know I can hard-code it on the HTML but I want my client to be able to change it eventually if he wants to, in a graphic way. I tried creating a content type but I can't remove the title field and some submitted info; I thought of using Views but it seems too complicated for what I need, isn't it?
The image I used is hard-coded on he HTML as I know it won't change, but maybe I should have created a view with both the image and the text? But then how would I get rid of the title field and submission info?
Can someone please suggest the best way, if possible, to do this? Perhaps I'm over-complicating.
Thank you.
The easiest way would be to create a region in your theme and then put a block into that region only on the home page.
In mytheme.info:
...
regions[front] = Front Page Text
...
In page--front.tpl.php:
echo render($page['front']);
Then in your blocks administration page create a block and assign it to the "Front Page Text" region with the content you want to output. You could also limit the block's visibility to <front> if you want to be sure, although if you don't output that region in any other template file it shouldn't make a difference.

Resources