• Mathew Andresen 5
  • SMARTIE
  • 648 Points
  • Member since 2014
  • Director of Finance and Business Systems
  • Terravant Wine Company

  • Chatter
    Feed
  • 8
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 64
    Questions
  • 170
    Replies

Hi,
I'm stuck at the first challenge where it always returns me:
Could not find an entry in the ServiceCredentials custom setting named 'BillingServiceCredential' with the specified username and password. Ensure the you have entered the data correctly into the custom settings record.
I think that I did everything right. The unmanaged package came with a custom setting called ServiceCredentials:

User-added image
I clicked manage and added the BillingServiceCredential

User-added image

With following details
User-added image

Still giving me above error!
Any ideas?

Regs,
Pieter

 built a reporting calendar that displays events and allows you to filter by department etc. It also includes some additional event fields such as completed.
Then my users create recurring events for reports (say every Monday do event X) that they need to mark complete.
But when trying to mark the event complete through apex I get the following error
"You cannot reassign a recurring event occurrence"
Note going back and changing the recurring event won't work, because I want to change each event individually, even if it started as a recurrence.
Any ideas on how to do this besides creating my own apex method that creates recurring events?
 
@AuraEnabled
    public static List<Event> getEventList(Decimal month, Decimal year) {
        Integer workingMonth = (Integer)month;
        Integer workingYear = (Integer)year;
        system.debug('year ' + year);
        system.debug('currentMonth' + workingMonth);
        List<Event> eventList = [SELECT Subject, Id, StartDateTime, Department__c, Out_Of_Office__c, Status__c, Reporting_Calendar__c FROM Event 
                                 WHERE (CALENDAR_MONTH(StartDateTime) = :workingMonth AND CALENDAR_YEAR(StartDateTime) = :workingYear) AND Reporting_Calendar__c=true AND isRecurrence=false]; //
        system.debug(eventList);
        return eventList;
    }
    
    @AuraEnabled
    public static Event getNewEvent(Event newEvent) {
        String userId = UserInfo.getUserId();
        newEvent.OwnerId = userId;
        upsert newEvent;
        system.debug(newEvent);
        return newEvent;
    }

 
Hi,

Normally in Salesforce there is a lookup field for users you can click and find the user.  Is there an easy way to do this in lightning?

Thanks,
Hi,

I developed a customizable ligtning calendar component.  It queries event data and then puts the event subjects on the relevant days.  Everything works great, except I can't get my calendar days to align properly.  The days with data in them don't align with the days that don't. I put all code here in case anyone else wants a working lightning calendar

Any ideas?  
 
<!-- Calendar.cmp  -->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" controller="CalendarEvent_CLASS">
    <aura:attribute name="daysOfWeek" type="String[]"/>
    <aura:attribute name="week1" type="String"/>
    <aura:attribute name="month" type="String"/>
    <aura:attribute name="currentMonth" type="Date"/>
    <aura:attribute name="pickList" type="String[]"/>
    <aura:attribute name="selectedDept" type="String" default="Any"/>
    <aura:attribute name="selectedUser" type="String" default="Any"/>
    <aura:attribute name="eventList" type="Event[]"/>
 
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
 
    <div class="slds-grid slds-page-header"   role="banner">  <!-- banner  -->
        
        
        <div class=" slds-size--1-of-12 slds-align--absolute-center"   > <lightning:buttonIcon name="back" alternativeText="Back" iconName="utility:chevronleft" onclick="{!c.lastMonth}"/> </div>
   	    <div class=" slds-size--9-of-12 slds-align--absolute-center"> <b>{!v.month} </b></div>
        <div class=" slds-size--1-of-12 slds-align--absolute-center"  >  <lightning:buttonIcon name="back" alternativeText="Back" iconName="utility:chevronright" onclick="{!c.nextMonth}"/> </div>
        <div class=" slds-size--1-of-12 slds-align--absolute-center"  > 
            
    <lightning:select name="pick" label="Department" onchange="{!c.updateDepartment}" aura:id="pickId">
        <aura:iteration items="{!v.pickList}" var="item">
        <option value="{!item}">{!item}</option>
        
        </aura:iteration>
    
    </lightning:select>
        
        </div>
            
    </div>

	<table class="slds-table slds-table--bordered slds-is-resizable" role="grid">
  		<thead>
   			 <tr class="slds-text-title--caps">
                 <aura:iteration items="{!v.daysOfWeek}" var="day">
                     <th class="slds-cell-shrink" scope="col" style="text-align: center;"><b>{!day}</b> </th>
                 </aura:iteration>
            </tr>
        </thead>
        <tbody>
   {!v.body}
        
        </tbody>
    </table>


    

	
