• Samuel Robert 15
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 3
    Replies
0
Hi I have created a VF page to call a Lightning component. The function of the lightning component is to display value on it based upon the record ID in Lightning page.
Now in Classic UI we are trying to add VF Button when user clicks it it should get the current page ID and show the lightning component. But , when I click on the button the new screen opens and it keeps on loading without displaying the value. At the bottom of the screen we see the error "Lightning out App error in callback function" but we are not loading any files.


VF Page:
<apex:page StandardController="SG_ProductBook__c" >
    <apex:includeLightning />
<div  id="LightningCompContainer" />
<script>
    $Lightning.use("c:SG_ProductComponentApp", function() {
        $Lightning.createComponent("c:SG_ProductComponent", {
        },
        "LightningCompContainer",
        function(component) {
           component.set("v.bookRecord.Id",'{!$CurrentPage.parameters.id}');
        });
    });

</script>
</apex:page>
Lightning App:
<aura:application access="GLOBAL" extends="ltng:outApp" >

 <aura:dependency resource="c:SG_ProductComponent"/>
</aura:application>

Lightning Component:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,force:appHostable" controller="SG_ProductComponentController" access="global">   

<!-- Attributes -->

<aura:attribute name="communityName" type="String"/>
<aura:attribute name="accessLevel" type="Integer"/>
<aura:attribute name="loading" type="Boolean" default="true"/>
<aura:attribute name="productRecord" type="Object"/>
    <aura:attribute name="bookRecord" type="Object"/>
<aura:attribute name="categories" type="Array"/>
<aura:attribute name="allLines" type="List"/>
<aura:attribute name="versions" type="List"/>
<aura:attribute name="releaseDates" type="Map"/>
<aura:attribute name="selectedVersion" type="Integer"/>
<aura:attribute name="selectedVersionIsDraft" type="Boolean" default="false"/>
<aura:attribute name="showVersionButton" type="Boolean" default="false"/>
<aura:attribute name="selectedVersionStatus" type="String" default="Release"/>
<aura:attribute name="AccIDFromVfPage" type="string"/>

<lightning:button label="Check ID from Vf" onclick="{!c.doAction}"/>

<!-- Handlers and declared events -->    
<aura:handler name="init" value="{! this }" action="{! c.onInit }"/>
<aura:handler name="change" value="{! v.selectedVersion }" action="{! c.onChangeSelectedVersion }"/>

<!-- Libraries -->
<lightning:overlayLibrary aura:id="overlayLib"/>
<lightning:notificationsLibrary aura:id="notifLib"/>

<!-- Display a lightning card with details about the record -->
<div class="Record Details"> 
    <aura:renderIf isTrue="{! v.loading }">
        <lightning:spinner alternativeText="Loading" variant="brand"/>
    </aura:renderIf>
    <div class="slds-grid slds-grid_align-space slds-gutters slds-wrap slds-grid_vertical-align-center">
        <div class="slds-col">
            <aura:renderIf isTrue="{! !v.selectedVersionIsDraft || v.accessLevel >= 1 }"><lightning:button label="PDF Export" iconName="utility:print" onclick="{! c.handlePrint }"/></aura:renderIf>
            <lightning:button label="Compare" iconName="utility:replace" onclick="{! c.handleCompare }"/>
            <aura:renderIf isTrue="{! v.selectedVersionIsDraft &amp;&amp; v.accessLevel >= 1 }"><lightning:button label="Edit Properties" iconName="utility:edit" onclick="{! c.handleEdit }"/></aura:renderIf>
            <aura:renderIf isTrue="{! v.accessLevel >= 1 }"><lightning:button label="Clone" iconName="utility:copy" onclick="{! c.handleClone }"/></aura:renderIf>
        </div>
        <div class="slds-col slds-col_bump-left">                
            <div class="slds-grid slds-grid_vertical">
                <div class="slds-col slds-align_absolute-center" style="margin-bottom: 5px">
                    <span class="{! 'slds-badge '+v.selectedVersionStatus }">{! v.selectedVersionStatus }</span>
                </div>
                <div class="slds-col">
                    <aura:renderIf isTrue="{! v.showVersionButton }">
                        <lightning:button label="{! v.selectedVersionIsDraft ? 'Release version' : 'New Version' }" iconName="{! v.selectedVersionIsDraft ? 'utility:check' : 'utility:new' }" onclick="{! c.handleVersionButton }"/>
                    </aura:renderIf>
                </div>
            </div>                                  
        </div>
        <aura:renderIf isTrue="{! !(v.accessLevel == 0 &amp;&amp; v.bookRecord.SG_HistoryVersionNumber__c == 0) }">
            <div class="slds-col">
                <lightning:select name="select" label="Select a Version" value="{! v.selectedVersion }">
                    <aura:iteration items="{! v.versions }" var="ver">
                        <option text="{! ver.label }" value="{! ver.id }" selected="{! ver.selected }"/>
                    </aura:iteration>
                </lightning:select>
            </div>
        </aura:renderIf>
    </div> 
    <lightning:card>
        <c:SG_ProductComponent_Card bookRecord="{! v.bookRecord }"/> 
        <aura:iteration items="{! v.categories }" var="aCategory" >
            <c:SG_ProductComponent_Category category="{! aCategory.SG_ProductProperty__r.SG_Category__c }" productBookId="{! v.bookRecord.Id }" selectedVersion="{! v.selectedVersion }" lines="{! v.allLines }"/>
        </aura:iteration>
        <c:SG_ProductComponent_CalculatedFields productBookId="{! v.bookRecord.Id }" lines="{! v.allLines }"/>
    </lightning:card>
</div> 
</aura:component>
Controller:
({
/*
 *  Component initialization 
 *  Launches a different function depending on what type of page the component is displayed
 */
onInit : function(component, event, helper) {
    helper.getAccessLevel(component, event, helper);               
},

/*
 *  On selection of a version, requests the property values for said version
 */    
onChangeSelectedVersion : function(component, event, helper) {
    if(component.get('v.selectedVersion') != '' && component.get('v.bookRecord.Id') != null){      
        helper.setSelectedVersionStatus(component, event, helper);       
        helper.setShowButtons(component, event, helper); 
        helper.getProductPropertyValues(component, event, helper);       
    }       
}, 

/*
 *  Handles opening a new window previewing the product book as pdf
 */
handlePrint : function(component, event, helper) {        
    var url;
    if(component.get('v.communityName') != null) url = location.origin + '/' + component.get('v.communityName') + '/apex/SG_PrintBook?Id=' + component.get("v.bookRecord.Id") + '&version=' + component.get("v.selectedVersion");   
    else url = location.origin + '/apex/SG_PrintBook?Id=' + component.get("v.bookRecord.Id") + '&version=' + component.get("v.selectedVersion");         
    window.open(url, '', '');     
},    

/*
 *  Handles opening a modal for selecting the compare target
 */    
handleCompare : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_CompareModal", {"bookRecord": component.get("v.bookRecord"), "accessLevel": component.get("v.accessLevel")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Select a Product book to compare to",
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_large"
                })
            }                               
        });
},

/*
 *  Handles opening a modal for selecting a new name for cloning
 */    
handleClone : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_Clone", {"bookRecord": component.get("v.bookRecord"), "accessLevel": component.get("v.accessLevel"), "version": component.get("v.selectedVersion")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Select a name for the new Product book",
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_small"
                })
            }                               
        });
},

/*
 *  Handles opening a modal for editing values
 */    
