Skip to main content

#Lightning Experience14 人がディスカッション中

Hello, I'm trying to export field information (name, description, help text, etc) using the Salesforce Inspector chrome extension. I've seen on here that people have done this before but I can't figure out how it works
9 件の回答
  1. 10月8日 15:58

    @Mahesh Patel

    . Try this:  

    select entitydefinition.label, inlinehelptext,fielddefinition.description,fielddefinition.label from entityparticle where entitydefinition.label = 'Contact'

0/9000
Hi ! I am working with Lighting Web Components, and looking to understand how to get meaningful error codes from the createRecord() function. 

The example I am working with is an Opportunity Create javascript function. It is supposed to fail because it is missing the Opportunity Stage Name. It fails as expected, however, the error message is not at all helpful. Here is the error message that I am receiving:

:[object Object] reduce: An error occurred while trying to update the record. Please try again. status:400 undefined. 

My question is how can I go about getting meaningful error messages in this case. Do I have to enable some kind of logging in Salesforce Options? Write a custom Apex Class that throws better errors? Or is there a different way to access the createRecord() error return to actually see what the error is?

Here is the javascript code:

 

import { LightningElement, track } from 'lwc';

import { ShowToastEvent } from 'lightning/platformShowToastEvent';

import { createRecord } from 'lightning/uiRecordApi';

import { reduceErrors } from 'c/ldsUtils';

import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';

import NAME_FIELD from '@salesforce/schema/Opportunity.Name';

import CloseDate_FIELD from '@salesforce/schema/Opportunity.CloseDate';

import StageName_FIELD from '@salesforce/schema/Opportunity.StageName';

export default class LdsCreateOpportunity extends LightningElement {

@track opportunityId;

// errorInfo = undefined;

name = '';

closeDate = new Date('December 17, 2019 03:24:00');

stageName = 'Prospecting';

// @track error;

handleNameChange(event) {

this.opportunityId = undefined;

this.name = event.target.value;

}

createOpportunity() {

const fields = {};

fields[NAME_FIELD.fieldApiName] = this.name;

fields[CloseDate_FIELD.fieldApiName] = this.closeDate;

// fields[StageName_FIELD.fieldApiName] = this.stageName; // - this breaks the save by omitting the required stage name field

const recordInput = { apiName: OPPORTUNITY_OBJECT.objectApiName, fields };

createRecord(recordInput)

.then(opportunity => {

this.opportunityId = opportunity.id;

this.dispatchEvent(

new ShowToastEvent({

title: 'Success',

message: 'Opportunity created. Message goes here!',

variant: 'success'

})

);

})

.catch(error => {

this.dispatchEvent(

new ShowToastEvent({

title: 'Error creating record',

message:'Here is the error:' + error.body + ' reduce: ' + reduceErrors(error).join(', ') + 'status:' + error.status + ' ;status text' + error.statustext,

variant: 'error'

}

)

);

});

}

}

 
7 件の回答
0/9000

Hi all,

In Production, when  trying uploading a file to any record of any object, I get this error : 

Error: Your organization has exceeded the request limit for the service you are trying to access.

Storage checked, Limits for size, and type of att checked.

 
2 件の回答
0/9000
Hello Folks,

In one of my sandbox when I try uploading a file to any record of any object, I get below error

Error: Your organization has exceeded the request limit for the service you are trying to access.

Error: Your organization has exceeded the request limit for the service you are trying to access.

When I check the storage of the sandbox I see there is space available.

User-added image
4 件の回答
0/9000
Hello Everyone,

I am using an lwc component on which users will upload a file and they can also preview that. For a preview, I am using navigationMixin and navigate the record to standard_namedPage which working fine for internal use but the same method is not working in the community. I am not able to preview the file using that. Today I did some research and get to know standard_namedPage not supported community and for that, I need to use standard_webPage which redirects me to the new tab and I can see my file there but the issue is on that new tab I can see my file as a thumbnail, not the actual file. Can someone guide me on how can I preview files in the community as the original file?

