• Alex Reading
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hey All,

I was wondering how I can implement an image map in a visual force page that we are using.

Below is my current code:
<apex:page showheader="true" controller="imagemap">
<apex:form >
<apex:image value="{!$Resource.HomePageImage_BSJ6}" usemap="#mymap" />
<MAP name="mymap" id="mymap">
<UL>
<LI><apex:outputLink value="http://www.google.com" Shape="rect" Coords="700,360,870,200"></apex:outputlink></LI>
</UL>
</MAP>
</apex:form>
</apex:page>

This code seems to display the image when viewing the page however there are no links and interactivity available from that image, can anyone help with image maps and their basic structure? Also - The above example is pointing to Google.com - What would I need to enter in the value once it is working to point to another VF Page? So I can navigate?

Any Help would be greatly appreciated!

Kind Regards,
Hey All,

My question is regarding custom buttons.

I was wondering if it is possible to have a button on the Quote Object, which when clicked by the user; will update a field on the corresponding opportunity?

The field I was to update is a custom checkbox field which I want to be changed from FALSE to TRUE when the button is clicked, is this possible?

Thanks
Hey Guys,

Let me apologize in advance because I am a complete Newby when it comes to Test Classes in Apex - Unfortunately I have been tasked with moving an Apex Trigger that I created from Sandbox to Production. I figured out how to do this using changesets but the trigger won't deploy due to it failing some tests. I realise that I need to write a test class before deploying the trigger and that is where I am stuck. Below is my APEX Trigger - Pretty standard for creating a quote when an opportunity is closed-won and has already had a quote synced with it. The HasQuote__C field is a formula checkbox that is true when a quote has been synced with the opportunity. You can see the opportunity line items are being picked up and used as QuoteLineItems in the created quote.

trigger InvoicefromQuote on Opportunity (after insert, after update) {
     for(Opportunity o: trigger.new){
      if(o.isWon == true && o.HasOpportunityLineItem == true && o.HasQuote__C == true ){
         String opptyId = o.Id;
         String opname = o.name;
         OpportunityLineItem[] OLI = [Select UnitPrice, Quantity, PricebookEntry.Product2Id, PricebookEntry.Product2.Name, Description, Converted_to_Asset__c 
                                      From OpportunityLineItem
                                      where OpportunityId = :opptyId];
         quote[] quote = new quote[]{};
         quotelineitem[] qli = new quotelineitem[]{};
         
         quote a = new Quote();
         a.name = 'Invoice for ' + o.name;
         a.recordtypeid = '012D0000000jWpqIAE';
         a.opportunityId = o.id;
         a.Pricebook2Id = o.Pricebook2Id;
         a.description = 'This is an automatically generated invoice - because the opportunity: (' + o.name +') was closed won with an (Create Invoice Enabled) Quote' ;
         insert a;

        
         for(OpportunityLineItem ol: OLI){
            quotelineitem b = new QuoteLineItem();
            b.PricebookEntryId = ol.PricebookEntryId;
            b.UnitPrice = ol.UnitPrice;
            b.Product2Id = ol.PriceBookEntry.Product2Id;
            b.Quantity = ol.Quantity;
            b.QuoteId = a.id;
            insert b;
           
}
}
}
}

Any help or examples that anyone can provide on how I can smoothly move this over to our production environment would be greatly appreciated, any questions or requests for info welcome.

Thanks in advance.
This is just a general conept question really.

I want to know if there is anyway of automatically generating a PDF Quote from a specific Quote Template in Salesforce and attaching it to the Quote object.

The idea is that, for example, if the quote is created with 'Europe' in its name - a pdf is autogenerated using our Europe Template and attached to the quote.

This sounds pretty complex hense why I was wondering if its at all possible.

Thanks,
Hello All,

I currently have an APEX trigger which (when an opportunity has a QUOTE and is closed won), creates a second quote (which will be used as an invoice)

