• Chrsity Grande
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 9
Hello, Would someone be able to assist in writing a test class for the following apex class:
global class purgeFiles implements Schedulable{
    global void execute(SchedulableContext SC) {
    List<ContentDocumentLink > docs;
        docs = [SELECT Id, Linkedentity.name, Linkedentity.id,ContentDocument.CreatedDate  
                FROM contentDocumentLink 
                WHERE Linkedentityid 
                IN (SELECT Id FROM lead where createddate < Last_N_Days:7 and isconverted = false) ];  
                //may want to change to include ALL leads
                //AND ContentDocument.CreatedDate < Last_N_Days:7];
            delete docs;

Thank you very much
Can someone help. 

I'm trying to remove a section from a visualforce page and keep getting this error. The section to be removed is below. 

Error: LandRoverCalltoAction line 238, column 15: The element type "apex:form" must be terminated by the matching end-tag "</apex:form>"

Error: The element type "apex:form" must be terminated by the matching end-tag "</apex:form>".

<div class="form-section">
                            <div class="form-row">
                                <div class="form-field">
                                    <label class="form-field__label" for="searchField">Postcode</label>
                                    <div class="postcode__input">
                                        <div class="form-field__input">
                                            <apex:inputField id="searchField" value="{!Account.Postcode_Hidden__c}" required="true"/>

                                        <input id="searchButton" class="form-button form-button--primary" type="button"
                                               onclick="findByPostcode()" value="Find" />


                                    <div id="selectDropdownDiv" class="selectDropdownDiv">
                                        <label class="form-field__label" for="addressListSelect">Please select your address</label>
                                        <select id="addressListSelect" class="addressListSelect"></select>
                                    <div class="errorDateMsg" id="errorAddrMsg" style="display: none">Please type the postcode and select your address</div>

                                    <div id="form-address" class="form-address">
                                        <output id="output-address1"></output>

                                        <output id="output-town"></output>

                                        <output id="output-postcode"></output>

                                    <div id="form-address-apex" class="form-address-apex">
                                        <apex:inputField id="form__address_1" required="true" value="{!Account.BillingStreet}"/>
                                        <apex:inputField id="form__city" value="{!Account.BillingCity}"/>
                                        <apex:inputField id="postcode__box" value="{!Account.BillingPostalCode}"/>



Hi all,

We need to implement the following pattern at my org:
  • callout to external data source
  • if that callout takes too long (according to some configurable threshold), log an error (ie do some DML)
  • if that callout timed out on the remote server, try it again
Recognizing the potential for the dreaded "You have uncommitted work pending. Please commit or rollback before calling out." error, I put the error logging code in a future method, thus isolating the DML from the callouts. However, the error is still being thrown. I reduced the issue down to this pattern:
public static void foo() {
    Http http = new Http();
    HttpRequest req = new Httprequest();
    req.setEndpoint('https://test.salesforce.com'); //whatever endpoint
    http.send(req); //works fine
    http.send(req); //throws calloutexception

@future public static void bar() {

Am I correct to assume that calling a future method counts as a DML operation? Is there any documentation I'm missing somewhere?