• Terminusbot
  • NEWBIE
  • 130 Points
  • Member since 2016
  • CEO
  • Terminus Consulting

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 43
    Questions
  • 34
    Replies
I am creating a lightning component and I'm trying to style the data table using the example in the Lightning Design System documentation. I'm having trouble getting this to render correctly. Any ideas? 

Here is what the example looks like:
Lightning Example - Data Table
Link to example:
https://www.lightningdesignsystem.com/components/data-tables/?variant=base


Here is how mine renders:

User-added image
Here is what I am doing in the Component:
 
<aura:component controller="AddPoliciesApexController" implements="force:LightningQuickAction,force:hasRecordId">
	<aura:attribute name="policies" type="Policy__c[]" />
	<aura:attribute name="addToOpp" type="Boolean" />
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
	<table class="slds-table slds-table_bordered slds-table_cell-buffer slds-table_striped">
	 	<thead>
		    <tr class="slds-text-title_caps">
		      <th scope="col">
		        <div class="slds-truncate" title="Policy Number">POLICY NUMBER</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Effective Date">EFFECTIVE DATE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Expiration Date">EXPIRATION DATE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Coverage Code">COVERAGE</div>
		      </th>
		      <th scope="col">
		        <div class="slds-truncate" title="Add to Opp">ADD TO OPP?</div>
		      </th>
		    </tr>
  		</thead>

  	<tbody>
   
    
  </tbody>	
	<aura:iteration items="{!v.policies}" var="pol" >

 	 <tr>
      <th scope="row" data-label="Policy Number">
        <div class="slds-truncate" title="Policy Number">
          <a href="javascript:void(0);">{!pol.Name}</a>
        </div>
      </th>
      <td data-label="Effective Date">
        <div class="slds-truncate" title="Effective Date">{!pol.Effective_Date__c}</div>
      </td>
      <td data-label="Expiration Date">
        <div class="slds-truncate" title="Expiration Date">{!pol.Expiration_Date__c}</div>
      </td>
      <td data-label="Coverage Code">
        <div class="slds-truncate" title="Coverage Code">{!pol.Coverage_Code_Product_Code__c }</div>
      </td>
      <td data-label="Add to Opp">
        <div class="slds-truncate" title="Add to Opp">
        	<ui:inputCheckbox class="slds-form-element" label="Add to Opp?"/>
        </div>
      </td>
    </tr>
	 
	</aura:iteration>
  </table>
	 


</aura:component>


Thanks!!
 
I have created a trigger on a custom object and a test class to migrate it. I have over 95% code coverage and when I deploy to Production I get this error. 
 
10:38:50:047 FATAL_ERROR System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateNewOpp: execution of AfterInsert

10:38:47:000 FATAL_ERROR Trigger.CreateNewOpp: line 38, column 1: []

It can't find an ID I am querying for even though I know it exists in Production as well as Sandbox. Here is my trigger. I have set the line 38 in the trigger to BOLD and Underline so you can see it.  
 