</aura:component>

({
    // Calendar - controller
    
	doInit : function(component, event, helper) {
        var today = new Date();
        var dd = today.getDate();
        var mm = today.getMonth(); //January is 0!
        var yyyy = today.getFullYear();
      // get first day of month
        var today = new Date(yyyy, mm, 1); 
        component.set("v.currentMonth", today);
        var selected = component.get("v.selectedDept");
       helper.retrievePickList(component);
        helper.retrieveEventList(component, mm +1, yyyy, selected);
	},  // end function
    
    
    lastMonth : function(component, event, helper) {
        var currentMonth = component.get('v.currentMonth');
        currentMonth = new Date(currentMonth);
        
        currentMonth = currentMonth.setMonth(currentMonth.getMonth() -1);
        currentMonth = new Date(currentMonth);
        component.set('v.currentMonth', currentMonth);
        var month = currentMonth.getMonth() +1;
        var year = currentMonth.getFullYear() ;
        var selected = component.get("v.selectedDept");
        helper.retrieveEventList(component, month, year);
	},
    
 
    nextMonth : function(component, event, helper) {
        var currentMonth = component.get('v.currentMonth');
        currentMonth = new Date(currentMonth);
        
        currentMonth = currentMonth.setMonth(currentMonth.getMonth() +1);
        currentMonth = new Date(currentMonth);
        component.set('v.currentMonth', currentMonth);
        var month = currentMonth.getMonth() +1;
        var year = currentMonth.getFullYear() ;  
        var selected = component.get("v.selectedDept");
        helper.retrieveEventList(component, month, year);
        
	},


    updateDepartment : function(component, event, helper) {  
        var selected = component.find("pickId").get("v.value");
        component.set('v.selectedDept', selected);
        console.log('result' + selected);
    	var currentMonth = component.get('v.currentMonth');
        currentMonth = new Date(currentMonth);
        var month = currentMonth.getMonth() +1;
        var year = currentMonth.getFullYear() ;
        helper.createCalendar(component);        
    },
    
    
    
})
 