handleEdit : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_EditModal", {"bookRecord": component.get("v.bookRecord"), "properties": component.get("v.allLines")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Edit "+component.get("v.bookRecord.Name"),
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_large",
                    closeCallback: function() {
                       helper.getProductPropertyValues(component, event, helper);
                   }
                })
            }                               
        });
},
        
/*
 *  Handles operations to increment the release version number
 */      
handleVersionButton : function(component, event, helper) {
    if(component.get('v.selectedVersion') == component.get('v.bookRecord.SG_ReleaseVersionNumber__c')+1) helper.releaseVersion(component, event, helper);
    else helper.createNewVersion(component, event, helper);        
}, 
 
doAction : function(component, event, helper) {

    var accIdFromVf=component.get("v.bookRecord.Id");
    alert('Id of record from Vf page'+accIdFromVf);
} })

Please Advice.
Hi,

0
I was trying to create a New knowledge Article through Process builder, When a case status is set to validated.
As a part of creation We are referencing Case custom and standard fields to knowledge article custom and standard field.
I do have knowledge user permission in my user record.
But, still when I created case and set status to Validated it did not created the Article. I do checked for the required Knowledge fields and made sure they are populated on create new record process.
please advise what Iam missing here
Thanks,
 
We have Trigger that calls a future webservice class , which is inturn callsout external system.
When the Account status is set to Active then the system callout the external ITSm sytem and creates a record there . We also maintain Mapping opject to track the ID so in future when the callout fires it will check our system to see if the record is already existing in the other system and performs a Update operation.
However, when we tested the scenario in sandbox it failed in calling the endpoint itself and throws the following error at the apex Jobs
First error: You have uncommitted work pending. Please commit or rollback before calling out
Please find the apex Webservice callout class.
 
global class TOPdeskCalloutObject {
@future (callout=true)
Webservice static void apiCall(String salesforceID, String action, String accountName, String apiType) {

    //Get Username password and URL
    TOPdesk_API__c api = TOPdesk_API__c.getInstance('TOPdeskAPI');        
    String username = api.User_Name__c;
    String password = api.Password__c;
    String TOPdeskURL = api.URL__c;
    String endpoint;
    String method;
    String errorMessage;
    String body ='';
    Boolean archive = FALSE;

    //Construct HTTP request and response
    HttpRequest req = new HttpRequest();
    HttpResponse res = new HttpResponse();
    Http http = new Http();

    //Construct Authorization and Content header
    Blob headerValue = Blob.valueOf(username+':'+password);
    String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
    req.setHeader('Authorization', authorizationHeader);
    req.setHeader('Content-Type','application/json');

    System.debug('***SalesForce ID: '+ salesForceID);

    //Construct Endpoint
    try {
        TOPdesk_Mapping__c  mapping = [SELECT TOPdesk_Mapping__c.TOPdesk_ID__c FROM TOPdesk_Mapping__c WHERE Name = :salesForceID];
         if (string.isEmpty(mapping.TOPdesk_ID__c)) {
            System.debug('--in is empty--');  
            errorMessage = 'Action = '+action+'<br>API Call = '+method+'<br>Date / Time = '+DateTime.now()+'<br>API Status code = '+res.getStatusCode()+'<br>Response string = '+res.toString()+ ' Json Body = '+res.getBody(); 
            TOPdeskSendMail.sendMail(apiType,'Error = No TOPdesk ID returned '+errorMessage,salesForceID);                    
            return;
         }


        if (action == 'CREATE' && apiType == 'persons') {
            endpoint = TOPdeskURL+'/tas/api/'+apiType+'/id/'+mapping.TOPdesk_ID__c+'/unarchive'; 
            archive = TRUE;
                    System.debug('***CHECK : '+ endpoint + archive);

        }
        if (action == 'ARCHIVE' && apiType == 'persons') {
            endpoint = TOPdeskURL+'/tas/api/'+apiType+'/id/'+mapping.TOPdesk_ID__c+'/archive';         
            archive = TRUE;  
        }
        if (action == 'UPDATE') {
            endpoint = TOPdeskURL+'/tas/api/'+apiType+'/id/'+mapping.TOPdesk_ID__c; 
        }
        method = 'PUT';
        System.debug(endpoint);
        System.debug(method);
    }

     catch(QueryException e) {
        endpoint = TOPdeskURL+'/tas/api/'+apiType;
        method = 'POST';
        System.debug(method);
    }
        System.debug(endpoint);                                 
    //Construct Body     
    if (apiType == 'branches') {
        body = TOPdeskGetAccountBody.getAccount(salesForceID, action);
    }
    if (apiType == 'persons' && archive == FALSE) {
        body = TOPdeskGetContactBody.getContact(salesForceID, action);  
    }

     System.debug('CHECK BODY: '+body);
    //Set Method and Endpoint and Body
    req.setMethod(method);

    if(test.isrunningtest()){
        req.setEndpoint('www.test.com/tas/api/branches');
    }
    else{
        req.setEndpoint(endpoint);
    }

    req.setBody(body);

 // Adding debug statements -[AS] 17/04/2019
    System.debug('endpoint : '+endpoint );
    System.debug('method: '+method);
    System.debug('body: '+body);


    //Send endpoint to TOPdesk
    if(test.isrunningtest()){
       res = getTestResponse(req);
    }
    else{
        res = http.send(req);        
    }


    //Get TOPdeskID from body       
    string responseString = res.getBody();
    System.debug('responseString : '+responseString);
    TOPdeskResponseID responseClass = TOPdeskResponseID.parse(responseString);
    String topdeskID = responseClass.id;

    String statusCode = 'API Status code = '+res.getStatusCode();
    System.debug('API: '+res.getStatusCode());

    errorMessage = 'Action = '+action+'<br>API Call = '+method+'<br>Date / Time = '+DateTime.now()+'<br>API Status code = '+res.getStatusCode()+'<br>Response string = '+res.toString()+ ' Json Body = '+res.getBody(); 
    if (string.isEmpty(topdeskID)) {    
        TOPdeskSendMail.sendMail(apiType,'Error = No TOPdesk ID returned '+errorMessage,salesForceID);
    }

    //Check if TOPdeskID exists in SalesForce mapping table
     try {
    TOPdesk_Mapping__c  mappingID = [SELECT TOPdesk_Mapping__c.ID FROM TOPdesk_Mapping__c WHERE Name = :salesForceID];
        //upsert in case id topdesk id exists
        upsert new TOPdesk_Mapping__c(
        ID = mappingID.ID,
        Name = salesForceID,
        Object_Type__c = apiType,
        TOPdesk_ID__c = topdeskID,
        Object_Name__c = accountName,
        Last_API_Body__c =  body,
        Last_API_Message__c =errorMessage,
        Last_API_Status__c = statusCode 

        );
     } 
     catch(QueryException e) {
        //insert in case no topdesk id is known
        insert new TOPdesk_Mapping__c(
        Name = salesForceID,
        Object_Type__c = apiType,
        TOPdesk_ID__c = topdeskID,
        Object_Name__c = accountName,
        Last_API_Body__c = body,
        Last_API_Message__c =errorMessage,
        Last_API_Status__c = statusCode 
        );
     } 


}

public static HTTPResponse getTestResponse(HTTPRequest req) {
    HttpResponse res = new HttpResponse();
    res.setBody('{"id":"46d05ee6-a56c-489e-9939-8d33d182105f","name":"Dayco, Inc.","specification":"","clientReferenceNumber":"330199","timeZone":"","extraA":null,"extraB":null,"phone":"+1 7166894972","fax":"+1.716.689.1529","address":{"country":null,"street":"1650 Research Dr Ste 200","number":"","county":"MI","city":"Troy","postcode":"48083-2143","addressMemo":"","addressType":null},"email":"","website":"www.dayco.com","postalAddress":{"country":null,"street":"501 J James Adbn Pkwy 400","number":"","county":"NY","city":"Amherst","postcode":"14228","addressMemo":"","addressType":null},"branchType":"independentBranch","headBranch":null,"optionalFields1":{"boolean1":false,"boolean2":false,"boolean3":false,"boolean4":false,"boolean5":false,"number1":0.0,"number2":0.0,"number3":0.0,"number4":0.0,"number5":0.0,"date1":null,"date2":null,"date3":null,"date4":null,"date5":null,"text1":"","text2":"","text3":"","text4":"","text5":"","memo1":null,"memo2":null,"memo3":null,"memo4":null,"memo5":null,"searchlist1":null,"searchlist2":{"id":"b51176b2-885e-4e90-ada9-6e650e26deb9","name":"AMERICAS"},"searchlist3":{"id":"2b5422f6-4864-430f-af87-855d09991820","name":"NA"},"searchlist4":null,"searchlist5":null},"optionalFields2":{"boolean1":false,"boolean2":false,"boolean3":false,"boolean4":false,"boolean5":false,"number1":0.0,"number2":0.0,"number3":0.0,"number4":0.0,"number5":0.0,"date1":null,"date2":null,"date3":null,"date4":null,"date5":null,"text1":"0015000000YG531AAD","text2":"lori.sawatzke=nasdaq.com@example.com","text3":"null","text4":"CREATE","text5":"","memo1":null,"memo2":null,"memo3":null,"memo4":null,"memo5":null,"searchlist1":null,"searchlist2":null,"searchlist3":null,"searchlist4":null,"searchlist5":null},"creator":{"id":"41466b30-30a5-5fd9-bd85-b39fbe09efa9","name":"Breggeman, Joost"},"creationDate":"2019-03-25T09:56:04.937+0000","modifier":{"id":"41466b30-30a5-5fd9-bd85-b39fbe09efa9","name":"Breggeman, Joost"},"modificationDate":"2019-03-25T09:56:04.000+0000"}');
    res.setStatus('OK');
    res.setStatusCode(200);
    return res;
}
}