Below is the code that I am using for both internal and external.

 

Internal:

this[NavigationMixin.Navigate]({

type: 'standard__namedPage',

attributes: {

pageName: 'filePreview'

},

state : {

// assigning ContentDocumentId to show the preview of file

selectedRecordId:event.currentTarget.dataset.id

}

})

External:

//Getting content version id to assign the url.

contentVersionId = response;

var baseURL = 'https://'+location.host+'/';

var previewURL = baseURL + 'sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+contentVersionId;

this[NavigationMixin.Navigate]({

type: 'standard__webPage',

attributes: {

url: previewURL

}

}, false );

Thanks,

Arpit Jain
8 件の回答
  1. 2021年5月11日 3:04

    @SumitKumar10

    For LWC I didn't get any solution but for Aura component you can show preview on community.

    For You can refer below code:

    Component Code:

    <aura:iteration items="{!v.SignedGADPackage}" var="item" indexVar="index">

    <tr>

    <td width="25%">

    {!item.docName}

    </td>

    <td width="25%">

    <lightning:formattedDateTime value="{!item.generatedDocTime}" year="numeric"

    month="numeric" day="numeric" hour="2-digit" minute="2-digit"

    hour12="true" />

    </td>

    <td width="25%">

    {!item.generatedBy}

    </td>

    <td width="25%">

    <a href="" id="{!item.conDocId}" onclick="{!c.previewFile}">View&nbsp;

    <lightning:icon size="x-small" iconName="action:preview" alternativeText="Preview"

    title="Preview" />

    </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <a href="javascript:void(0)" id="{!item.conDocId}"

    onclick="{!c.downloadFiles}">Download&nbsp;

    <lightning:icon size="x-small" iconName="action:download" alternativeText="Download"

    title="Download" />

    </a>

    </td>

    </tr>

    </aura:iteration>

    JS Code:

    previewFile: function (component, event, helper) {

    var rec_id = event.currentTarget.id;

    $A.get('e.lightning:openFiles').fire({

    recordIds: [rec_id]

    });

    },

    downloadFiles : function (component, event, helper)

    {

    var documentId = event.currentTarget.id;

    var urlString = window.location.href;

    var baseURL = urlString.substring(0, urlString.indexOf("/s"));

    var urlEvent = $A.get("e.force:navigateToURL");

    urlEvent.setParams({

    "url": baseURL + '/sfc/servlet.shepherd/document/download/' + documentId + '?operationContext=S1'

    });

    urlEvent.fire();

    },

    Please markit as best answer if this helps you.

    Thanks,

    Arpit
0/9000
Hi, please post me if any one have knowledge on how to merge multiple PDF to one PDF in salesforce. I have gone through the below article but we need J2EE application, i want to setup this with complete Apex with API
3 件の回答
0/9000
I'm trying to insert new records via data loader but I keep getting an error message saying 'Index 100 out of bounds for length 100' and the upload stops part way through, after some records have successfully uploaded.  Does anyone know what this error means? 

 
4 件の回答
  1. 9月25日 8:26

    I’d first split the CSV into smaller batches and see if it always dies around the same record. That usually makes it easier to tell if it’s the file/data or Data Loader itself. I’ve also used Skyvia for Salesforce imports when Data Loader was giving me trouble, mostly because I could see the failed records and errors without restarting the whole thing.

0/9000
Dear Community,

I am new to Lightning experience,i have some knowledge about lightning.i tried to generate the pdf for Account or any standard or custom object.i wrote the some logic the pfd is generated with empty sheet,i want all the fields of the perticular object which is i mentioned.i think i missed some logic in my components/controllers.

can any one suggest where i did mistake and also can tell me how to generate the pdf for perticular object either custom or standard

my code is 

Apex class:

public class DataDisplayController {

    public String PDFData{get;set;}

    

    public DataDisplayController(){

        

        PDFData = '';

    }