({
    // calendar - helper
    
    retrievePickList : function(component) {
		var action = component.get("c.getDepartments");
       
       // action.setParams({"month": month, "year": year});
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                var returned =response.getReturnValue();
                console.log("SUCCESS returned: " + JSON.stringify(returned));
                component.set('v.pickList', returned);
            }
        });
        $A.enqueueAction(action);          
    },
    
    
    retrieveEventList : function(component, month, year) {
		var action = component.get("c.getEventList");
        action.setParams({"month": month, "year": year});
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                var returned =response.getReturnValue();
                component.set('v.eventList', returned);
                // console.log("SUCCESS returned: " + JSON.stringify(returned));
                var that = this;
                that.createCalendar(component);

            }
        });
        $A.enqueueAction(action);          
    },
    
    
    
	createCalendar : function(component) {
        var eventList = component.get('v.eventList');
        var today = component.get('v.currentMonth');
        var selectedDept = component.get('v.selectedDept');
		
        //these are labels for the days of the week
        var cal_days_labels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];    
        component.set('v.daysOfWeek', cal_days_labels)
        // these are human-readable month name labels, in order
        var cal_months_labels = ['January', 'February', 'March', 'April',
                         'May', 'June', 'July', 'August', 'September',
                         'October', 'November', 'December'];        
		            
        //today = new Date();
        var dd = today.getDate();
        var mm = today.getMonth(); //January is 0!
        var yyyy = today.getFullYear();
        // get first day of month
        var firstDay = new Date(yyyy, mm, 1);
        console.log(' firstday = ' + firstDay);
				
		        
        var startingDay = firstDay.getDay();
        var nextDay = new Date(firstDay);
        component.set('v.month', cal_months_labels[mm] + ' ' + yyyy);       
        console.log(' starting day ' + startingDay);
	    
        // find number of days in month
        var monthLength = new Date(yyyy, mm, 0).getDate() +1;
        console.log (' monthLength ' + monthLength);  
				       
        // compensate for leap year
        if (mm == 2) { // February only!
        	if((yyyy % 4 == 0 && yyyy % 100 != 0) || yyyy % 400 == 0){
          		monthLength = 29;
        }
      }
        
        

 // **********************************************************************88   
    // Array of components to create
    	var newComponents = [];
        
        // put the weeks/table rows in the components array
        for (var i = 0; i < 7; i++) 
        {
			newComponents.push(["aura:html", {
            	"tag": "tr"
      		}]);              
        }
        
        for (var i = 1; i <= startingDay; i++) {
            // put the days rows in the components array
       		 newComponents.push(["c:CalendarDay", {
				"visible": false
        	 }]); 
        }           
  
 // **********************************************************************88 
 // in this section, we loop through the days of the month and create components for each day       
        for (var i = 1; i <= monthLength; i++) {  //
            var stringBody = [];
            var nextDay = nextDay.toISOString().slice(0,10);
            // console.log('nextDay ' +nextDay);
            for(var e = 0;  e < eventList.length; e ++) {
                var eventDate = new Date(eventList[e].StartDateTime);
                var eventDept = eventList[e].Department__c;
                eventDate = eventDate.toISOString().slice(0,10);
                // if the calendar day of the month matches the calendar day of the event, then add the subject of the event to the calendar day compeonet
            	if (eventDate == nextDay) {
                    if (selectedDept == 'Any') {
                    	stringBody.push(eventList[e].Subject);    
                    }
                    else if (eventDept == selectedDept) {
                        stringBody.push(eventList[e].Subject); 
                    }
            	}                
            } // end for 

            // increament day for the date variable
            var nextDay = new Date(nextDay);
            var dateValue = nextDay.getDate() + 1;
            nextDay.setDate(dateValue);
     		
            newComponents.push(["c:CalendarDay", {
				"day": i,
                 "toDoItems": stringBody
        	 }]); 
        }  
        
        for (var i = 1; i <= 5; i++) {
            // put the days rows in the components array
       		 newComponents.push(["c:CalendarDay", {
                 "visible": false
        	 }]); 
        }             
            
 // **********************************************************************88           
 
   $A.createComponents(newComponents,
        function (components, status, errorMessage) {
           if (status === "SUCCESS") {
               var pageBody = component.get("v.body");
               pageBody = [];
               for (var outer = 0; outer < 5; outer ++) {	
                    var tr = components[outer];
                    var trBody = tr.get("v.body");
                    for (var inner = 1; inner < 8; inner ++) {
                        var outerAdj = outer +0;
                    	var adj =  6 + + inner + (7 * outerAdj); 
                        var toDay = components[adj];
                        trBody.push(toDay);
                    }
                    tr.set("v.body", trBody)
                    pageBody.push(tr);
               }

				component.set("v.body", pageBody);
            }  // end success
            else // Report any error
            {
                this.displayToast("Error", "Failed to create list components.");
            }
        } // end callback function
    );     // end create component   
        		
	}
})