Apex Trigger :
 
trigger TOPdeskAccountUpdate on Account (after update) {
for (Account a : Trigger.new) {

String salesforceID = a.ID;
String action;
String apiType = 'branches';
System.debug('***SalesForce ID: '+ salesforceID);

//when account status is moved to Active Cust omer
if(trigger.oldMap.get(a.Id).Account_Status__c != a.Account_Status__c && a.Account_Status__c == 'Active Customer' ) {
    action = 'CREATE';
    System.debug('***Action: '+ action);
    TOPdeskCalloutObject.apiCall(salesforceID, action, a.Name, apiType);
    } 
//when Active Customer is updated
else if (trigger.oldMap.get(a.Id).Account_Status__c == a.Account_Status__c && a.Account_Status__c == 'Active Customer') { 
    action = 'UPDATE';
    System.debug('***Action: '+ action);
    TOPdeskCalloutObject.apiCall(salesforceID, action, a.Name, apiType);
   }
//when Active Customer is moved to Inactive
else if (trigger.oldMap.get(a.Id).Account_Status__c != a.Account_Status__c && a.Account_Status__c != 'Active Customer') { 
    action = 'ARCHIVE';
    System.debug('***Action: '+ action);
    TOPdeskCalloutObject.apiCall(salesforceID, action, a.Name, apiType);

    List<Contact> cList = [SELECT ID FROM Contact where accountID=:salesforceID];
        System.debug('***CONTACT: '+ cList); 

    for (Contact c : cList) {
        upsert new Contact(
        ID = c.ID,
        TOPdesk_Contact__c = FALSE);
    }
   }
} }

Please advise
Thanks
Hi,

We have PDF document attached in the Opportunity notes and attachment section in salesforce. When we click on Preview in salesforce classic it wont show us Page 5 and 6 of the PDF.

Similarly, In Lightning when we click on the attachment the quick view wont show us the Page 5 and 6.

But , If we download the PDF file and open it through Adobe /Web it shows the page 5 and 6 .

Is it the limitation of salesforce? How we can overcome this.

Please advise.

Thanks,
 
Hi,

In Classic, email trails were converted to rich/plain text.  In Lightning the previous emails in the trail remain as HTML.  This means that users get an error message when trying to reply (normally on the 3rd reply but not limited to).  Is it possible to either revert the email trail for replies/forwards rich/plain text but still keeping the new message as HTML or - if not - increasing the HTML limit?  What we can and can't do will help us to determine how we create new email templates moving forward.

Please find the screenshot

User-added imageContinued

User-added imagePlease advise.

Thanks,
We made a very minor change to the apex class where we included a field in the Email mathod in the class, however when we tried to deploy we get attempt to de-reference null object error.
Test class:
 