    public PageReference downloadPDF(){

        System.PageReference pageRef = new System.PageReference('/apex/PDFGenerator');

        //ensure pdf downloads and is assigned with defined name

        pageRef.getHeaders().put('content-disposition', 'attachment; filename=TestPDF.pdf');

        

        return pageRef;

    }

    }

Component:

<aura:component >

    <aura:attribute name = "sendData" type = "Account"/>

    <lightning:button label = "Download Document" onclick = "{!c.downloadDocument}" />

    

</aura:component>

client-side controller.js

({

 downloadDocument : function(component, event, helper){

  var sendDataProc = component.get("v.sendData");

  var dataToSend = {

     "label" : "This is test"

  }; //this is data you want to send for PDF generation

  //invoke vf page js method

  sendDataProc(dataToSend, function(){

              

  });

 }

})

Helper.js

({

    helperMethod : function(component,callbackMethod) {

        var action = component.get("c.download");

        action.setCallback(this,function(response){

            var state = response.getState();

            if(state === "SUCCESS"){

                var generatePdf = reponse.getReturnValue();

                component.set("v.sendData",generatePdf);

                console.log('pdf generated successfully');

                

            }

            else{

                console.log('unable to generate the pdf');

            }

        });

        $A.enqueueAction(action);

        

    }

})

VF Page:

<apex:page controller="DataDisplayController" showHeader="false">

    <apex:includeLightning />

    

    <apex:form>

        <apex:inputHidden id="hidData" value="{!PDFData}"/>

        <apex:actionFunction name="jsGeneratePDF" action="{!downloadPDF}"/>

        <div id = "lightning" />

        

        <script>

            function saveData(data, callback){

            var hidData = document.getElementById('{!$Component.hidData}');

            hidData.value = JSON.stringify(data);

            

            //invoke PDF Generation

            jsGeneratePDF();

         

            //invoke callback;

            if(typeof callback == 'function') callback();

        }

        

        

        function loadComponents(){

            console.log("Loading lightning component: DataProcessor");

            

            $Lightning.use("c:LightningPDFGeneratorDemoApp", function() {

                $Lightning.createComponent("c:DataProcessor",

                { 

                    sendData : saveData

                },

                "lightning",

                function(cmp) {

                    // do some stuff

                });

            });

        }

        

        loadComponents();

        </script>            

           </apex:form>

</apex:page>

<apex:page controller="DataDisplayController"  renderAs="pdf">

    {!PDFData}

</apex:page>

App:

<aura:application extends = "ltng:outApp" >

    <c:DataProcessor />

    

</aura:application>

thanks in advance
8 件の回答
0/9000
i have lines of code in java which splits the pdf attachement ,. how to use this in salesforce,. 

below is the set of java code.

import org.apache.pdfbox.multipdf.Splitter;

import org.apache.pdfbox.pdmodel.PDDocument;

import java.io.File;

import java.io.IOException;

import java.util.List;

import java.util.Iterator;

public class SplitPages {

public static void main(String[] args) throws IOException {

//Loading an existing PDF document

File file = new File("C:/PdfBox_Examples/sample.pdf");

PDDocument document = PDDocument.load(file);

//Instantiating Splitter class

Splitter splitter = new Splitter();

//splitting the pages of a PDF document

List<PDDocument> Pages = splitter.split(document);

//Creating an iterator

Iterator<PDDocument> iterator = Pages.listIterator();

//Saving each page as an individual document

int i = 1;

while(iterator.hasNext()) {

PDDocument pd = iterator.next();

pd.save("C:/PdfBox_Examples/sample"+ i++ +".pdf");

}

System.out.println("Multiple PDF’s created");

document.close();

}

}

3 件の回答
0/9000
<lightning:buttonMenu alternativeText="Toggle menu" iconSize="x-Small" onselect="{!c.handleMenuSelect}">
2 件の回答
  1. 8月25日 14:10

    In my case I used empty attributes for active and inactive toggle as these were unwanted. It reduced the height

    <lightning-input

       type="toggle"

       label="All"

       message-toggle-active=""

       message-toggle-inactive="">

     </lightning-input> 

0/9000