<!-- CalendarDay.cmp  -->
<aura:component >
    <aura:attribute name="day" type="String"/>
    <aura:attribute name="visible" type="Boolean" default="true"/>
    <aura:attribute name="toDoItems" type="String[]"/>
    
    <td class = "outline" scope="col" >
       <aura:if isTrue="{!v.visible}">  
        <fieldset class="slds-box slds-theme--default ">
           
            
            
    <table class="subtable" style="vertical-align:top">
  		<thead>
   			 <tr >

                    <th   class="thClass"> {!v.day} </th>

            </tr>
        </thead>
        <tbody>
        	<aura:iteration items="{!v.toDoItems}" var="item">
           		<tr><td >{!item} </td></tr>
               </aura:iteration>
            

        
        </tbody>
    </table>
 

            
        </fieldset>
           </aura:if>
        </td>
	
</aura:component>

/* calendarDay.css  */

.THIS.outline {
    border: solid black 1px;
    float: top;
}

.THIS .thClass {
    vertical-align:top;
    text-align: center;

}

.THIS .subtable {
        vertical-align:top;
    position: relative;
     






}


 
Hi,

Is there an easy way to clone opportunities and products in lightning?  

Thanks,
Hi All,
I need to fetch data from multiple apex methods which yield separate and different lists of objects but I only have one DoInit function and one possible object to be passed to $A.enqueueAction(action). If i call the enqueueAction several times each for a different object, it malfunctions.

Can you think of any solution where I can call different methods on the same class and also set different attributes on my components once the data has returned? without the need of havingg to separate each methods to have its own component. I just created one component just for demo purposes to the client and i want to have it worked the soonest. TIA
Hi All,

I want to display a GRID view page based on SDLS (Salesforce Lightning Design System) which can fetch the list of Account and its associated attributes. The idea is to have a single view showing multiple GRID for each accounts based on some categorization like slow support cases, recently viewed and Stale Accounts. for example the Image below can give a rough idea.



First Screen
Once the user clicks any Account inside the GRID view, for example Account1 in Slow Support case section. Another View will open which will display the account information for that particular Account being clicked and will show the list of support cases in another GRID view section. Refer the Screenshot below.
Second Screen
                            
 
Hi all,

i want to customize lightning calendar.how can i do it.can any one try to help me.

Thank you..
HI,

I am working on a requirement where below are the two criterias , I created two checkboxes on opportunity , Proposals and opportunity do not share master detail relationship,

So workflows might not work, Any suggestions?

field on Opportunity (checkbox): "Has Primary Accepted Proposal"
Logic:  If Proposal that is Primary is changed to Approval Stage = "Accepted", then check this box.  If the Primary proposal is deleted from the opportunity or the status of the primary is changed from Accepted to something else, uncheck this box.

Field on Opportunity (checkbox):   "Has Proposal"
Logic:  If Opportunity has at least one Proposal attached, the box should be checked.  If all Proposals attached to Opp are deleted, this box should be unchecked.  
Hi,

I have developed an account based forecast tool for my current company and am considering trying to get it on the app exchange.  Anyone that might be interested in a partnership to do so please contact me.

Thanks,

Mathew
Hi,

I have two data tables, the top one provides summary information for the bottom one.  But they don't always line up even though they have the same number of columns, and I use the width parameter on the data tables to make sure they are the same size..  Is there a good way to make sure the columns from the top and bottom data table always line up.  

Thanks,
 
Hi,

I'm trying to use apex:repeat to loop through the list of contacts attached to a opportunity (through the account), but I'm getting an error.  I assume my dot notation is messed up.

What I have is
 
<apex:repeat value="{!Opportunity.account.contacts}" var="con">

Thanks,
Hi,

I have a map/list with year over year sales by quarter for accounts.  I want to calculate the change year over year.  For example if Q1 prior year is 100 and Q1 current year is 150 then the growth should be 150.

Currently what I'm doing is changing my map into a list and then doing the calculation based on the position in the list, but I'm wondering if there is a better way to do this. 

Any thoughts?
 