public static testMethod void testUpdateRegistration2(){

Course__c newCourse = new Course__c();
newCourse.Total_Sessions__c = 3;
newCourse.Session_No__c = 001;
newCourse.Registration_Time__c = '8:45AM';
newCourse.Number_of_Days__c = 1;
newCourse.Name = 'Apex Test Course';
newCourse.Minimum_Attendee__c = 5;
newCourse.Maximum_Attendee__c = 10;
newCourse.GST__c = 10;
newCourse.GST_Exempt_Course__c = false;
newCourse.Course_Type__c = 'Face to Face';
newCourse.Course_Start_Time__c = '9:00AM';
newCourse.Course_Number__c = 'C001';
newCourse.Course_End_Time__c = '5:00PM';
newCourse.Course_Classification__c = 'Public';
newCourse.ChargeID__c = 'PRC_999';
newCourse.Category__c = 'Food';
newCourse.Base_Price__c = 999;
insert newCourse;

datetime t = System.now();
date today = Date.newInstance(t.year(),t.month(),t.day());

Class__c newClass = new Class__c();
newClass.Name = 'Apex Test Class';
newClass.Minimim_Attendee__c = 9;
newClass.Maximum_Attendee__c = 99;
newClass.Course_Name__c = newCourse.Id;
newClass.Class_Location__c = 'Sydney';
newClass.Class_Begin_Date__c = today;
newClass.Class_End_Date__c = today;
newClass.Number_of_Confirmed_Attendees__c = 10;
newClass.Class_Status__c = 'Open';
insert newClass;

Account newAccount = new Account();
newAccount.Same_As_Address__c = 'true';
newAccount.Name = 'Apex Test';
//newAccount.ParentId = newAccountParent.Id;
newAccount.Mailing_Zip_Postal_Code__c = '2009'; 
newAccount.Mailing_Street__c = 'Fake Mailing Street';
newAccount.Mailing_State_Province__c = 'NSW';
newAccount.Mailing_Country__c = 'AUSTRALIA';
newAccount.Mailing_City__c = 'Sydney';
newAccount.CurrencyIsoCode = 'AUD';
newAccount.Business_Zip_Postal_Code__c = '1000'; 
newAccount.Business_Street__c = 'Fake Business Street';
newAccount.Business_State_Province__c = 'NSW';
newAccount.Business_Country__c = 'AUSTRALIA';
newAccount.Business_City__c = 'Sydney';
newAccount.Account_Classification__c = 'Business';
insert newAccount;

Account newVenueAccount = new Account();
newVenueAccount.Same_As_Address__c = 'true';
newVenueAccount.Name = 'Apex Venue Test';
newVenueAccount.Mailing_Zip_Postal_Code__c = '2009'; 
newVenueAccount.Mailing_Street__c = 'Fake Mailing Street';
newVenueAccount.Mailing_State_Province__c = 'NSW';
newVenueAccount.Mailing_Country__c = 'AUSTRALIA';
newVenueAccount.Mailing_City__c = 'Sydney';
newVenueAccount.CurrencyIsoCode = 'AUD';
newVenueAccount.Business_Zip_Postal_Code__c = '1000'; 
newVenueAccount.Business_Street__c = 'Fake Business Street';
newVenueAccount.Business_State_Province__c = 'NSW';
newVenueAccount.Business_Country__c = 'AUSTRALIA';
newVenueAccount.Business_City__c = 'Sydney';
newVenueAccount.Account_Classification__c = 'Business';
newVenueAccount.Type = 'Venue';
insert newVenueAccount;

Contact newContact = new Contact();
newContact.FirstName='John';
newContact.LastName='Doe';
newContact.Phone='0299998888';
newContact.Email = 'john.doe@fake.com';
newContact.AccountId = newAccount.Id;
newContact.Dietary_Requirements__c = 'ABC';
insert newContact;

Contact newContact1 = new Contact();
newContact1.LastName='Master';
newContact1.Email = 'a.master@fake.com';
newContact1.Phone = '0288889999';
newContact1.AccountId = newVenueAccount.Id;
insert newContact1;

Contact newContact2 = new Contact();
newContact2.Job_Title__c = 'National Manager';
newContact2.LastName='Master';
//newContact2.Email = 'a.master@fake.com';
newContact2.AccountId = newAccount.Id;
newContact2.MobilePhone = '0499999999';
insert newContact2;

Trainer_Approved_Course__c tac = new Trainer_Approved_Course__c();
tac.Name = 'Apex Trainer Approved Course';
tac.Trainer__c = newContact.Id;
tac.Expiration_Date__c = today + 100000;
tac.Course__c = newCourse.Id;
tac.Approved__c = true;
tac.CurrencyIsoCode = 'AUD';
insert tac;

Trainer_Approved_Course__c tac2 = new Trainer_Approved_Course__c();
tac2.Name = 'Apex Trainer Approved Course 2';
tac2.Trainer__c = newContact2.Id;
tac2.Expiration_Date__c = today + 100000;
tac2.Course__c = newCourse.Id;
tac2.Approved__c = true;
tac2.CurrencyIsoCode = 'AUD';
insert tac2;


Class__c newClass1 = new Class__c();
newClass1.Name = 'Apex Test Class';
newClass1.Minimim_Attendee__c = 9;
newClass1.Maximum_Attendee__c = 99;
newClass1.Course_Name__c = newCourse.Id;
newClass1.Class_Location__c = 'Sydney';
newClass1.Class_Begin_Date__c = today;
newClass1.Class_End_Date__c = today;
newClass1.Number_of_Confirmed_Attendees__c = 10;
newClass1.Class_Status__c = 'Open';
newClass1.Trainer_1__c = newContact.Id;
newClass1.Trainer_2__c = newContact1.Id;
newClass1.Venue__c = newVenueAccount.Id;
newClass1.Num_Material_Ordered__c = 10;
newClass1.Date_Material_Ordered__c = today;
newClass1.Num_in_Stock__c = 10;
newClass1.Num_Material_Printed__c = 5;
newClass1.Num_Standards_Out__c = 10;
newClass1.Num_Standards_In__c = 10;
newClass1.Boxes__c = 2;
newClass1.Job_Reference__c = 'N/A';
newClass1.Date_Material_Sent__c = today;
newClass1.Comments_Materials__c = 'N/A';
insert newClass1;

Id[] originalRegIds = new Id[0];
Registration__c newAttendee = new Registration__c();
newAttendee.Course_Name__c = newCourse.Id;
newAttendee.Attendee__c = newContact.Id;
newAttendee.Class_Name__c = newClass.Id;
newAttendee.Total_Amount__c = 999;
newAttendee.Status__c = 'Confirmed';
insert newAttendee;
originalRegIds.add(newAttendee.Id);

Registration__c newAttendee1 = new Registration__c();
newAttendee1.Course_Name__c = newCourse.Id;
newAttendee1.Attendee__c = newContact.Id;
insert newAttendee1;
originalRegIds.add(newAttendee1.Id);

Registration__c newAttendee2 = new Registration__c();
newAttendee2.Course_Name__c = newCourse.Id;
newAttendee2.Class_Name__c = newClass.Id;
newAttendee2.Attendee__c = newContact.Id;
newAttendee2.Status__c = 'Pended-SAI Cancellation';
insert newAttendee2;
originalRegIds.add(newAttendee2.Id);

Registration__c newAttendee3 = new Registration__c();
newAttendee3.Course_Name__c = newCourse.Id;
newAttendee3.Class_Name__c = newClass1.Id;
newAttendee3.Attendee__c = newContact1.Id;
newAttendee3.Status__c = 'Confirmed';
insert newAttendee3;

Registration__c newAttendee4 = new Registration__c();
newAttendee4.Course_Name__c = newCourse.Id;
newAttendee4.Class_Name__c = newClass1.Id;
newAttendee4.Attendee__c = newContact2.Id;
newAttendee4.Status__c = 'Confirmed';
insert newAttendee4;

Certificate_Template__c newCertificateTemplate = new Certificate_Template__c();
newCertificateTemplate.Name = 'Apex Test Certificate Template';
newCertificateTemplate.CurrencyIsoCode = 'AUD';
insert newCertificateTemplate;

Certificate_Type__c newCertificateType = new Certificate_Type__c();
newCertificateType.Name = 'Statement of Attendance';
newCertificateType.Course_Name__c = newCourse.Id;
newCertificateType.Certificate_Title__c = 'Statement of Attendance';
newCertificateType.Certificate_Template__c = newCertificateTemplate.Id;
newCertificateType.Certificate_Options__c = 'Always Issued';
insert newCertificateType;

// reset governor limit
Test.startTest();

Assessment__c newAssessment = new Assessment__c();
newAssessment.Name = 'Statement of Attendance';
newAssessment.Assessment_Title__c = newCertificateType.Id;
newAssessment.Assessment_Status__c = 'Competent';
newAssessment.Attendee_ID__c = newAttendee.Id;
newAssessment.Assessor__c = newContact.Id;
newAssessment.Received_from_Assessor__c = today;
insert newAssessment;

Assessment_Competency__c newAssessmentCompetency = new Assessment_Competency__c();
newAssessmentCompetency.Name = 'Apex Test Assessment Competency';
newAssessmentCompetency.CurrencyIsoCode = 'AUD';
newAssessmentCompetency.Competency_Code__c = 'ApexTest_9999';
newAssessmentCompetency.Assessment__c = newAssessment.Id;
insert newAssessmentCompetency;

Invoice_ENT__c newInvoiceENT = new Invoice_ENT__c();
newInvoiceENT.Registration__c = newAttendee.Id;
newInvoiceENT.CurrencyIsoCode = 'AUD';
newInvoiceENT.Base_Price__c = 998;
newInvoiceENT.Payment_Status__c = 'c';
newInvoiceENT.Invoice_Type__c = 'ACR';
newInvoiceENT.Bill_Type__c = 'EAR';
insert newInvoiceENT;

Invoice_ENT__c newInvoiceENT1 = new Invoice_ENT__c();
newInvoiceENT1.Registration__c = newAttendee.Id;
newInvoiceENT1.CurrencyIsoCode = 'AUD';
newInvoiceENT1.Base_Price__c = 998;
newInvoiceENT1.Payment_Status__c = 'c';
newInvoiceENT1.Invoice_Type__c = 'REG';
newInvoiceENT1.Bill_Type__c = 'PUB';
insert newInvoiceENT1;

 try{
    Integer processType = 1;
    ClassObj.classcancellation(newClass.Id, processType);
    ClassObj.sendAttendanceList(newClass1.Id);
    ClassObj.sendAttendanceList_TIS(newClass1.Id);
    //System.assertEquals(0, classObj.checkPendingRegos(newClass.Id));
} catch (System.EmailException e){
    System.debug('we caught a email exception: ' + e.getDmlMessage(0));
}

Test.stopTest();
From the above code bold syntax is the line number 1071

Please find the image below of the error I get during deployment.
User-added image
Class:
 
WebService static Id[] sendAttendanceList_TIS(Id ClassId) {

//Modified by sneh@sqwarepeg.com to include more venue and class material details
Class__c classObj = [Select Trainer_1__c, Trainer_1__r.Id, Trainer_1__r.Email,Trainer_1__r.EmailBouncedDate, 
Trainer_1__r.EmailBouncedReason,Trainer2__c, Trainer2__r.Id, Trainer2__r.Email, Trainer2__r.EmailBouncedDate, 
Trainer2__r.EmailBouncedReason, Trainer_2__c, Trainer_2__r.Id, Trainer_2__r.EmailBouncedDate, 
Trainer_2__r.EmailBouncedReason,Trainer_2__r.Email, Id, Venue__r.Id, Venue__r.Name, Venue__r.Business_Street__c, 
Venue__r.Business_City__c, Venue__r.Business_State_Province__c, Venue__r.Business_Zip_Postal_Code__c, 
Venue__r.Business_Country__c, Venue__r.Website, Venue__r.Phone, Venue__r.Internet_Email__c, Venue__r.Comments__c, 
Course_Name__r.Name, Class_Location__c, Class_End_Date__c, Class_Begin_Date__c, Num_in_Stock__c, 
Num_Standards_Out__c, Num_Standards_In__c, Num_Material_Printed__c, Num_Material_Ordered__c, Job_Reference__c, 
Date_Material_Sent__c, Date_Material_Ordered__c, Comments_Materials__c, Boxes__c 
From Class__c where Id =:ClassId];

//Modified by suzan@sqwarepeg.com, validation of the bounced emails
//Modified by sneh@sqwarepeg.com on 12/02/2009 to incorporate the Primary_Venue_Contact__c functionality
Contact[] conObj = [Select Id, Email, AccountId,EmailBouncedDate,EmailBouncedReason From Contact where AccountId =:classObj.Venue__r.Id and Primary_Venue_Contact__c = true];

//Contact[] conObj = [Select Id, Email, AccountId From Contact where AccountId =:classObj.Venue__r.Id];
//Query course field to add them in the Email template.
Course__c crs = [select id,Current_Revision__c from Course__c limit 1];
//if (classObj.Trainer_1__r.Email != null || classObj.Trainer_2__r.Email != null || conObj.Email != null) {
String jobTitle;
String email;
String phone;
String mobile;
String dietaryNeeds;
String accessNeeds;
String HTMLBody;

List<Id> RegIds = new List<Id>();
RegIds = getConfirmedIds(ClassId);

HTMLBody = 'Hi,<br><br>';
HTMLBody = HTMLBody + 'Please find attached the Attendance List for SAI Global\'s course.<br><br>';
HTMLBody = HTMLBody + 'Please print off a copy and hand to the Trainer on the morning of the course.<br><br>';
HTMLBody = HTMLBody + 'If you have any questions please don\'t hesitate to contact our Customer Service Team on 1-800-374-3818.<br><br>';
HTMLBody = HTMLBody + 'Kind Regards,<br>Training and Improvement Solutions<br><br>';
HTMLBody = HTMLBody + '<b><u>Course Information</u></b><br><br>';
if(classObj.Class_End_Date__c != null){
    HTMLBody = HTMLBody + 'Course Name: ' + classObj.Course_Name__r.Name + '<br>' + 'Current Revision:' + crs.Current_Revision__c.format() + '<br>' + 'Class Dates: ' + classObj.Class_Begin_Date__c.day() + '/' + classObj.Class_Begin_Date__c.month() + '/' + classObj.Class_Begin_Date__c.year() + ' - ' + classObj.Class_End_Date__c.day() + '/' + classObj.Class_End_Date__c.month() + '/' + classObj.Class_End_Date__c.year() + '<br>';
} else {
    HTMLBody = HTMLBody + 'Course Name: ' + classObj.Course_Name__r.Name + '<br>' + 'Current Revision:' + crs.Current_Revision__c.format() + '<br>' + 'Class Dates: ' + classObj.Class_Begin_Date__c.day() + '/' + classObj.Class_Begin_Date__c.month() + '/' + classObj.Class_Begin_Date__c.year() + ' - N/A<br>';
}
HTMLBody = HTMLBody + 'Class Location: ' + classObj.Class_Location__c + '<br><br>';

From the above code, The bold Syntax is line 429.

Please advise.

Thanks

 
Hi,

We facing a Page cannot find error in Lightning view of a Task record. But we can see this task in Classic view. Please find the screen shot provided below.

User-added image
The above is the classic view.

User-added image

This is what we get when we try to view the same in the lightning.

Please advise.
Thanks In Advance.
We have a created a Dashboard in lightning however the dashboard is displaying the x-axis revenue data in wrong sequence ,Please find the below image.
User-added image

But, In classic it is showing the correct order, even in the report it is showing the correct format.
Please advise.
Thanks in advance.
0
Hi I have created a VF page to call a Lightning component. The function of the lightning component is to display value on it based upon the record ID in Lightning page.
Now in Classic UI we are trying to add VF Button when user clicks it it should get the current page ID and show the lightning component. But , when I click on the button the new screen opens and it keeps on loading without displaying the value. At the bottom of the screen we see the error "Lightning out App error in callback function" but we are not loading any files.


VF Page:
<apex:page StandardController="SG_ProductBook__c" >
    <apex:includeLightning />
<div  id="LightningCompContainer" />
<script>
    $Lightning.use("c:SG_ProductComponentApp", function() {
        $Lightning.createComponent("c:SG_ProductComponent", {
        },
        "LightningCompContainer",
        function(component) {
           component.set("v.bookRecord.Id",'{!$CurrentPage.parameters.id}');
        });
    });

</script>
</apex:page>
Lightning App:
<aura:application access="GLOBAL" extends="ltng:outApp" >

 <aura:dependency resource="c:SG_ProductComponent"/>
</aura:application>

Lightning Component:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,force:appHostable" controller="SG_ProductComponentController" access="global">   

<!-- Attributes -->

<aura:attribute name="communityName" type="String"/>
<aura:attribute name="accessLevel" type="Integer"/>
<aura:attribute name="loading" type="Boolean" default="true"/>
<aura:attribute name="productRecord" type="Object"/>
    <aura:attribute name="bookRecord" type="Object"/>
<aura:attribute name="categories" type="Array"/>
<aura:attribute name="allLines" type="List"/>
<aura:attribute name="versions" type="List"/>
<aura:attribute name="releaseDates" type="Map"/>
<aura:attribute name="selectedVersion" type="Integer"/>
<aura:attribute name="selectedVersionIsDraft" type="Boolean" default="false"/>
<aura:attribute name="showVersionButton" type="Boolean" default="false"/>
<aura:attribute name="selectedVersionStatus" type="String" default="Release"/>
<aura:attribute name="AccIDFromVfPage" type="string"/>

<lightning:button label="Check ID from Vf" onclick="{!c.doAction}"/>

<!-- Handlers and declared events -->    
<aura:handler name="init" value="{! this }" action="{! c.onInit }"/>
<aura:handler name="change" value="{! v.selectedVersion }" action="{! c.onChangeSelectedVersion }"/>

<!-- Libraries -->
<lightning:overlayLibrary aura:id="overlayLib"/>
<lightning:notificationsLibrary aura:id="notifLib"/>

<!-- Display a lightning card with details about the record -->
<div class="Record Details"> 
    <aura:renderIf isTrue="{! v.loading }">
        <lightning:spinner alternativeText="Loading" variant="brand"/>
    </aura:renderIf>
    <div class="slds-grid slds-grid_align-space slds-gutters slds-wrap slds-grid_vertical-align-center">
        <div class="slds-col">
            <aura:renderIf isTrue="{! !v.selectedVersionIsDraft || v.accessLevel >= 1 }"><lightning:button label="PDF Export" iconName="utility:print" onclick="{! c.handlePrint }"/></aura:renderIf>
            <lightning:button label="Compare" iconName="utility:replace" onclick="{! c.handleCompare }"/>
            <aura:renderIf isTrue="{! v.selectedVersionIsDraft &amp;&amp; v.accessLevel >= 1 }"><lightning:button label="Edit Properties" iconName="utility:edit" onclick="{! c.handleEdit }"/></aura:renderIf>
            <aura:renderIf isTrue="{! v.accessLevel >= 1 }"><lightning:button label="Clone" iconName="utility:copy" onclick="{! c.handleClone }"/></aura:renderIf>
        </div>
        <div class="slds-col slds-col_bump-left">                
            <div class="slds-grid slds-grid_vertical">
                <div class="slds-col slds-align_absolute-center" style="margin-bottom: 5px">
                    <span class="{! 'slds-badge '+v.selectedVersionStatus }">{! v.selectedVersionStatus }</span>
                </div>
                <div class="slds-col">
                    <aura:renderIf isTrue="{! v.showVersionButton }">
                        <lightning:button label="{! v.selectedVersionIsDraft ? 'Release version' : 'New Version' }" iconName="{! v.selectedVersionIsDraft ? 'utility:check' : 'utility:new' }" onclick="{! c.handleVersionButton }"/>
                    </aura:renderIf>
                </div>
            </div>                                  
        </div>
        <aura:renderIf isTrue="{! !(v.accessLevel == 0 &amp;&amp; v.bookRecord.SG_HistoryVersionNumber__c == 0) }">
            <div class="slds-col">
                <lightning:select name="select" label="Select a Version" value="{! v.selectedVersion }">
                    <aura:iteration items="{! v.versions }" var="ver">
                        <option text="{! ver.label }" value="{! ver.id }" selected="{! ver.selected }"/>
                    </aura:iteration>
                </lightning:select>
            </div>
        </aura:renderIf>
    </div> 
    <lightning:card>
        <c:SG_ProductComponent_Card bookRecord="{! v.bookRecord }"/> 
        <aura:iteration items="{! v.categories }" var="aCategory" >
            <c:SG_ProductComponent_Category category="{! aCategory.SG_ProductProperty__r.SG_Category__c }" productBookId="{! v.bookRecord.Id }" selectedVersion="{! v.selectedVersion }" lines="{! v.allLines }"/>
        </aura:iteration>
        <c:SG_ProductComponent_CalculatedFields productBookId="{! v.bookRecord.Id }" lines="{! v.allLines }"/>
    </lightning:card>
</div> 
</aura:component>
Controller:
({
/*
 *  Component initialization 
 *  Launches a different function depending on what type of page the component is displayed
 */
onInit : function(component, event, helper) {
    helper.getAccessLevel(component, event, helper);               
},

/*
 *  On selection of a version, requests the property values for said version
 */    
onChangeSelectedVersion : function(component, event, helper) {
    if(component.get('v.selectedVersion') != '' && component.get('v.bookRecord.Id') != null){      
        helper.setSelectedVersionStatus(component, event, helper);       
        helper.setShowButtons(component, event, helper); 
        helper.getProductPropertyValues(component, event, helper);       
    }       
}, 

/*
 *  Handles opening a new window previewing the product book as pdf
 */
handlePrint : function(component, event, helper) {        
    var url;
    if(component.get('v.communityName') != null) url = location.origin + '/' + component.get('v.communityName') + '/apex/SG_PrintBook?Id=' + component.get("v.bookRecord.Id") + '&version=' + component.get("v.selectedVersion");   
    else url = location.origin + '/apex/SG_PrintBook?Id=' + component.get("v.bookRecord.Id") + '&version=' + component.get("v.selectedVersion");         
    window.open(url, '', '');     
},    

/*
 *  Handles opening a modal for selecting the compare target
 */    
handleCompare : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_CompareModal", {"bookRecord": component.get("v.bookRecord"), "accessLevel": component.get("v.accessLevel")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Select a Product book to compare to",
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_large"
                })
            }                               
        });
},

