• Jarosław Kołodziejczyk
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 17
    Replies
Hi,

I have a really urgent matter to solve.
The file i'm creating using visualforce will simply not open in excel (it opens in libreOffice), i got the error "The file format differs from the format that the file name extension specifies".

Here's my vfp code:
 
<apex:page controller="createFlockCSVController" contentType="application/vnd.ms-excel#Wstawienie.xls" cache="true">  

<apex:outputText value="{!xmlHeader}"/>

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <Styles>
 <Style ss:ID="s1">
 <Alignment/>
 <Borders/>
 <Font ss:Bold="1"/>
 <Interior ss:Pattern="Solid" ss:Color="#c8fcff"/>
 <NumberFormat/>
 <Protection/>
 </Style>

 </Styles>
 <Worksheet ss:Name="Flocks">
 <Table x:FullColumns="1" x:FullRows="1">
 <Column ss:Width="80"/>
 <Column ss:Width="70"/>
 <Column ss:Width="180"/>
 <Column ss:Width="180"/>
 <Column ss:Width="170"/>
 <Column ss:Width="180"/>
 <Column ss:Width="150"/>
 <Column ss:Width="150"/>
 <Column ss:Width="120"/>
 <Column ss:Width="160"/>
 <Column ss:Width="120"/>
 <Column ss:Width="100"/>

 <Row>
 <Cell ss:Width="100" ss:StyleID="s1"><Data ss:Type="String" >Ferma</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Kurnik</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Wstawienie</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Liczba ptaków</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Wylęgarnia</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Rasa</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Typ paszy</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Wszystkie upadki</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >FCR</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >EWW</Data></Cell>
 </Row>
 <apex:repeat value="{!flock}" var="flock">
 <Row>
 <Cell><Data ss:Type="String">{!flock.House__r.Farm__r.Name}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.House__r.Name}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Flock_number__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Birds_at_arrival__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Hatchery__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Genetic_Line__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Feed_Type__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.Total_dead__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.FCR__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flock.EWW__c}</Data></Cell>
 </Row>
 </apex:repeat>
 <Row>
 </Row>
 </Table>

