• Paul Foley
  • NEWBIE
  • 10 Points
  • Member since 2016
  • Salesforce Admin
  • Coretex


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 3
    Replies
When editing a Lightning component in the App Builder I can add attributes that can be changed, but how do you add a block of static text?

User-added image
I've created a Lightning component that listens for a particular event (status changing on an opportunity) If the event occurs, it does some stuff for us, which includes a visual element. (this is why it can't be done via a PB/Flow or Workflow rule)

I would really like the component to only be visible when you are in the Lighting App Builder area, and not on the actual opportunity page. Is there any way to detect that you're in the app builder area? - I'm thinking if I can detect that I'll be able to hide the content (via css) in the browser.
 
Is it possibly to get my component to display something different in the app builder to what is rendered when viewed on a page?
We're building a custom conponent for a community, and wanted to know if there is a way to have some specific content appear only when the user is in the community builder?

Our conponent is used to conditionally pop a modal box, so normally nothing would show. The issue is that when the component is on the page in the builder, you dont know it's there unless it's selected.
Hey All,

I have a lightning component that makes a webService call to an Apex class that is designed to generate a quote document (pdf) and save it to a QuoteDocument record against the quote. When I call the class via a javascript button in classic it creates the PDF and attaches it as expected. However when I call the PDF document from a lightning action it doesnt. (The new quoteDocuement record is created, but the PDF document wont load)

I'm wondering if the PDF rendering issues in lightning are the cause of this? Does anyone know the specifics about why we can't render PDFs in lightning?

Below are some bit of code that may help to give some reference

Apex code to generate and save the PDF Doc
String quoteTemplateDataViewerUrl = '/quote/quoteTemplateDataViewer.apexp?id={!QuoteId}&headerHeight={!QuoteHeaderHeight}&footerHeight={!QuoteFooterHeight}&summlid={!QuoteTemplateId}';

PageReference pageRef = new PageReference(
    quoteTemplateDataViewerUrl.replace('{!QuoteId}', theQuote.Id)
                              .replace('{!QuoteHeaderHeight}', quoteHeaderHeight)
                              .replace('{!QuoteFooterHeight}', quoteFooterHeight)
                              .replace('{!QuoteTemplateId}', quoteTemplateId)
);
                
QuoteDocument qdoc = new QuoteDocument();
qdoc.Document = pageRef.getContent();
qdoc.QuoteId = theQuote.Id;
attList.add(qdoc);

Javascript Button code - called from the Classic Quote page when the button is click (this works)
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
 
var quoteId = '{!Quote.Id}';
var errorMsg = sforce.apex.execute("QuotePdfWs", "generateDraftProposalPdf", {quoteIdList:quoteId});
 
if (errorMsg != '') alert(errorMsg);
else window.location.reload();

