function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mknobmknob 

Create a simple Button

Hi,

 

i'm new in Apex and Salesforce. My Question: Is it possible to programm in Apex a button, which is shown on the Opportunity site? The code have to be written in SETUP | CREATE |  APPS an not in a programming environment.

MSSBMeghanMSSBMeghan

You can develop in Apex in a Sandbox or Developer account - no need to go the IDE route if you are not familiar/comfortable with that approach.

 

What are you trying to do with this button?  There are a lot of ways you can create buttons that don't involve apex, depending on what you are trying to do.

 

When you say "Opportunity site" do you mean something other than the standard Opportunity Object?

 

Post some more detail about what you are trying to do with your button and people will help out - lots of smart, savvy SF folks here that can guide you through your challenge.

mknobmknob
For practice i wont a button on the standard Opportunity site. When i klick these Button a new window should apper which listed all Opportunities.
MSSBMeghanMSSBMeghan

This happens to be a very good example of an opportunity to use the VF pageBlock element, creating a page that can then be positioned in the default page layout.  This isn't a terribly tricky exercise in VF, but it sounds like you're not too keen on coding.

 

Your button can be created using a custom URL taking advantage of the ability to pass values as needed.  Custom URLs are great for a non-coder - once you get the syntax it's amazing what you can do with them.

 

In your instance the following should work:

 

Since the Opportunities sit as a related list on the account all you have to do is grab the URL and substitute the hardcoded account ID with a merge field.  There's a standard view and a printable view - you can do this with either:

 

Standard

 

 

https://YOURINSTANCE.salesforce.com/006?rlid=RelatedOpportunityList&id={!Account.Id}

 

if you add isdtp=mn to the end of your URL it will prevent the nested frame issue that can occur, especially when using a custom link in an S-Control or VF page.

 

 

 

Printable View

 

 

https://YOURINSTANCE.salesforce.com/006/x?id={!Account.Id}&rpp_sticky=false&rlid=RelatedOpportunityList

 

One thing that is nice about the printable view is that tthere is very little clutter, no sidebar/header but none of the opportunities are clickable.  The standard gives you access to drill down into the opportunity - although not sure how great that would be from a popup.  I think the only way to strip the header and sidebar is in VF using the showHeader="false" attribute - but there might be a URL solution to remove the header. 

 

In either case remember to change the YOURINSTANCE and you should be able to get this to work.