<Table x:FullColumns="1" x:FullRows="1">
 <Column/>
 <Row>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Data</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Wiek(dni)</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Śr. waga[g]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Upadki</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Selekcja</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Szacowana liczba ptaków</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Spożycie paszy [g/szt]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Spożycie wody [ml/szt]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Kod paszy skarmianej</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Kod paszy dostarczonej</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Leczenie</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Notatka</Data></Cell>
 </Row>
 <apex:repeat value="{!flock.Flock_stats__r}" var="flockStats">
 <Row>
 <Cell><Data ss:Type="String">{!flockStats.DateHidden__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Day__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Avg_body_weight__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Daily_dead__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Daily_selection__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Estimated_number_of_birds__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Daily_feed_consumed__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Daily_water_consumption__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Feed_code__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Feed_code_delivered__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Treatment__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!flockStats.Note__c}</Data></Cell>
 </Row>
 </apex:repeat>
 <Row></Row>
 </Table>

 <Table x:FullColumns="1" x:FullRows="1">
 <Column/>
 <Row>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Data</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Dzień:</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Waga transportu netto u hodowcy [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Liczba ptaków u hodowcy [szt]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Waga całkowita netto z ubojni [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Liczba ptaków z ubojni [szt]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Średnia waga [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Waga konfiskaty [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Waga martwych kurczaków [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Odpad/Zwrot [kg]</Data></Cell>
 <Cell ss:StyleID="s1"><Data ss:Type="String" >Waga do rozliczenia [kg]</Data></Cell>

 </Row>
 <apex:repeat value="{!thinningList}" var="thinning">
 <Row>
 <Cell><Data ss:Type="String">{!thinning.DateHidden__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Day__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Total_weight_at_farm__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Birds_thinned_at_farm__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Total_weight_at_Slaughterhouse__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Birds_at_slaughterhouse__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Avg_body_weight__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Weight_of_confiscation__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Waste_Return__c}</Data></Cell>
 <Cell><Data ss:Type="String">{!thinning.Weight_after_reductions__c}</Data></Cell>

 </Row>
 </apex:repeat>
 </Table>

 </Worksheet>
</Workbook>

</apex:page>
xmlheader ='<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>';
Any idea why this happens?
 
Hi,

I have problem with founding a solution to close my component modal/window after my iframe visualforce has been loaded - the visualforce is a contentType="txt/xml#Wstawienie.xls" page so it's used just to download it as a xls file.
What i'm trying to achieve is click quick action (component), download file and close the modal/window (or even not show it if that's possible).
I've tried using $A.get("e.force:closeQuickAction").fire();  but it's firing too soon for file to get downloaded.
Hi,
I have a problem with displaying custom visualforce quick action in community.
It works in lightning but isn't showing in community record detail.

I'm using this page to create xls file from the opened record.

Here's apex page header:
<apex:page standardcontroller="Flock__c" extensions="createFlockCSVController" contentType="txt/xml#myTest.xls" cache="true"> 

Any idea as to why that would happen?
Hi,
I have a problem, mainly with stretchig community page column width to full size of the page (just as header is stretched).

I've tried creating my own community template but to no avail.

COMPONENT:
<aura:component implements="forceCommunity:layout" description="Custom Content Layout" access="global">
    <aura:attribute name="column1" type="Aura.Component[]" required="false"></aura:attribute>
    <aura:attribute name="column2" type="Aura.Component[]" required="false"></aura:attribute>

    <div class="container">
        <div class="contentPanel">
            <div class="center">
                {!v.column1}
            </div>
        </div>
    </div>
</aura:component>

STYLE:
.THIS .contentPanel:before,
.THIS .contentPanel:after {
    content: " ";
    display: table;
}
.THIS .contentPanel:after {
    clear: both;
}
.THIS .center {
    float: center;
    width: 100%;
}

Is this even possible?
Hi,

Is it possible to access Field Service Lightning (Managed Package) - Service appointment object from SOQL?
I've tried [SELECT Id, Name FROM FSL__Service_Appointment];
[SELECT Id, Name FROM FSL__ServiceAppointment];
[SELECT Id, Name FROM FSL__Service_Appointment__c];
and plethora of other ways, but i always get: 

"sObject type 'FSL__ServiceAppointment__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

Hello friends,

This is my second attempt at writing an apex trigger. I receiving an error when I save my trigger, "Illegal assignment from List to Decimal."
Hopefully someone can give me some pointers.

Here's my code:
trigger SRTake1 on Stack_Rank__c (after update) {
    Date myDate = Date.newInstance(2017, 01, 01);
    
    for( Stack_Rank__c s: Trigger.new){
        if(s.SR_Date__c == myDate && s.SR_Main_Sales__c == null){
            try{
                s.SR_Main_Sales__c=[Select OwnerID, SUM(quota_credit__c) from Opportunity Where OwnerID in (Select User__c From Stack_Rank__c Where SR_Date__c = 2017-01-01) AND CloseDate >= 2017-01-01 AND CloseDate <= 2017-01-31 Group By OwnerId];
            
            }
            catch(QueryException ex) {
                //todo add other entitlements
            }
            
        }
    }

}

how to update every account with same website value
Hi,

Given below is my code for javascript button to update the status field
 
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")} 

try{ 


var myquery = "SELECT Id, Name, status FROM lead WHERE Id = '{!Lead.Id}' limit 1"; 

result = sforce.connection.query(myquery); 
records = result.getArray("records"); 

var myLead= records[0]; 
var updateLead = new Array(); 

myLead.status = "Unqualified"; 
updateLead.push(myLead); 

result = sforce.connection.update(updateLead); 

if(result[0].success == "true"){ 
location.reload(); 
} 
else{ 
alert( 
"An Error has Occurred. Error: \r\n" + 
result[0].errors.message 
); 
} 
} 
catch(e){ 
alert( 
"An Un-expected Error has Occurred. Error: \r\n" + 
e 
); 
}

But i am geting the following error,

faultcode:'soapenv:Client', faultstring:'A duplicate value was specified for field 'Status' in object 'Lead', duplicate value 'Unqualified' prior value 'New'', }


What could be the reason?
  • April 20, 2017
  • Like
  • 0
Hi,
I have a Related list button with javascript code to open a new visualforce page (in Classic).
Type: List Button
Behavious: Execute Javascript
Content Source: OnClick JavaScript
   Code:
var recId = window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
window.location = '/apex/ItemUploadController?recId=' + recId;
In the above javascript getting parent record ID (recId) and opening visualforce page (ItemUploadController) new window.

This button is not appearing in Lightning (Since javascript is not supporting), how can create a list button that opens the visualforce with parent record id passing on URL?
Please advice.

 
Hi,

Is it possible to access Field Service Lightning (Managed Package) - Service appointment object from SOQL?
I've tried [SELECT Id, Name FROM FSL__Service_Appointment];
[SELECT Id, Name FROM FSL__ServiceAppointment];
[SELECT Id, Name FROM FSL__Service_Appointment__c];
and plethora of other ways, but i always get: 

"sObject type 'FSL__ServiceAppointment__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."
Hi,

I have a nested aura:iteration like this:

<aura:iteration items="{!v.results}" var="res">                  
        <tr class="slds-hint-parent">
             <aura:iteration items="{!v.ColumnsNameArr}" var="colName">
                  <td>
                          <div class="slds-truncate" ><a href="javascript:void(0);">{!res[colName]}}</a></div>
                  </td>
               </aura:iteration>                    
            </tr>
   </aura:iteration>

How can I write correct {!res[colName]}? It is possible to do something like this in lightning?

Thank you.