for (PivotTimeSeries_Class.PivotRowWrapper wrapper :partialRowList) {
            List<decimal> salesList = new List<decimal>();
            for (string period:periodYearList) {
                salesList.add(wrapper.amountMap.get(period));
            }
        	map<string, decimal> growthMap = new map<string, decimal>();
            decimal Y1Total;
            decimal Y2Total;
            decimal q1Growth;
            decimal q2Growth;
            decimal q3Growth;
            decimal q4Growth;
            decimal YGrowth;
            
            Y1Total = salesList[0] + salesList[1] + salesList[2] + salesList[3];
            Y2Total = salesList[5] + salesList[6] + salesList[7] + salesList[8];

            wrapper.amountMap.put('Y1 Total', Y1Total);
            wrapper.amountMap.put('Y2 Total', Y2Total);
            if (salesList[0] != 0 && salesList[0] != NULL && salesList[4] != 0 && salesList[4] != NULL) { q1Growth = salesList[4]/salesList[0]*100 -100; } else { q1Growth = 0; } growthMap.put('P1Growth', q1Growth); 
            if (salesList[1] != 0 && salesList[1] != NULL && salesList[5] != 0 && salesList[5] != NULL) { q2Growth = salesList[5]/salesList[1]*100 -100; } else { q2Growth = 0; } growthMap.put('P2Growth', q2Growth); 
            if (salesList[2] != 0 && salesList[2] != NULL && salesList[6] != 0 && salesList[6] != NULL) { q3Growth = salesList[6]/salesList[2]*100 -100; } else { q3Growth = 0; } growthMap.put('P3Growth', q3Growth); 
            if (salesList[3] != 0 && salesList[3] != NULL && salesList[7] != 0 && salesList[7] != NULL) { q4Growth = salesList[7]/salesList[3]*100 -100; } else { q4Growth = 0; } growthMap.put('P4Growth', q4Growth); 
            if (Y1Total != 0 && Y2Total != 0) { YGrowth = Y2Total / Y1TOtal*100 -100; system.debug ('firing'); } else { YGrowth = 0; } growthMap.put('YoY Growth', YGrowth);
            system.debug('YGrowth = ' +YGrowth);
            sortList.add(new SortWrapper(new CompleteRowWrapper(wrapper, growthMap)));

        }
        sortList.sort();
        for (SortWrapper sorted:sortList) {
            CompleteRowList.add(sorted.wrapper);
        }

 
I have the following code, but when I open this VF I just receive the error: The value 'null' is not valid for operator '>'

I really dont know what I'm missing, I think its related with pageBlockTable.

Thanks in advance.
 
<apex:page StandardController="Opportunity" contenttype="application/pdf" renderAs="pdf">
<apex:stylesheet value="{!$Resource.landscape}"/>

    <apex:pageBlock >
 	<apex:form >
        <apex:variable var="i" value="{!0}"/>
    		<apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" rendered="{!OR(ISNULL(Opportunity.Desconto__c),Opportunity.Desconto__c=0)}" var="oli" cellpadding="4" style="font-size:14px" border="0">
                <apex:column > 
                	 <apex:variable var="i" value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, i+1, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, i+1, i))}"/>
                 </apex:column>
			<apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Código"><apex:outputText >{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.productcode, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.productcode, null))}</apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Descrição">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.name, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.name, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Fabricante">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Fabricante__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Fabricante__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="ANVISA">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.ANVISA__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.ANVISA__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;text-align:center;" headerValue="Fornecedor">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;text-align:center" headerValue="Qtde"><apex:outputText value="{0,number, integer}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Quantidade_cotada__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Quantidade_consumida__c, null))}"/></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Preço"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), null))}" /></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Valor"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.Total_cotado__c >= 1000000,TEXT(FLOOR(oli.Total_cotado__c / 1000000)) & ".","") & IF(oli.Total_cotado__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_cotado__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_cotado__c)), 3) & "," & IF(MOD(oli.Total_cotado__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.Total_consumido__c >= 1000000,TEXT(FLOOR(oli.Total_consumido__c / 1000000)) & ".","") & IF(oli.Total_consumido__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_consumido__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_consumido__c)), 3) & "," & IF(MOD(oli.Total_consumido__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100, 99))), null))}"/></apex:column>
                 
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Código"><apex:outputText >{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.productcode, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.productcode, null))}</apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Descrição">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.name, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.name, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Fabricante">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Fabricante__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Fabricante__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="ANVISA">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.ANVISA__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.ANVISA__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;text-align:center;" headerValue="Fornecedor">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;text-align:center;" headerValue="Qtde"><apex:outputText value="{0,number, integer}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Quantidade_cotada__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Quantidade_consumida__c, null))}"/></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Preço"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), null))}" /></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Valor"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.Total_cotado__c >= 1000000,TEXT(FLOOR(oli.Total_cotado__c / 1000000)) & ".","") & IF(oli.Total_cotado__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_cotado__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_cotado__c)), 3) & "," & IF(MOD(oli.Total_cotado__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.Total_consumido__c >= 1000000,TEXT(FLOOR(oli.Total_consumido__c / 1000000)) & ".","") & IF(oli.Total_consumido__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_consumido__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_consumido__c)), 3) & "," & IF(MOD(oli.Total_consumido__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100, 99))), null))}"/></apex:column>
			</apex:pageBlockTable>
        
