I have a JavaScript button that calls an Apex which in turn calls a VF pages the uses: 'getContentAsPdf'. Here I am extracting images from Files section of an object and getting added to the PDF file before I attach the PDF to the parent record. Button code looks like below: {!REQUIRESCRIPT(&quot;/soap/ajax/26.0/connection.js&quot;)} {!REQUIRESCRIPT(&quot;/soap/ajax/26.0/apex.js&quot;)}  var result = sforce.apex.execute(&quot;MyImage&quot;,&quot;createMyImage&quot;, {caseId:&quot;{!Case.Id}&quot;});  alert(result); window.location.reload();  Somehow I am getting a JS exception and I am aware of the 30MB limitation:  A problem with the OnClick JavaScript for this button or link was encountered: {faultcode: 'soapevv:Server', faultstring:'The total size of all images in PDF document exceeds 30MB organization limit.',}  But this error is coming up in the browser pop-up window as an un-handled exception. How and where can I handle this JS exception, so that I can use an alert or some UI friendly error message.
120972
My application has javascript button that call Apex code.  Exceptions from web services are sometimes thrown and the user is shown a detailed exception message like this:  A problem with the OnClick JavaScript for this button or link was encountered: {faultcode:'soapenv:Client', faultstring:'HttpException: Example Error Message Class.BananaWebService.fetchBanana: line 22, column 1', }   Is there a simple way to create friendly error messages for my users when exceptions are thrown like this:  Example Error Message   Exception Class  public class HttpException extends Exception{}   Web Service Class   @RestResource(urlMapping='/BananaWebService/*') global class BananaWebService {   webservice static void fetchBanana(Id accountId) {      throw new HttpException('Example Error Message');   } }   Javascript code   {!REQUIRESCRIPT("/soap/ajax/28.0/connection.js")}  {!REQUIRESCRIPT("/soap/ajax/28.0/apex.js")}   var accountId = "{!Account.Id}"; sforce.apex.execute("BananaWebService","fetchBanana", { accountId: accountId });  window.location.reload();
75863
I've got a question about dealing  with huge PageObject. In the website that I'm currently testing there is a form with circa 50 inputs/dropdowns/selects.   In the current state my class got about 900 lines. It will be hard to debug, and in my opinion it's not so readable.   Is it consistent with the assumption of Page object model to create some subclasses and separate some WebElements and methods that are used by those elements? I'm using PageFactory so for declare all of the elements(I wrote circa 400 lines). It's so many.
94817
I checked the other question similar to this issue yet I could not find a proper solution for the issue I am facing for including an .svg file which is converted using inkscape with pdf+latex option set to ON, and I have also included both the .pdf and .pdf_tex file in the path. Yet I get the above mentioned error.   My code:  \begin{figure}[h!]  \centering \def\svgwidth{\columnwidth} \input{Implementation/Figs/most_changed_from_default_pos_0.pdf_tex} \end{figure}   Full error description:  !pdfTeX error: pdflatex (file /compile/Implementation/Figs/most_changed_from_default_pos_0.pdf): PDF inclusion: required page does not exist &lt;5&gt;   Any help to solve this issue would be really appreciated. I also downloaded the pdf file to check whether it has 5 pages. I could verify it, there were 5 pages in the pdf file.   The file which I want to convert is   I have added the google drive link to the file which I have used for analysis herewith
123018
I want to edit a PDF file in the Salesforce Document folder to add some text or background image to it, and then save the changes in a new PDF document.  I tried to include the PDF in a Visualforce page using  and render this page as PDF. But that didn't work, because renderAs="PDF" didn't display the iframe in the output PDF. Clearly, PDF generation in Visualforce only works with some components.  Do you have any idea how to achieve PDF manipulation in Apex/Visualforce? I thought of using a Heroku service for which I can send the PDF file to do the PDF manipulation (In Java, Ruby on any other language). Is that a viable option? Do you know any ready-to-use Heroku services that can do the job?  Thanks in advance for your help. Riadh.
100420
Today when deploying our code base we've run into the following error:  lwc/orderGrid/orderGrid.js-meta.xml -- Error: Failed to save Lightning Component Resource  [lwc/orderGrid/orderGrid.js] of Lightning Component Bundle [orderGrid].  Error: Value too long for field: Source maximum length is:131072   Looking at the size of file in question it is really bigger than 131,072 bytes. But we cannot find in documentation anything regarding limit for js file as a part of lwc component.  Can anyone point us in the right direction? Is it a real restriction or just some  SF bug?
11380
How to upload a file of size 2GB from Apex? Is there any sobject that I can make use of?
87053
Is there any way we can use Google Address plugin related javascript inside an LWC component like we have used inside the Visual force pages like below,  &lt;apex:component &gt; &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;libraries=places&amp;key=XXXXXXXXXXXXXXX"&gt;  &lt;/script&gt; &lt;script&gt; function initialize(addressType) {     // Create the autocomplete object, restricting the search     // to geographical location types.     if (addressType == 'Test') {         autocomplete = new google.maps.places.Autocomplete((document                 .getElementsByClassName('test')[0]), {             types : [ 'geocode' ]         });         // When the user selects an address from the dropdown,         // populate the address fields in the form.         google.maps.event.addListener(autocomplete, 'place_changed',                 function() {                     fillInAddress('test');                 });     }     else {         autocomplete = new google.maps.places.Autocomplete((document                 .getElementsByClassName(addressType)[0]), {             types : [ 'geocode' ]         });         // When the user selects an address from the dropdown,         // populate the address fields in the form.         google.maps.event.addListener(autocomplete, 'place_changed',                 function() {                     fillInAddress(addressType);                 });     } } &lt;/script&gt; &lt;/apex:component&gt;
119361
I have a vf page that is a custom button. That's it.  this VF page is on a STD Page Layout. When the user clicks on the VF page, the parent window needs to be redirected to the new URL.  The way this is working, is that the new page is opening in the vf section of the page layout.   &lt;apex:page standardController="Opportunity"  standardStylesheets="true" extensions="OpportunityController" &gt; &lt;base target="_parent" /&gt; &lt;body style="background:#f3f3ec" &gt; &lt;apex:form &gt; &lt;center&gt;  &lt;apex:commandButton action="{!redirect}"  value="Change Record Type" rendered="{!render}"/&gt; &lt;/center&gt;   &lt;/apex:form&gt;    &lt;/body&gt; &lt;/apex:page&gt;
44095
I have a canvas element defined statically in the html with a width and height. If I attempt to use JavaScript to resize it dynamically (setting a new width and height - either on the attributes of the canvas or via the style properties) I get the following error in Firefox:     uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object"  nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)"  location: "JS frame :: file:///home/russh/Desktop/test.html :: onclick :: line 1"  data: no]   Is it possible to resize this element or do I have to destroy it and create a new element on the fly?
10282
I am having an html email template which uses certain merge fields from a custom object. Now I am using following apex code to send certain emails to users.  Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();          mail.setTargetObjectId(t.OwnerId);          mail.setTemplateId(et.Id);         mail.setWhatId(t.Id);          mail.SaveAsActivity = false;         Messaging.sendEmail(new Messaging.singleemailMessage[] {mail});   Code is saved without error but when I run it it says "can't use whatId when sending email to users". Can anyone explain me how to overcome this error? When I use a visualforce template then same code works fine.
56738
In Field Service Lightning I have a Trigger on ServiceReport which sends an email with attachment coming from ContentVersion.   This is the Test class I have written.  @isTest  private class testCreateServiceReport{       static testMethod void validateWO() {       WorkOrder wo = new WorkOrder();       wo.subject = 'Testing';       insert wo;       ServiceAppointment sa = new ServiceAppointment();       sa.ParentRecordId = wo.Id;       sa.EarliestStartTime = DateTime.now();       sa.DueDate = DateTime.now();       insert sa;       List&lt;ServiceReportLayout&gt; srl = [Select Id FROM ServiceReportLayout];       ServiceReport sr = new ServiceReport();       sr.ParentId = sa.Id;       sr.Template = srl[0].Id; //Need to check if there is a way to avoid srl[0] notation       insert sr; //If I comment this the text result is pass. When I enable it I get too see the below mentioned error.  }  }   This is the error Methods defined as TestMethod do not support Web service callouts I know that we need to write Test Classes for code that involves web service callouts using setMock() but I dont understand in what way inserting ServiceReport is related to making a callout.  Any help on this will be really helpful.
9826
I have a javascript button on my product layout named "ListToEbay" and I have written a controller to invoke the EndItem()  service method of ebay api.  Below is the method:--  public void  removeItemFromEbayList() {   HttpRequest req = new HttpRequest();   Http http = new Http();   sEnvelopHandlerForEndingList='Request XML';   req.setBody(sEnvelopHandlerForEndingList); }   I want to execute this method directly on clicking that button, without going or opening a VisualForce Page. How can I accomplish that?
59773
I have a page message and I have a requirement that I want the text to be in red color.  I have written some javascript like this:  &lt;Script&gt;     window.onload=func1;     function func1()            {             document.getElementById('{!$Component.msg2}').style.color = "#ff0000";         alert('{!$Component.msg2}');     }   &lt;/Script&gt;   and the page message is like   &lt;apex:outputPanel id="errordisplayPanel" &gt;     &lt;apex:outputPanel Id="errorspanel"&gt;         &lt;input id="isDiscountCheckPrfmd" type="hidden" name="isDiscountCheckPrfmd" value="{!isDiscountCheckPrfmd}" /&gt;         &lt;c:Displayerror id="errordisplay" errorList="{!lstAllError}"  /&gt;                                  &lt;br/&gt;       &lt;/apex:outputPanel&gt;     &lt;div id="focusError"&gt;&lt;/div&gt;                         &lt;apex:pageMessages id="msg2" /&gt; &lt;/apex:outputPanel&gt;    I don't know why its not working. But when I use the static id that I pick up using inspect element it's working.  It was like:   document.getElementById("createSOheaderpage:newheaderform:newheaderpb:msg2:j_id63:j_id64:0:j_id65:j_id66:j_id68").style.color = "#ff0000";   Can someone please help me with this  Thanks in Advance
55635
I am working on a visualforce page and have used javascript to add a row dynamically. All are coming in the pdf except that javascript column.  Below is the javascript sippet that is not loading:  &lt;apex:page controller="Controller" renderAs="pdf"&gt;    &lt;html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt;          &lt;script src="https://code.jquery.com/jquery-1.11.1.min.js"&gt;&lt;/script&gt;         &lt;!--SLDS STYLESHEET STATIC RESOURCE--&gt;             &lt;apex:slds /&gt;                 &lt;body&gt;
97536
My vf page     &lt;apex:page renderAs="pdf" Controller="testpdf1"&gt;     &lt;head&gt;         &lt;style type="text/css" media="print"&gt;             @page              {                 size: 8.5in 11in;/* width height */             }              @page              {                 @top-center                  {                     content: element(header);                 }                  @bottom-left                  {                     content: element(footer);                 }             }              div.header              {                 padding: 10px;                 position: running(header);             }              div.footer              {                 display: block;                 padding: 5px;                 position: running(footer);             }              .pagenumber:before              {                 content: counter(page);             }              .pagecount:before              {                 content: counter(pages);             }         &lt;/style&gt;     &lt;/head&gt;      &lt;div class="header"&gt;             &lt;div align="right"&gt;Header&lt;/div&gt;     &lt;/div&gt;      &lt;div class="footer"&gt;         &lt;div&gt;Page &lt;span class="pagenumber"/&gt; of &lt;span class="pagecount"/&gt;&lt;/div&gt;     &lt;/div&gt;      &lt;div class="content"&gt;         &lt;p&gt;             &lt;apex:repeat value="{!opp}" var="item"&gt;                 &lt;tr&gt;                     &lt;td class="tableContent"&gt;{!item.Name}&lt;/td&gt;                 &lt;/tr&gt;             &lt;/apex:repeat&gt;         &lt;/p&gt;     &lt;/div&gt; &lt;/apex:page&gt;   Controller  public class testpdf1 {     public list&lt;Account&gt; opp{get;set;}      public testpdf1()     {         opp=[SELECT Name  from Account limit 50];     } }   I am getting all records in pdf format but able to get header in first page only and i am not getting header from second pages how can i display header to all pages.
90240
I have the below code:  public class CallOutForGet {      HttpRequest request=new Httprequest(); http http=new http(); request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals'); request.setmethod('GET');  HttpResponse response=http.send(request);  if(response.getStatusCode()==200){      Map&lt;String,Object&gt; results= (Map&lt;String,Object&gt;)JSON.deserializeUntyped(response.getBody());      List&lt;object&gt; animals=(List&lt;object&gt;)results.get('animals');     System.debug('Received Animals************');     for(object anim:animals){         System.debug(anim);     } }  }   This error at line -  request.setEndPoint('https://th-apex-http-callout.herokuapp.com/animals');  says expecting right parenthesis.
960
See code:   var file1 = "50.xsl"; var file2 = "30.doc"; getFileExtension(file1); //returns xsl getFileExtension(file2); //returns doc  function getFileExtension(filename) {     /*TODO*/ }