I was wondering if anyone can help me with possibly editing this code to also pull the Opportunity Line Items and add a quote line item for each one in the new automatically generated quote?

For example, If I have the Opportunity Line Item "Dog" from the "Animals" Pricebook at "$100" how can I change the code to not only automatically create the quote but also add a Quote Line Item for a $100 Dog?

Here is my code:

trigger InvoicefromQuote on Opportunity (after insert, after update) {
Map<Quote, Id> quoteMap = new Map<Quote, Id>();
for (Opportunity o : Trigger.new) {
if(o.isWon == true && o.HasQuote__c == true ){
Quote q = new Quote();
q.name = 'Quote-' + o.name;
q.opportunityId = o.id;
insert q;
quoteMap.put(q, o.accountId);
}
}
}

Any help you can provide would be great!


Thank you!


Hey All,

I was wondering how I can implement an image map in a visual force page that we are using.

Below is my current code:
<apex:page showheader="true" controller="imagemap">
<apex:form >
<apex:image value="{!$Resource.HomePageImage_BSJ6}" usemap="#mymap" />
<MAP name="mymap" id="mymap">
<UL>
<LI><apex:outputLink value="http://www.google.com" Shape="rect" Coords="700,360,870,200"></apex:outputlink></LI>
</UL>
</MAP>
</apex:form>
</apex:page>

This code seems to display the image when viewing the page however there are no links and interactivity available from that image, can anyone help with image maps and their basic structure? Also - The above example is pointing to Google.com - What would I need to enter in the value once it is working to point to another VF Page? So I can navigate?

Any Help would be greatly appreciated!

Kind Regards,
Hey Guys,

Let me apologize in advance because I am a complete Newby when it comes to Test Classes in Apex - Unfortunately I have been tasked with moving an Apex Trigger that I created from Sandbox to Production. I figured out how to do this using changesets but the trigger won't deploy due to it failing some tests. I realise that I need to write a test class before deploying the trigger and that is where I am stuck. Below is my APEX Trigger - Pretty standard for creating a quote when an opportunity is closed-won and has already had a quote synced with it. The HasQuote__C field is a formula checkbox that is true when a quote has been synced with the opportunity. You can see the opportunity line items are being picked up and used as QuoteLineItems in the created quote.

trigger InvoicefromQuote on Opportunity (after insert, after update) {
     for(Opportunity o: trigger.new){
      if(o.isWon == true && o.HasOpportunityLineItem == true && o.HasQuote__C == true ){
         String opptyId = o.Id;
         String opname = o.name;
         OpportunityLineItem[] OLI = [Select UnitPrice, Quantity, PricebookEntry.Product2Id, PricebookEntry.Product2.Name, Description, Converted_to_Asset__c 
                                      From OpportunityLineItem
                                      where OpportunityId = :opptyId];
         quote[] quote = new quote[]{};
         quotelineitem[] qli = new quotelineitem[]{};
         
         quote a = new Quote();
         a.name = 'Invoice for ' + o.name;
         a.recordtypeid = '012D0000000jWpqIAE';
         a.opportunityId = o.id;
         a.Pricebook2Id = o.Pricebook2Id;
         a.description = 'This is an automatically generated invoice - because the opportunity: (' + o.name +') was closed won with an (Create Invoice Enabled) Quote' ;
         insert a;

        
         for(OpportunityLineItem ol: OLI){
            quotelineitem b = new QuoteLineItem();
            b.PricebookEntryId = ol.PricebookEntryId;
            b.UnitPrice = ol.UnitPrice;
            b.Product2Id = ol.PriceBookEntry.Product2Id;
            b.Quantity = ol.Quantity;
            b.QuoteId = a.id;
            insert b;
           
}
}
}
}

Any help or examples that anyone can provide on how I can smoothly move this over to our production environment would be greatly appreciated, any questions or requests for info welcome.

Thanks in advance.