<!-- Se não tem desconto, é a lista relacionada de cima, se sim é o de baixo -->
        
        
             <apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" rendered="{!NOT(OR(ISNULL(Opportunity.Desconto__c),Opportunity.Desconto__c=0))}" var="oli" cellpadding="4" style="font-size:14px" border="0">
                 <apex:column > 
                 	<apex:variable var="i" value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, i+1, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, i+1, i))}"/>
                 </apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Código"><apex:outputText >{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.productcode, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.productcode, null))}</apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Descrição">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.name, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.name, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO','Fabricante','Lote')}">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Fabricante__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Fabricante__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="ANVISA">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.ANVISA__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.ANVISA__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;text-align:center;" headerValue="Fornecedor">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;text-align:center" headerValue="Qtde"><apex:outputText value="{0,number, integer}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Quantidade_cotada__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Quantidade_consumida__c, null))}"/></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Preço Lista"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), null))}" /></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;text-align:center;" headerValue="Desc"><apex:outputText value="{0,number,percent}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Discount/100, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Discount/100, null))}" /></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Preço Desconto"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Valor_cotado__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Valor_consumido__c, null))}"/></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 0, true, false)}" style="background:#edf9fc;" headerValue="Valor"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.Total_cotado__c >= 1000000,TEXT(FLOOR(oli.Total_cotado__c / 1000000)) & ".","") & IF(oli.Total_cotado__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_cotado__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_cotado__c)), 3) & "," & IF(MOD(oli.Total_cotado__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.Total_consumido__c >= 1000000,TEXT(FLOOR(oli.Total_consumido__c / 1000000)) & ".","") & IF(oli.Total_consumido__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_consumido__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_consumido__c)), 3) & "," & IF(MOD(oli.Total_consumido__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100, 99))), null))}"/></apex:column>
                 
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Código"><apex:outputText >{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.productcode, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.productcode, null))}</apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Descrição">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.name, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.name, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO','Fabricante','Lote')}">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Fabricante__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Fabricante__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="ANVISA">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.ANVISA__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.ANVISA__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;text-align:center;" headerValue="Fornecedor">{!IF(Opportunity.pdfPre_Pos__c = 'COTAÇÃO' && oli.Quantidade_cotada__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.PricebookEntry.Product2.Representante_nacional__c, null))}</apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;text-align:center;" headerValue="Qtde"><apex:outputText value="{0,number, integer}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Quantidade_cotada__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Quantidade_consumida__c, null))}"/></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Preço Lista"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.UnitPrice >= 1000000,TEXT(FLOOR(oli.UnitPrice / 1000000)) & ".","") & IF(oli.UnitPrice >= 1000,RIGHT(TEXT(FLOOR(oli.UnitPrice / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.UnitPrice)), 3) & "," & IF(MOD(oli.UnitPrice , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.UnitPrice , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.UnitPrice , 1), 2) * 100, 99))), null))}" /></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;text-align:center;" headerValue="Desc"><apex:outputText value="{0,number,percent}"><apex:param value="{!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Discount/100, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Discount/100, null))}" /></apex:outputText></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Preço Desconto"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, oli.Valor_cotado__c, IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, oli.Valor_consumido__c, null))}"/></apex:column>
                <apex:column rendered="{!IF((mod(i,2)) == 1, true, false)}" style="background:#cdf9eb;" headerValue="Valor"><apex:outputText value="R${!IF(Opportunity.pdfPre_Pos__c="COTAÇÃO" && oli.Quantidade_cotada__c>0, IF(oli.Total_cotado__c >= 1000000,TEXT(FLOOR(oli.Total_cotado__c / 1000000)) & ".","") & IF(oli.Total_cotado__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_cotado__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_cotado__c)), 3) & "," & IF(MOD(oli.Total_cotado__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_cotado__c , 1), 2) * 100, 99))), IF(Opportunity.pdfPre_Pos__c = 'PÓS' && oli.Quantidade_consumida__c>0, IF(oli.Total_consumido__c >= 1000000,TEXT(FLOOR(oli.Total_consumido__c / 1000000)) & ".","") & IF(oli.Total_consumido__c >= 1000,RIGHT(TEXT(FLOOR(oli.Total_consumido__c / 1000)), 3) & ".","") & RIGHT(TEXT(FLOOR(oli.Total_consumido__c)), 3) & "," & IF(MOD(oli.Total_consumido__c , 1) * 100 < 10,"0" & TEXT(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100),TEXT(MIN(ROUND(MOD(oli.Total_consumido__c , 1), 2) * 100, 99))), null))}"/></apex:column>
                </apex:pageBlockTable>
        <br/>
            <apex:panelGrid columns="2" style="float:right;">
                <apex:outputText escape="false" value="<b>VALOR TOTAL:</b> "></apex:outputText><apex:outputText escape="false" value="R${!IF( 
  Opportunity.Valor_cotado__c >= 1000000, 
  TEXT(FLOOR(Opportunity.Valor_cotado__c / 1000000)) & ".", 
  "") & 