/*
 *  Handles opening a modal for selecting a new name for cloning
 */    
handleClone : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_Clone", {"bookRecord": component.get("v.bookRecord"), "accessLevel": component.get("v.accessLevel"), "version": component.get("v.selectedVersion")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Select a name for the new Product book",
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_small"
                })
            }                               
        });
},

/*
 *  Handles opening a modal for editing values
 */    
handleEdit : function(component, event, helper) {
    var modalBody;
    $A.createComponent("c:SG_ProductComponent_EditModal", {"bookRecord": component.get("v.bookRecord"), "properties": component.get("v.allLines")},
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                component.find('overlayLib').showCustomModal({
                    header: "Edit "+component.get("v.bookRecord.Name"),
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "slds-modal_large",
                    closeCallback: function() {
                       helper.getProductPropertyValues(component, event, helper);
                   }
                })
            }                               
        });
},
        
/*
 *  Handles operations to increment the release version number
 */      
handleVersionButton : function(component, event, helper) {
    if(component.get('v.selectedVersion') == component.get('v.bookRecord.SG_ReleaseVersionNumber__c')+1) helper.releaseVersion(component, event, helper);
    else helper.createNewVersion(component, event, helper);        
}, 
 
doAction : function(component, event, helper) {

    var accIdFromVf=component.get("v.bookRecord.Id");
    alert('Id of record from Vf page'+accIdFromVf);
} })