trigger CreateNewOpp on Policy__c (after insert) {

System.debug('Create New Opp Fired');   

//List of Opportunities to Create and Associate Policy    
List<Opportunity> createOpps = new List<Opportunity>();

    for (Policy__c polInfo : Trigger.new) {
      
      //Create Opportunity 
      Opportunity createOpp = new Opportunity();


      //Policy Number 
      String polNumber = polInfo.Name;
   
      if (polNumber.containsIgnoreCase('APP')){
           System.debug('Found New Policy Opportunity' + polInfo.Name);
           
           //Find Owner and Type of Business Account 
           List<Account> acctId = new List<Account>([Select OwnerId, 
                                                            RecordTypeId 
                                                       From Account 
                                                      Where Id =:polInfo.account__c LIMIT 1]); 
           
           List<RecordType> lookupRecId = new List<RecordType>([Select Id,
                                                                       Name 
                                                                  From RecordType 
                                                                 Where Id=:acctId.get(0).RecordTypeId LIMIT 1]);
          
          List<RecordType> recTypeList = new List<RecordType>();
           

           if (lookupRecId.get(0).Name == 'Individual') {
              recTypeList = [Select Id 
                               From RecordType 
                              Where Name = 'Commercial Lines' LIMIT 1];
              System.debug('Inside IF Record Type' + recTypeList.get(0).Id);
               
           } else {
               recTypeList = [Select Id 
                                From RecordType 
                               Where Name = 'Personal Lines' LIMIT 1];
              System.debug('Inside IF Record Type' + recTypeList.get(0).Id);  
           }
              System.debug('Outside IF Record Type' + recTypeList.get(0).Id);  
              System.debug('Opporunity Account' + polInfo.account__c);

           //Set New Opportunity Values 
           createOpp.Name            = 'New ' + polInfo.Coverage_Detail__c + ' Opportunity'; 
           createOpp.AccountId       = polInfo.account__c; 
           createOpp.RecordTypeId    = recTypeList.get(0).Id;
           createOpp.StageName       = 'Marketing';
           createOpp.CloseDate       = polInfo.Effective_Date__c;
           createOpp.Amount          = polInfo.EstPremAmt__c;
           createOpp.RefSagittaID__c = polInfo.SagittaID__c;
           createOpp.OwnerId         = acctId.get(0).OwnerId; 
           createOpps.add(createOpp);
           
       }


        if (createOpps.size()>=1){
           
            for (Opportunity opp : createOpps) {
                try {
                    System.debug('Create these Opps' + createOpps);
                    insert opp;
        	    } catch(DmlException e) {
                    System.debug('The following exception has occurred during update: ' + e.getMessage());
        	    }
        	}
        }
          

    }
    
}

Here is my test class. I have set (seeAllData=true). 
 
@isTest(seeAllData=true) 
private class TestNewOpp {
	
	@isTest static void test_method_one() {

		DateTime dT = System.now();
		Date myDate = date.newinstance(dT.year(), dT.month(), dT.day());

		//Lookup RecordType Id
		RecordType typeOfRecord = [Select Id
							         From RecordType
						            Where Name = 'Individual' LIMIT 1];

		//Lookup House User
		User acctOwner = [Select Id
				            From User
					       Where Sagitta_User_Code__c = 'HO' LIMIT 1];

		
		// Create Account With Parameters
		// list Accounts to Update 
		Account myAccount      = new Account(); 
		myAccount.Name         = 'Test Account';
		myAccount.Email__c     = 'testing@rampartinsurance.com';
		myAccount.Phone        = '5555555555';
		myAccount.RecordTypeId = typeOfRecord.Id;  
		myAccount.OwnerId      = acctOwner.Id; 
		myAccount.Preferred_Method_of_Contact__c = 'Email';
 		insert myAccount; 



		Account latestAccount = [Select Id, 
										RecordTypeId
								   From Account 
								  Where Id=: myAccount.Id LIMIT 1];


		//Create Coverage for Test
		Coverages__c testCov = new Coverages__c(); 
		testCov.Name = 'TEST1';
		testCov.Description__c = 'Testing Coverage Detail';
		insert testCov;

		Coverages__c latestCov = [Select Id 
								    From Coverages__c 
								   Where Id =: testCov.Id LIMIT 1];

		

		//Create Policy
		Policy__c myPolicy  = new Policy__c();
		myPolicy.Name       = 'APP12345';
		myPolicy.Account__c = latestAccount.Id;
		myPolicy.EstPremAmt__c = 10000;
		myPolicy.Effective_Date__c = myDate;
		myPolicy.SagittaID__c =  '10000';
		myPolicy.Coverages__c = latestCov.Id;
		insert myPolicy;




	}
	
	
	
}

 
I am getting an invalid decimal error when trying to update a field with a type of Current (16,2). 

The value of aText is 3,259.00.
When I copy that exact value in the front end it saves no problem. Not sure why this is happening. 
 
policyDetails.EstPremAmt__c = Decimal.valueOf(aText);

 
Hello All. 

I am running into a strange issue when executing a test class on a @future callout. The error message is below. 
 
System.XmlException: Failed to parse XML due to: only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1)