Lightning controller.js - this one doesnt work :(
({
   generateProposal : function(component, event, helper) {
      var recordId = component.get("v.recordId")
      var action = component.get("c.generateDraftProposalPdf");
      action.setParams({"quoteIdList": [recordId]});
      action.setCallback(this, function(response) {
         var state = response.getState();
         if(component.isValid()){
            $A.get("e.force:closeQuickAction").fire();
            var toastEvent = $A.get("e.force:showToast");
            	toastEvent.setParams({
               	"title": "Success!",
               	"message": "A new draft proposal document has been created"
            	});
            	toastEvent.fire();
            $A.get('e.force:refreshView').fire();      
         } else {
            component.set("v.messageError", true);
         }
      });
      $A.enqueueAction(action);
   }
})


 
Hi All,

I'm putting together an invocable Apex method that gets called when an order is Activated.
The method loops around the products in the order (OrderItems) and create X number of Assets based on the quantity value of the order line.
This means I end up with a loop inside a loop. I'm not hitting limits yet, but am concerned that I could once we move the code to production.

Here's the offending code:
for(OrderItem prod : [select OrderItem.Product2.name, CurrencyIsoCode, id, Product2Id, Quantity, UnitPrice, OrderItem.Order.AccountId, OrderId from OrderItem where OrderId in : oids and OrderItem.Pricebookentry.product2.Is_Asset__c = true]){
            for (integer i = 0; i < prod.Quantity; i++) {
                Asset a = new Asset();
                a.name = prod.Product2.name;
                a.AccountId = prod.Order.AccountId;
                a.Price = prod.UnitPrice;
                a.Product2Id = prod.Product2Id;
                a.Quantity = 1;
                a.CurrencyIsoCode = prod.CurrencyIsoCode;
                a.Status = 'Purchased';
                a.Order_Product__c = prod.id;                

            	newAssets.add(a);
            }
        }

insert newAssets;



 
I want to automate some of our opportunity product functionality in relation to product revenue schedules.

We have a custom picklist field against the Opportunity called Opportunity Term which contains the number of month a contract could go for. ie 12, 24, 36 months etc. How can we set it up so that when a product is added to the opportunity (by way of adding it directly to a quote or directly to the opportunity) it uses the value in this field as the quantity for the revenue schedule? 

Also if this term is changed could we automatically update the revenue schedules somehow?
I'm having some trouble retaining a query string parameter on a page when i save it. 

My URL is along the lines of:
https://c.cs22.visual.force.com/apex/testPage?id=ABC123&uid=37b5a9a2-4541-46ad-b10a-fc4592793070
Where ABC123 is the id of the record I'm referencing.

Whenever I click the save button, and the save function is called in the corrosponding Apex class it redirects the user back to the page as expected, but the second parameter (uid) is missing.

I've included the guts of my save function below
public PageReference save(){
        PageReference currentPage = ApexPages.currentPage();           
        Map<String,String> currentPageParameters = currentPage.getParameters();
        PageReference nextPage = new PageReference('/apex/testPage');
        nextPage.getParameters().put('uid',currentPageParameters.get('uid'));
        
        // a bunch of code to actually save the data.
            
        return nextPage;
	}
I've tried a couple of examples from other pags but had no joy getting this working.
Hi All,

I'm putting together an invocable Apex method that gets called when an order is Activated.
The method loops around the products in the order (OrderItems) and create X number of Assets based on the quantity value of the order line.
This means I end up with a loop inside a loop. I'm not hitting limits yet, but am concerned that I could once we move the code to production.

Here's the offending code:
for(OrderItem prod : [select OrderItem.Product2.name, CurrencyIsoCode, id, Product2Id, Quantity, UnitPrice, OrderItem.Order.AccountId, OrderId from OrderItem where OrderId in : oids and OrderItem.Pricebookentry.product2.Is_Asset__c = true]){
            for (integer i = 0; i < prod.Quantity; i++) {
                Asset a = new Asset();
                a.name = prod.Product2.name;
                a.AccountId = prod.Order.AccountId;
                a.Price = prod.UnitPrice;
                a.Product2Id = prod.Product2Id;
                a.Quantity = 1;
                a.CurrencyIsoCode = prod.CurrencyIsoCode;
                a.Status = 'Purchased';
                a.Order_Product__c = prod.id;                

            	newAssets.add(a);
            }
        }

insert newAssets;



 
I'm passing this challenge, however when I actually test it out by clicking on an account in the account list item, I get this exception: 

"Something has gone wrong. Action failed: c$AccountMap$controller$accountSelected [TypeError: Cannot read property 'reuseTiles' of undefined] Failing descriptor: {c$AccountMap$controller$accountSelected}."

I did some debugging and found that the location and latitude of the account are indeed being capture by my event, so it looks like this might be a problem with the leaflet function map.panTo(). Does anyone know the solution to this issue? Here's my code, although it's exactly the same as the tutorial's.
 
({
    jsLoaded: function(component, event, helper) {

        setTimeout(function() {
            var map = L.map('map', {zoomControl: false}).setView([37.784173, -122.401557], 14);
            L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
                {
                    attribution: 'Tiles © Esri'
                }).addTo(map);
            component.set("v.map", map);
        });
    },

    accountsLoaded: function(component, event, helper) {

        // Add markers
        var map = component.get('v.map');
        var accounts = event.getParam('accounts');
        for (var i=0; i<accounts.length; i++) {
            var account = accounts[i];
            var latLng = [account.Location__Latitude__s, account.Location__Longitude__s];
            L.marker(latLng, {account: account}).addTo(map);
        }  
    },

    accountSelected: function(component, event, helper) {
        // Center the map on the account selected in the list
        var map = component.get('v.map');
        var account = event.getParam("account");
        alert(account.Location__Latitude__s + ', ' + account.Location__Longitude__s);
        map.panTo([account.Location__Latitude__s, account.Location__Longitude__s]);
    }
})

 
Hello

I am not sure if this is possible or not,but i am having a requirement like this.
When we are  sending email from a case(for example) ,sometimes my users get distracted leaving the email aside for sometime.I want an auto save feature to save them to a object when it doenst find any activity on this.

Is this possible?
Or else having a save draft button which saves to salesforce and retrive when needed or when user wants to work on it.
Is this possible.?
Any pointers regrding this please.

Thanks in advance!!