Please Advice.
Hi,

0
I was trying to create a New knowledge Article through Process builder, When a case status is set to validated.
As a part of creation We are referencing Case custom and standard fields to knowledge article custom and standard field.
I do have knowledge user permission in my user record.
But, still when I created case and set status to Validated it did not created the Article. I do checked for the required Knowledge fields and made sure they are populated on create new record process.
please advise what Iam missing here
Thanks,
 
We made a very minor change to the apex class where we included a field in the Email mathod in the class, however when we tried to deploy we get attempt to de-reference null object error.
Test class:
 
public static testMethod void testUpdateRegistration2(){

Course__c newCourse = new Course__c();
newCourse.Total_Sessions__c = 3;
newCourse.Session_No__c = 001;
newCourse.Registration_Time__c = '8:45AM';
newCourse.Number_of_Days__c = 1;
newCourse.Name = 'Apex Test Course';
newCourse.Minimum_Attendee__c = 5;
newCourse.Maximum_Attendee__c = 10;
newCourse.GST__c = 10;
newCourse.GST_Exempt_Course__c = false;
newCourse.Course_Type__c = 'Face to Face';
newCourse.Course_Start_Time__c = '9:00AM';
newCourse.Course_Number__c = 'C001';
newCourse.Course_End_Time__c = '5:00PM';
newCourse.Course_Classification__c = 'Public';
newCourse.ChargeID__c = 'PRC_999';
newCourse.Category__c = 'Food';
newCourse.Base_Price__c = 999;
insert newCourse;

datetime t = System.now();
date today = Date.newInstance(t.year(),t.month(),t.day());

Class__c newClass = new Class__c();
newClass.Name = 'Apex Test Class';
newClass.Minimim_Attendee__c = 9;
newClass.Maximum_Attendee__c = 99;
newClass.Course_Name__c = newCourse.Id;
newClass.Class_Location__c = 'Sydney';
newClass.Class_Begin_Date__c = today;
newClass.Class_End_Date__c = today;
newClass.Number_of_Confirmed_Attendees__c = 10;
newClass.Class_Status__c = 'Open';
insert newClass;

Account newAccount = new Account();
newAccount.Same_As_Address__c = 'true';
newAccount.Name = 'Apex Test';
//newAccount.ParentId = newAccountParent.Id;
newAccount.Mailing_Zip_Postal_Code__c = '2009'; 
newAccount.Mailing_Street__c = 'Fake Mailing Street';
newAccount.Mailing_State_Province__c = 'NSW';
newAccount.Mailing_Country__c = 'AUSTRALIA';
newAccount.Mailing_City__c = 'Sydney';
newAccount.CurrencyIsoCode = 'AUD';
newAccount.Business_Zip_Postal_Code__c = '1000'; 
newAccount.Business_Street__c = 'Fake Business Street';
newAccount.Business_State_Province__c = 'NSW';
newAccount.Business_Country__c = 'AUSTRALIA';
newAccount.Business_City__c = 'Sydney';
newAccount.Account_Classification__c = 'Business';
insert newAccount;

Account newVenueAccount = new Account();
newVenueAccount.Same_As_Address__c = 'true';
newVenueAccount.Name = 'Apex Venue Test';
newVenueAccount.Mailing_Zip_Postal_Code__c = '2009'; 
newVenueAccount.Mailing_Street__c = 'Fake Mailing Street';
newVenueAccount.Mailing_State_Province__c = 'NSW';
newVenueAccount.Mailing_Country__c = 'AUSTRALIA';
newVenueAccount.Mailing_City__c = 'Sydney';
newVenueAccount.CurrencyIsoCode = 'AUD';
newVenueAccount.Business_Zip_Postal_Code__c = '1000'; 
newVenueAccount.Business_Street__c = 'Fake Business Street';
newVenueAccount.Business_State_Province__c = 'NSW';
newVenueAccount.Business_Country__c = 'AUSTRALIA';
newVenueAccount.Business_City__c = 'Sydney';
newVenueAccount.Account_Classification__c = 'Business';
newVenueAccount.Type = 'Venue';
insert newVenueAccount;

Contact newContact = new Contact();
newContact.FirstName='John';
newContact.LastName='Doe';
newContact.Phone='0299998888';
newContact.Email = 'john.doe@fake.com';
newContact.AccountId = newAccount.Id;
newContact.Dietary_Requirements__c = 'ABC';
insert newContact;

Contact newContact1 = new Contact();
newContact1.LastName='Master';
newContact1.Email = 'a.master@fake.com';
newContact1.Phone = '0288889999';
newContact1.AccountId = newVenueAccount.Id;
insert newContact1;

Contact newContact2 = new Contact();
newContact2.Job_Title__c = 'National Manager';
newContact2.LastName='Master';
//newContact2.Email = 'a.master@fake.com';
newContact2.AccountId = newAccount.Id;
newContact2.MobilePhone = '0499999999';
insert newContact2;

Trainer_Approved_Course__c tac = new Trainer_Approved_Course__c();
tac.Name = 'Apex Trainer Approved Course';
tac.Trainer__c = newContact.Id;
tac.Expiration_Date__c = today + 100000;
tac.Course__c = newCourse.Id;
tac.Approved__c = true;
tac.CurrencyIsoCode = 'AUD';
insert tac;

Trainer_Approved_Course__c tac2 = new Trainer_Approved_Course__c();
tac2.Name = 'Apex Trainer Approved Course 2';
tac2.Trainer__c = newContact2.Id;
tac2.Expiration_Date__c = today + 100000;
tac2.Course__c = newCourse.Id;
tac2.Approved__c = true;
tac2.CurrencyIsoCode = 'AUD';
insert tac2;


Class__c newClass1 = new Class__c();
newClass1.Name = 'Apex Test Class';
newClass1.Minimim_Attendee__c = 9;
newClass1.Maximum_Attendee__c = 99;
newClass1.Course_Name__c = newCourse.Id;
newClass1.Class_Location__c = 'Sydney';
newClass1.Class_Begin_Date__c = today;
newClass1.Class_End_Date__c = today;
newClass1.Number_of_Confirmed_Attendees__c = 10;
newClass1.Class_Status__c = 'Open';
newClass1.Trainer_1__c = newContact.Id;
newClass1.Trainer_2__c = newContact1.Id;
newClass1.Venue__c = newVenueAccount.Id;
newClass1.Num_Material_Ordered__c = 10;
newClass1.Date_Material_Ordered__c = today;
newClass1.Num_in_Stock__c = 10;
newClass1.Num_Material_Printed__c = 5;
newClass1.Num_Standards_Out__c = 10;
newClass1.Num_Standards_In__c = 10;
newClass1.Boxes__c = 2;
newClass1.Job_Reference__c = 'N/A';
newClass1.Date_Material_Sent__c = today;
newClass1.Comments_Materials__c = 'N/A';
insert newClass1;

Id[] originalRegIds = new Id[0];
Registration__c newAttendee = new Registration__c();
newAttendee.Course_Name__c = newCourse.Id;
newAttendee.Attendee__c = newContact.Id;
newAttendee.Class_Name__c = newClass.Id;
newAttendee.Total_Amount__c = 999;
newAttendee.Status__c = 'Confirmed';
insert newAttendee;
originalRegIds.add(newAttendee.Id);

Registration__c newAttendee1 = new Registration__c();
newAttendee1.Course_Name__c = newCourse.Id;
newAttendee1.Attendee__c = newContact.Id;
insert newAttendee1;
originalRegIds.add(newAttendee1.Id);

Registration__c newAttendee2 = new Registration__c();
newAttendee2.Course_Name__c = newCourse.Id;
newAttendee2.Class_Name__c = newClass.Id;
newAttendee2.Attendee__c = newContact.Id;
newAttendee2.Status__c = 'Pended-SAI Cancellation';
insert newAttendee2;
originalRegIds.add(newAttendee2.Id);

Registration__c newAttendee3 = new Registration__c();
newAttendee3.Course_Name__c = newCourse.Id;
newAttendee3.Class_Name__c = newClass1.Id;
newAttendee3.Attendee__c = newContact1.Id;
newAttendee3.Status__c = 'Confirmed';
insert newAttendee3;

Registration__c newAttendee4 = new Registration__c();
newAttendee4.Course_Name__c = newCourse.Id;
newAttendee4.Class_Name__c = newClass1.Id;
newAttendee4.Attendee__c = newContact2.Id;
newAttendee4.Status__c = 'Confirmed';
insert newAttendee4;

Certificate_Template__c newCertificateTemplate = new Certificate_Template__c();
newCertificateTemplate.Name = 'Apex Test Certificate Template';
newCertificateTemplate.CurrencyIsoCode = 'AUD';
insert newCertificateTemplate;

Certificate_Type__c newCertificateType = new Certificate_Type__c();
newCertificateType.Name = 'Statement of Attendance';
newCertificateType.Course_Name__c = newCourse.Id;
newCertificateType.Certificate_Title__c = 'Statement of Attendance';
newCertificateType.Certificate_Template__c = newCertificateTemplate.Id;
newCertificateType.Certificate_Options__c = 'Always Issued';
insert newCertificateType;

// reset governor limit
Test.startTest();

Assessment__c newAssessment = new Assessment__c();
newAssessment.Name = 'Statement of Attendance';
newAssessment.Assessment_Title__c = newCertificateType.Id;
newAssessment.Assessment_Status__c = 'Competent';
newAssessment.Attendee_ID__c = newAttendee.Id;
newAssessment.Assessor__c = newContact.Id;
newAssessment.Received_from_Assessor__c = today;
insert newAssessment;

Assessment_Competency__c newAssessmentCompetency = new Assessment_Competency__c();
newAssessmentCompetency.Name = 'Apex Test Assessment Competency';
newAssessmentCompetency.CurrencyIsoCode = 'AUD';
newAssessmentCompetency.Competency_Code__c = 'ApexTest_9999';
newAssessmentCompetency.Assessment__c = newAssessment.Id;
insert newAssessmentCompetency;

Invoice_ENT__c newInvoiceENT = new Invoice_ENT__c();
newInvoiceENT.Registration__c = newAttendee.Id;
newInvoiceENT.CurrencyIsoCode = 'AUD';
newInvoiceENT.Base_Price__c = 998;
newInvoiceENT.Payment_Status__c = 'c';
newInvoiceENT.Invoice_Type__c = 'ACR';
newInvoiceENT.Bill_Type__c = 'EAR';
insert newInvoiceENT;

Invoice_ENT__c newInvoiceENT1 = new Invoice_ENT__c();
newInvoiceENT1.Registration__c = newAttendee.Id;
newInvoiceENT1.CurrencyIsoCode = 'AUD';
newInvoiceENT1.Base_Price__c = 998;
newInvoiceENT1.Payment_Status__c = 'c';
newInvoiceENT1.Invoice_Type__c = 'REG';
newInvoiceENT1.Bill_Type__c = 'PUB';
insert newInvoiceENT1;

 try{
    Integer processType = 1;
    ClassObj.classcancellation(newClass.Id, processType);
    ClassObj.sendAttendanceList(newClass1.Id);
    ClassObj.sendAttendanceList_TIS(newClass1.Id);
    //System.assertEquals(0, classObj.checkPendingRegos(newClass.Id));
} catch (System.EmailException e){
    System.debug('we caught a email exception: ' + e.getDmlMessage(0));
}

Test.stopTest();
From the above code bold syntax is the line number 1071

Please find the image below of the error I get during deployment.
User-added image
Class:
 
WebService static Id[] sendAttendanceList_TIS(Id ClassId) {

//Modified by sneh@sqwarepeg.com to include more venue and class material details
Class__c classObj = [Select Trainer_1__c, Trainer_1__r.Id, Trainer_1__r.Email,Trainer_1__r.EmailBouncedDate, 
Trainer_1__r.EmailBouncedReason,Trainer2__c, Trainer2__r.Id, Trainer2__r.Email, Trainer2__r.EmailBouncedDate, 
Trainer2__r.EmailBouncedReason, Trainer_2__c, Trainer_2__r.Id, Trainer_2__r.EmailBouncedDate, 
Trainer_2__r.EmailBouncedReason,Trainer_2__r.Email, Id, Venue__r.Id, Venue__r.Name, Venue__r.Business_Street__c, 
Venue__r.Business_City__c, Venue__r.Business_State_Province__c, Venue__r.Business_Zip_Postal_Code__c, 
Venue__r.Business_Country__c, Venue__r.Website, Venue__r.Phone, Venue__r.Internet_Email__c, Venue__r.Comments__c, 
Course_Name__r.Name, Class_Location__c, Class_End_Date__c, Class_Begin_Date__c, Num_in_Stock__c, 
Num_Standards_Out__c, Num_Standards_In__c, Num_Material_Printed__c, Num_Material_Ordered__c, Job_Reference__c, 
Date_Material_Sent__c, Date_Material_Ordered__c, Comments_Materials__c, Boxes__c 
From Class__c where Id =:ClassId];

//Modified by suzan@sqwarepeg.com, validation of the bounced emails
//Modified by sneh@sqwarepeg.com on 12/02/2009 to incorporate the Primary_Venue_Contact__c functionality
Contact[] conObj = [Select Id, Email, AccountId,EmailBouncedDate,EmailBouncedReason From Contact where AccountId =:classObj.Venue__r.Id and Primary_Venue_Contact__c = true];

//Contact[] conObj = [Select Id, Email, AccountId From Contact where AccountId =:classObj.Venue__r.Id];
//Query course field to add them in the Email template.
Course__c crs = [select id,Current_Revision__c from Course__c limit 1];
//if (classObj.Trainer_1__r.Email != null || classObj.Trainer_2__r.Email != null || conObj.Email != null) {
String jobTitle;
String email;
String phone;
String mobile;
String dietaryNeeds;
String accessNeeds;
String HTMLBody;

List<Id> RegIds = new List<Id>();
RegIds = getConfirmedIds(ClassId);

HTMLBody = 'Hi,<br><br>';
HTMLBody = HTMLBody + 'Please find attached the Attendance List for SAI Global\'s course.<br><br>';
HTMLBody = HTMLBody + 'Please print off a copy and hand to the Trainer on the morning of the course.<br><br>';
HTMLBody = HTMLBody + 'If you have any questions please don\'t hesitate to contact our Customer Service Team on 1-800-374-3818.<br><br>';
HTMLBody = HTMLBody + 'Kind Regards,<br>Training and Improvement Solutions<br><br>';
HTMLBody = HTMLBody + '<b><u>Course Information</u></b><br><br>';
if(classObj.Class_End_Date__c != null){
    HTMLBody = HTMLBody + 'Course Name: ' + classObj.Course_Name__r.Name + '<br>' + 'Current Revision:' + crs.Current_Revision__c.format() + '<br>' + 'Class Dates: ' + classObj.Class_Begin_Date__c.day() + '/' + classObj.Class_Begin_Date__c.month() + '/' + classObj.Class_Begin_Date__c.year() + ' - ' + classObj.Class_End_Date__c.day() + '/' + classObj.Class_End_Date__c.month() + '/' + classObj.Class_End_Date__c.year() + '<br>';
} else {
    HTMLBody = HTMLBody + 'Course Name: ' + classObj.Course_Name__r.Name + '<br>' + 'Current Revision:' + crs.Current_Revision__c.format() + '<br>' + 'Class Dates: ' + classObj.Class_Begin_Date__c.day() + '/' + classObj.Class_Begin_Date__c.month() + '/' + classObj.Class_Begin_Date__c.year() + ' - N/A<br>';
}
HTMLBody = HTMLBody + 'Class Location: ' + classObj.Class_Location__c + '<br><br>';

From the above code, The bold Syntax is line 429.

Please advise.

Thanks