It is failing at 'doc.load(toParse);' which is where I load my XML response into the DOM for reading.  Here is my callout
 
public with sharing class ClientBatchQuery {
	
@future (callout=true)
public static void sendBatchQuery() {    

   	String account;
   	String username;
   	String password;
   	String serverpool;
    //Get Sagitta Info Main Record Data
    List<SagittaInfo__c> sagittaSettings = new List<SagittaInfo__c>([Select Id, Name, account__c, username__c, password__c, serverpool__c, Client_Date__c, Client_GTTIME__c,Client_LTTIME__c, 
                                                                    Client_Sync_Sent__c,Client_Sync_Minutes__c,UniVerse_Time__c,Current_UniVerse_Time__c
                                                                    from SagittaInfo__c where Name = 'MAIN']);
    //Set login credentials for Saggita 
    if (sagittaSettings.size()>0){
     account    = sagittaSettings.get(0).account__c;
     username   = sagittaSettings.get(0).username__c;
     password   = sagittaSettings.get(0).password__c;
     serverpool = sagittaSettings.get(0).serverpool__c;
    }

    // Create XmlStreamWriter  
    XmlStreamWriter writer = new XmlStreamWriter();    
            
    //Build PassThroughReq Soap XML 
        writer.writeStartDocument('utf-8','1.0');  
            writer.writeStartElement(null,'soap12:Envelope',null);
            writer.writeAttribute(null,null,'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
            writer.writeAttribute(null,null,'xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
            writer.writeAttribute(null,null, 'xmlns:soap12', 'http://www.w3.org/2003/05/soap-envelope');
                    
            writer.writeStartElement(null,'soap12:Body', null);
                writer.writeStartElement(null,'PassThroughReq',null);
                writer.writeAttribute(null,null,'xmlns', 'http://amsservices.com/');
                    writer.writeStartElement(null,'XMLinput',null);
                        writer.writeStartElement(null,'INPUT',null);
                                writer.writeStartElement(null,'Account',null);
                			    writer.writeAttribute(null,null,'value', account);
                                writer.writeEndElement(); // Account Close
                			    writer.writeStartElement(null,'Username',null);
                			    writer.writeAttribute(null,null,'value', username);
                                writer.writeEndElement(); // Username Close
    						    writer.writeStartElement(null,'Password',null);
                			    writer.writeAttribute(null,null,'value', password);
                                writer.writeEndElement(); // Password Close
                			    writer.writeStartElement(null,'Serverpool',null);
                			    writer.writeAttribute(null,null,'value', serverpool);
                                writer.writeEndElement(); // Serverpool Close
                                writer.writeStartElement(null,'Access',null);
                                writer.writeAttribute(null,null,'statement', 'LIST CLIENTS WITH AUDIT.DATE.TIME GT \\'+ String.valueOf(sagittaSettings.get(0).UniVerse_Time__c) +'\\ *OUTPUT* CLIENT.CODE CAT.CODE.1 CLIENT.NAME ADDR1 ADDR2 CITY STATE ZIP.CODE PRIME.PROD PRIME.SERVICER.NAME PHONE1 PHONE2 EMAIL.ADDRESS');
                                writer.writeEndElement(); // Access Close
                        writer.writeEndElement(); // INPUT Close
                        writer.writeEndElement(); // XMLinput Close
                    writer.writeEndElement(); // PassThroughReq Close
                writer.writeEndElement(); // Soap Body Close
            writer.writeEndElement(); // Envelope Body Close    
            
    // Write XML to String Variable
    string xml = writer.getXmlString();
    System.debug('XML OUTPUT' + xml);      
    //End XmlStreamWriter 
    writer.close();
    
    // Create instance of HttpRequest, HttpResponse, and Http. Preparing to send to XML to Saggita
    HttpRequest req = new HttpRequest();
    HttpResponse res = new HttpResponse();
    Http http = new Http();
            
    // Set Method, Endpoint, Header, and Body details for SOAP request. 
    req.setMethod('POST');
    req.setEndpoint('http://167.206.227.210/sagittaws/transporter.asmx');
    req.setHeader('Content-Type', 'text/xml');
    req.setHeader('SOAPAction','http://amsservices.com/PassThroughReq');
    req.setBody(xml);
                       
    //Execute Callout 
    try {        
        res = http.send(req);
    }   catch (System.CalloutException e) {
        System.debug('Callout error: '+ e);
        System.debug('Response to String' + res.toString());
    }           
        
    // Creating XMLStreamReader to read the response - Looking for SagittaID and Sagitta Client Code        
    // Clean XMl response from Sagitta - Call cleanXML method  
    String bodyXMLFinal = XMLCleaner.cleanXML(res.getBody());
            
        
    

    //Create List of all Policy Records and Attributes to Update and Insert 
    List<Account> clientUpsert = new List<Account>();
        
    String toParse = bodyXMLFinal;
    String fileAttrValue; 
    String itemAttribute;
    
    //Create DOM to read XML response 
    DOM.Document doc = new DOM.Document();
    doc.load(toParse);
    
    //Get Root 
    DOM.XMLNode root = doc.getRootElement();
    String nms = root.getNameSpace();
    System.Debug('namespace: ' + nms); // http://www.w3.org/2003/05/soap-envelope

        DOM.XMLNode body = root.getChildElement('Body', nms); // Gets the body of the XML 
        System.Debug('body: ' + body); 
        List<DOM.XMLNode> bodyChildrenList = body.getChildElements();

            for (DOM.XMLNode passThroughReqResponse : bodyChildrenList) {
            System.Debug('passThroughReqResponse: ' + passThroughReqResponse.getName());
            List<DOM.XMLNode> passThroughReqResultList = passThroughReqResponse.getChildElements();

                for (DOM.XMLNode passThroughReqResult : passThroughReqResultList) {
                System.Debug('passThroughReqResult: ' + passThroughReqResult.getName());
                List<DOM.XMLNode> pickResponseList = passThroughReqResult.getChildElements();

                    for (DOM.XMLNode pickResponse : pickResponseList) {
                    System.Debug('pickResponse: ' + pickResponse.getName());
                    List<DOM.XMLNode> filesList = pickResponse.getChildElements();
                                
                        for (DOM.XMLNode files : filesList) {
                        System.Debug('files: ' + files.getName());
                        List<DOM.XMLNode> fileList = files.getChildElements();
                                   
                            for (DOM.XMLNode file : fileList) {
                            System.Debug('file: ' + file.getName());
                            List<DOM.XMLNode> itemList = file.getChildElements();
                     
                                for (DOM.XMLNode item : itemList) {
                                System.Debug('item: ' + item.getName());
                                itemAttribute = item.getAttributeValue('sagitem', null);
                                System.Debug('item attribute sagitem: ' + itemAttribute);
                                Account accountDetails = new Account();

                                    if (!itemAttribute.startsWith('WEBSERVICE')) {
                                    System.debug('Item is not WEBSERVICE' + itemAttribute + ' Entering Data');
                                    System.debug ('Updated Policy Details: ' + accountDetails);
                                    System.debug('Running query on : ' + itemAttribute);
                                    List<Account> lookUpID = new List<Account> ([Select Id from Account where SagittaID__c =:itemAttribute]);
                                    System.debug('Results for queory on : ' + itemAttribute + ': ' + lookUpID);
                                    
                                        if (!lookupId.isEmpty()) {
                                        System.debug('ID IS NOT EMPTY: ' + lookupID);
                                        accountDetails.Id = string.valueOf(lookupID.get(0).Id);
                                        System.debug('Adding ID to Policy Object: ' + lookupID);
                                        System.debug ('Updated Policy Details: ' + accountDetails);
                                        }
                                        accountDetails.SagittaId__c = itemAttribute;
                                        List<DOM.XMLNode> aList = item.getChildElements();
                                       
                                            for (DOM.XMLNode a : aList) {
                                            String aPosition = a.getName();
                                            String aText = a.getText();
                                            System.Debug('a: ' + aPosition);
                                            System.Debug('text: ' + aText);
                                                
                                                if (aPosition != null && aPosition == 'a1') {
                                                	//Client Code
                                                	accountDetails.Client_Code__c = aText;
                                                	accountDetails.Preferred_Method_of_Contact__c = 'Email';
                                                }

                                                if (aPosition != null && aPosition == 'a2') {
                                                    //Category Code 
                                                    String catCode;
                                                    if (aText == 'COM') {
                                                    	catCode = 'Business';
                                                    } else {
                                                    	catCode = 'Individual';
                                                    }
                                                   
                                                    List<recordtype> recTypeId = new List<recordtype>([Select Id from recordtype where Name=:catCode]);
                                                    accountDetails.recordtypeid = recTypeId.get(0).Id;
                                                    System.debug('Adding Category Code to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a3') {
                                                    //Account Name
                                                    accountDetails.Name = aText;
                                                    System.debug('Adding Account Name to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a4') {
                                                    //Address 1
                                                    accountDetails.BillingStreet = aText;
                                                    System.debug('Adding Address 1 to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a5') {
                                                    //Address 2
                                                    //
                                                    //System.debug('Adding Coverages to Policy Object: ' + aText);
                                                    //System.debug ('Updated Policy Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a6') {
                                                    //City
                                                    accountDetails.BillingCity = aText;
                                                    System.debug('Adding City to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a7') {
                                                    //State
                                                    accountDetails.BillingState = aText;
                                                    System.debug('Adding State to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a8') {
                                                    //ZipCode
                                                    accountDetails.BillingPostalCode = aText;
                                                    System.debug('Adding Zip Code to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a9') {
                                                    //Producer Code 
                                                    String prodCode = aText;
                                                    List<User> producerCode = [Select Id From User where Sagitta_User_Code__c =:prodCode ];
      												accountDetails.OwnerId = string.valueOf(producerCode[0].Id);
                                                    System.debug('Adding Producer Code to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a10') {
                                                    //Account Executive 
                                                    accountDetails.Account_Exec__c = aText;
                                                    System.debug('Adding Account Exec to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a11') {
                                                    //Phone1
                                                    accountDetails.Phone = aText;
                                                    System.debug('Adding Phone to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a12') {
                                                    //Phone2
                                                    accountDetails.Phone_2__c = aText;
                                                    System.debug('Adding Phone 2 to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }
                                                
                                                if (aPosition != null && aPosition == 'a13') {
                                                    //Email 
                                                    
                                                    accountDetails.Email__c = aText;
                                                    System.debug('Adding Status to Account Object: ' + aText);
                                                    System.debug ('Updated Account Details: ' + accountDetails);
                                                }

                                                //End of A# lists
                                                 
                                            } // End For aList 
                                             
                                    } //If Sagitta ID Exists    
                                        System.debug('Does Account` Details Exist?' + accountDetails);
                                            if (accountDetails.Name != null) {
                                                System.debug('Yes, add to clientUpsert List' + accountDetails);
                                                System.debug('Account Upsert List Before Add' + clientUpsert);
                                                clientUpsert.add(accountDetails);
                                                System.debug('Account Upsert List After Add' + clientUpsert);
                                            }    
                                
                                } //item 
                            } // file
                        } //files
                    } //pickResponse
                } //passThroughReqResult
            } //passThroughReqResponse

    try {
    System.debug('Upsert These Records' + clientUpsert);
    upsert clientUpsert;
	} catch(DmlException e) {
    System.debug('The following exception has occurred during Upsert: ' + e.getMessage());
	}
	System.debug('Succesfully Upserted the Following.' + clientUpsert);
    
    //Update Latest Request Date, GTTIME, LTTIME for next Policy Delta Sync 
    SagittaInfo__c sagInfo = new SagittaInfo__c();
        sagInfo.Id                  = sagittaSettings.get(0).Id;
        sagInfo.Client_Sync_Sent__c = false;
        update sagInfo; 

            
    } 

}


Has anyone run into this before? Did some searching around the forums and saw the use of Test.isRunning() but not sure I want to exclude portions of my class when testing. 
 

Thanks as always! 

I am in the process of creating a test class on a @future callout. I am running into an issue when the class is fired by the test class it thinks variables are null when I am setting it in the class. 

Here is my test class: 
 
@isTest
public class TestClientQueryCallout {



     @isTest static void testCallout() {
     
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new MockClientQueryResponse());
        
        // Call method to test.
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        Test.startTest();
        ClientBatchQuery.sendBatchQuery();
        Test.stopTest();
        HttpRequest req = new HttpRequest();
        MockClientQueryResponse mock = new MockClientQueryResponse();
        HttpResponse res = mock.respond(req);
        // Verify response received contains fake values
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'text/xml');
        String actualValue = res.getBody();
        String expectedValue = '{"foo":"bar"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
    }
}

When it calls 'ClientBatchQuery.sendBatchQuery();' it fails on a variable it finds to be null. Here is a snippet of my class and how I am setting those variables. As you can see I am creating a list that is populated by a SOQL query. When the test class run it triggers an error when it gets to the 'writer.writeAttribute(null,null,'value', account);'. Indicating Argument can't be null. Is there an issue running a test class in conjuction with a SOQL query? 
public static void sendBatchQuery() {    

   	String account;
   	String username;
   	String password;
   	String serverpool;
    //Get Sagitta Info Main Record Data
    List<SagittaInfo__c> sagittaSettings = new List<SagittaInfo__c>([Select Id, Name, account__c, username__c, password__c, serverpool__c, Client_Date__c, Client_GTTIME__c,Client_LTTIME__c, 
                                                                    Client_Sync_Sent__c,Client_Sync_Minutes__c,UniVerse_Time__c,Current_UniVerse_Time__c
                                                                    from SagittaInfo__c where Name = 'MAIN']);
    //Set login credentials for Saggita 
    if (sagittaSettings.size()>0){
     account    = sagittaSettings.get(0).account__c;
     username   = sagittaSettings.get(0).username__c;
     password   = sagittaSettings.get(0).password__c;
     serverpool = sagittaSettings.get(0).serverpool__c;
    }
    
    // Create XmlStreamWriter  
    XmlStreamWriter writer = new XmlStreamWriter();    
            
    //Build PassThroughReq Soap XML 
        writer.writeStartDocument('utf-8','1.0');  
            writer.writeStartElement(null,'soap12:Envelope',null);
            writer.writeAttribute(null,null,'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
            writer.writeAttribute(null,null,'xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
            writer.writeAttribute(null,null, 'xmlns:soap12', 'http://www.w3.org/2003/05/soap-envelope');
                    
            writer.writeStartElement(null,'soap12:Body', null);
                writer.writeStartElement(null,'PassThroughReq',null);
                writer.writeAttribute(null,null,'xmlns', 'http://amsservices.com/');
                    writer.writeStartElement(null,'XMLinput',null);
                        writer.writeStartElement(null,'INPUT',null);
                                writer.writeStartElement(null,'Account',null);
                			    writer.writeAttribute(null,null,'value', account);
                                writer.writeEndElement(); // Account Close
                			    writer.writeStartElement(null,'Username',null);
                			    writer.writeAttribute(null,null,'value', username);
                                writer.writeEndElement(); // Username Close
    						    writer.writeStartElement(null,'Password',null);
                			    writer.writeAttribute(null,null,'value', password);
                                writer.writeEndElement(); // Password Close
                			    writer.writeStartElement(null,'Serverpool',null);
                			    writer.writeAttribute(null,null,'value', serverpool);
                                writer.writeEndElement(); // Serverpool Close
                                writer.writeStartElement(null,'Access',null);
                                writer.writeAttribute(null,null,'statement', 'LIST CLIENTS WITH AUDIT.DATE.TIME GT \\'+ String.valueOf(sagittaSettings.get(0).UniVerse_Time__c) +'\\ *OUTPUT* CLIENT.CODE CAT.CODE.1 CLIENT.NAME ADDR1 ADDR2 CITY STATE ZIP.CODE PRIME.PROD PRIME.SERVICER.NAME PHONE1 PHONE2 EMAIL.ADDRESS');
                                writer.writeEndElement(); // Access Close
                        writer.writeEndElement(); // INPUT Close
                        writer.writeEndElement(); // XMLinput Close
                    writer.writeEndElement(); // PassThroughReq Close
                writer.writeEndElement(); // Soap Body Close
            writer.writeEndElement(); // Envelope Body Close

 
I'm reading through the documentation and the example provide shows the following for creating a test class using MockHttpResponse. 
@isTest
private class CalloutClassTest {
     @isTest static void testCallout() {
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
        
        // Call method to test.
        // This causes a fake response to be sent
        // from the class that implements HttpCalloutMock. 
        HttpResponse res = CalloutClass.getInfoFromExternalService();
        
        // Verify response received contains fake values
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"foo":"bar"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
    }
}

Since my class is @future it does not return anything. How do I approach creating the test class for a callout that does not return anything. I've been reading and see the use of Test.startTest() and Test.stopTest() but not sure where to apply that in my test class. 

Thanks for the help. 
I am getting a unique SOAP response from a SOAP query request I am doing from Salesforce to an external system (AS400). 

This response is a product of a query I send to the external system asking what has changed and to provide certain fields that have changed. If you notice the first response is a map of the fields that will be in the response. "<a1>POLICY.NUMBER</a1> <a2>CLIENT.CODE</a2>"..ect..

I have tried to use XMLStreamReader and the DOM class, but I'm having trouble actually getting to the Item and corresponding A1,A2,A3 elements. Any ideas on how best to handle this response? 

Also, there will be cases where there is more than one record that is returned so I will have to find every "File" that is returned (other than the index File) and make sure to assign all the values associated with that given File. Then continue looping through onto the next File and assign the other fields / values to that record. 

Example of XML Response: 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <PassThroughReqResponse xmlns="http://amsservices.com/">
            <PassThroughReqResult><?xml version="1.0"?>
<PickResponse>
  <Files>
    <File sagfile="WORK.7864470">
      <Item sagitem="WEBSERVICE.TAGS*WORK.7864470">
        <a1>POLICY.NUMBER</a1>
        <a2>CLIENT.CODE</a2>
        <a3>EFF.DATE</a3>
        <a4>EXP.DATE</a4>
        <a5>COV</a5>
        <a6>INS</a6>
        <a7>TERM</a7>
        <a8>POLICY.STATUS</a8>
        <a9>BILLING.METHOD</a9>
        <a10>31</a10>
        <a11>32</a11>
        <a12>33</a12>
        <a13>POLICY.STATUS</a13>
        <a14>NEW.REN</a14>
        <a15>CHG.TIME</a15>
      </Item>
    </File>
    <File sagfile="WORK.7864470">
      <Item sagitem="579615">
        <a1>TESTINGNEW</a1>
        <a2>ZIMJO1</a2>
        <a3>08/08/16</a3>
        <a4>08/08/17</a4>
        <a5>ARA</a5>
        <a6>CER</a6>
        <a7>A</a7>
        <a9>Agency Bill</a9>
        <a14>NEW</a14>
        <a15>12:06:46</a15>
      </Item>
    </File>
  </Files>
</PickResponse></PassThroughReqResult>
        </PassThroughReqResponse>
    </soap:Body>
</soap:Envelope>

Here is a code snippet that I have hacked to work, but it is not efficient and often times hangs due to CPU usage. This continues on for each A# tag. 
 
//Capture SagittaID
        List<String> sagittaID = new List<String>();

        //List values to be returned 
        List<String> sagittaResponseTag = new List<String>(); 
        sagittaResponseTag.add('Item');
        sagittaResponseTag.add('a1'); //Client Code
        sagittaResponseTag.add('a2'); //Policy Number
        sagittaResponseTag.add('a3'); //Effective Date
        sagittaResponseTag.add('a4'); //Expiration Date
        sagittaResponseTag.add('a5'); //Cov
        sagittaResponseTag.add('a6'); //Insuror
        sagittaResponseTag.add('a7'); //Term
        sagittaResponseTag.add('a8'); //Policy Status
        sagittaResponseTag.add('a9'); //Billing Method
        sagittaResponseTag.add('a10'); //Written Prem
        sagittaResponseTag.add('a11'); //Written Agency Prem
        sagittaResponseTag.add('a12'); //Writer Producer Prem
        sagittaResponseTag.add('a13'); // Policy Status
        sagittaResponseTag.add('a14'); // New or Renewal


        for (Integer i = 0; i < sagittaResponseTag.size(); i ++) {  

             
            while (reader.hasNext()) { //while there are more XML events
                if (reader.getEventType() == XmlTag.START_ELEMENT) { //if this is the opening tag
                    String localName = reader.getlocalName();
                    String listTag   = string.valueOf(sagittaResponseTag.get(i));
                    System.debug('Inside Loop  :' + i + 'Local Tag Name  :' + localName + 'Does this equal :' + listTag);
            
                    if (sagittaResponseTag.get(i) == reader.getlocalName()) {
                        if (sagittaResponseTag.get(i) == 'Item' && reader.getLocalName() == 'Item') {
                            for (Integer a = 0; a < reader.getAttributeCount(); a ++) { 
                                if (reader.getAttributeLocalName(a).equals('sagitem')) { 
                                    theSagittaIdValue = reader.getAttributeValueAt(a); 
                                    sagittaID.add(theSagittaIdValue);
                                    System.debug('Found SagittaID: ' + i + '  Value :'+ theSagittaIdValue);
                                     
                                }  
                            } 
                        }  
                    } 
                } reader.next();  //advance to the next XML event

                if ('a1' == reader.getlocalName()) {
                    System.debug('Found A1');
                    while(reader.hasNext()) { //while there are more XML events
                        if (reader.getEventType() == XmlTag.END_ELEMENT) { //if this is the closing tag
                            break; //exist the loop
                        } else if (reader.getEventType() == XmlTag.CHARACTERS) { //if this is the content between the tags
                            theSagittaCodeValue = reader.getText();
                           // grab the content
                            if(theSagittaCodeValue != null) {
                                sagittaClientCode.add(theSagittaCodeValue);
                                System.debug('Sagitta Client Code: Insert' + ':' + theSagittaCodeValue );
                            }
                        }
                        
                        
                    }

                } reader.next(); //advance to the next XML event


 
I am getting the current date using system.now and then trying to format my date into this format 'MM/dd/yyyy'.
 
When I log the current date is shows today (2016-08-11) which of course is correct. But, when I format the date is reflects the date as yesrterday (08/10/2016).

I am spinning my wheels. Has anyone run into this? Here is what I am doing.
 
DateTime now       = system.now().date();
String day         = now.format('dd');
String nowFormat   = now.format('MM/dd/yyyy','EST');


System.debug('Right now Date: ' + now);
System.debug('Day of the Month: ' + day);
System.debug('Full Date: ' + nowFormat);

 
I am trying to get a string value off the User object. When I run a debug it is returning not only the Sagitta_User_Code__C, but the ID as well. I just want to get the Sagitta_User_Code__c. How do I isolate just the value of the Sagitta_User_Code__c. 
 
List<User> accountOwner = [Select Sagitta_User_Code__c From User where id =: accnt.ownerid];
        System.debug('Sagitta Login: ' + '' + accountOwner);

Debug Log:
 
|USER_DEBUG|[22]|DEBUG|Sagitta Login: User:{Sagitta_User_Code__c=ral, Id=005400000032HgHAAU}

 
     Parent Object: Account 
     Child Object:Sagitta Sequences
         Master detail field to Accounts: Account
         API Name: Account__c
         Child Relationship Name: Sagitta_Sequences

I am trying to run a query from the account object and get the Sagitta Sequences Name field. This works to return the records that have the child record associated. 
 
Select id, name
FROM Account 
WHERE id in (Select account__c From Sagitta_Sequence__c)
I am trying to include the Sagitta_Sequence__c.Name from the child object but I keep getting an error. I was trying this:
 
Select id, name, Sagitta_Sequence__c.Name
FROM Account 
WHERE id in (Select account__c From Sagitta_Sequence__c)

Thanks for the help.