• Perfect Mathenjwa
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi , I have a requirement to your but I just can't get it to work.
I have  2 visualforce pages that are sharing a controller and controller extension. 
  • The first page I need to capture user input through apex:inputText.
  • On the second page I need to save the entered values as an excel document, so I have "contentType="application/vnd.ms-excel#SomeName.xls" .
  • I am using apex:actionFunction that I trigger on javascript the pageReference action on the controller extension.
For the life of me I can't get it to work, the excel page is not capturing the entered input on the first page, please help
I have lightning recordForm with 2 fields. 
 
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable,flexipage:availableForReCordHome,force:hasrecordId,force:hassObjectName" access="global" >
    
<aura:attribute name="GeneralTabFields" type="String[]" Default="['Test__c', 	'Check_Test__c' ]" />

    <lightning:card  title="General"  >
          <div class="slds-p-left_large slds-p-right_medium">	
              <lightning:recordForm aura:id="recordViewForm" 
                                    objectApiName="{!v.sObjectName}"
                                    columns="2"
                                    fields="{!v.GeneralTabFields}"
                                    recordId="{!v.recordId}"
                                    mode="View"
                                    onsuccess="{!c.onSuccess}"
                                    onsubmit="{!c.onSubmit}"
                                    onload="{!c.onLoad}"
                                    onerror="{!c.onError}"
                                    />   
          </div>
    </lightning:card>
</aura:component>

User-added image

As soon as I remove accessibility on on of the fields I get an error " [Cannot read property 'updateable' of undefined]
v.get _rows [as _rows]()@https://companysanbbox--account2.lightning.force.com/components/lightning/recordForm.js:2:5561
g()@https://companysanbbox--account2.lightning.force.com/components/lightning/recordForm.js:2:1743"
.

User-added imageUser-added imageThis was not the case with summer 19 release, the issue started on winter 20 release. The expected behavior is that if I remove access to the field, the field should just not appear on the component since Lightning recordForm respects field level security. Please help
Hello guys,

I have 2 visualforce pages and 1 apex controller extension for both. On the first page I capture some information that is displayed on the second page (renderAs PDF). 

There is no problem showing a pdf preview with the following code:
public PageReference showPDF()
{
  PageReference test = Page.Sales_Offer_PDF;
  test.setRedirect(false);
  test.getParameters().put('Id', o.Id);
  test.getParameters().put('pdf','true');

  return test;
}
Though its still the first page in the url.

But if I want to save the second page as a pdf file, it completely ignores the second page and tries to get the content from the first page.
Following Code:
public void savePDF()
    {
        PageReference pdf = new PageReference('/apex/Sales_Offer_PDF?id='+o.Id+'&pdf=true');
        
        //PageReference pdf = Page.Sales_Offer_PDF;               Both ways dont work...
        //pdf.getParameters().put('Id', o.Id);
        //pdf.getParameters().put('pdf','true');

        Blob body;

        ContentVersion v = new ContentVersion();
        try {
            body = pdf.getContent();
        } catch (VisualforceException e) {
            body = Blob.valueOf('Some Text');
            System.debug('### Exception savePDF: '+e);
        }
        v.versionData = body;
        v.title = 'Offer ('+Date.today().format()+').pdf';
        v.pathOnClient ='/Offer ('+Date.today().format()+').pdf';
        v.ProtectedFile__c = false;        

        insert v;

        ID cdId = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE ID =: v.Id].ContentDocumentId;

        ContentDocumentLink cdl = new ContentDocumentLink();
        cdl.ContentDocumentId = cdId;
        cdl.ShareType = 'V'; 
        cdl.LinkedEntityId = o.Id;
        cdl.Visibility = 'AllUsers'; 

        insert cdl;
    }
Btw. Im developing for Lightning Experience right now.
Can someone help me to save the second vf page as a pdf file. I need the same controller to keep the same view state..