IF( 
  Opportunity.Valor_cotado__c >= 1000, 
  RIGHT(TEXT(FLOOR(Opportunity.Valor_cotado__c / 1000)), 3) & ".", 
  "") & 
RIGHT(TEXT(FLOOR(Opportunity.Valor_cotado__c)), 3) & "," & 
IF( 
  MOD(Opportunity.Valor_cotado__c , 1) * 100 < 10, 
  "0" & TEXT(ROUND(MOD(Opportunity.Valor_cotado__c , 1), 2) * 100), 
  TEXT(MIN(ROUND(MOD(Opportunity.Valor_cotado__c , 1), 2) * 100, 99)) 
)}"/>
                <apex:outputText escape="false" value="<b>Prazo de pagamento:</b> {!Opportunity.Prazo__r.name}"/>
            </apex:panelGrid>
        </apex:form> 
        <br/><br/>
        
        <apex:outputText escape="false" value="<b>Observação: </b>{!Opportunity.Coment_rios_da_Cota_o__c}" rendered="{!NOT(ISNULL(Opportunity.Coment_rios_da_Cota_o__c))}"/><br/>
        
        
        </apex:pageBlock>
</apex:page>

 
Lets say I have Id of Account record and I am initializing the sobject and assigning the Id to account variable. Below is the code :
sObject obj = Schema.getGlobalDescribe().get(parentObjName).newSObject() ;
obj.Id = recordId;
System.debug('****obj : '+obj);
Debug Result: 
****obj : Account:{Id=0019000001dbup5AAA}
I was hoping that the debug will have the entire information from the account example like : Account:{Id=0019000001dbup5AAA, Name=TestAccount,...}
Is there any way to initialize the sobject in a way such that it gets loaded with the entire information?