7

From official documentation Supported Objects This component doesn't support all Salesforce standard objects. For example, the Event and Task objects are not supported. For a list of supported objects, see the User Interface API Developer Guide. and reading Supported Objects article: User Interface API supports all custom objects and ...


7

After an extensive discussion with Salesforce support: recordForm may not work with your use case, and the better approach here would be to use recordEditForm. This is only after discussing this with my team in our internal forum. You had a concern that why it doesn't work with recordForm- to which I have mentioned that it will not work with ...


6

try to add oncancel event in your component. <lightning:recordForm objectApiName="Custom_Object__c" recordTypeId="{!v.Applicant.recordTypeId}" layoutType="Compact" columns="2" mode = "edit" onload="{!c.handleLoad}" ...


5

You need to add "oncancel" as an attribute: <lightning:recordForm recordId="{!v.recordId}" objectApiName="Opportunity" layoutType="Full" columns="2" mode="edit" onsubmit="{!c.handleSubmit}" oncancel="{!c.handleCancel}"/> For some reason it is not in their documentation which can be found here but it works for me! Hopefully this solves ...


5

Your option 2, using lightning:recordForm, is the solution. You just need to update your submit handler code. In your cmp: <lightning:recordForm aura:id="form" recordId = "{! v.recordId}" fields = "{!v.fields}" objectApiName="Account" layoutType="Full" columns = "2" mode = "Edit" onload = "{!c.handleLoad}" ...


4

There are couple of ways to create records with pre-defined values in lightning. Use a lightning quick action (Create Record action type) Main drawback : Doesn't support complex logic or un-related objects to set defaults. For more info about quick actions and pre-defined values Using force:recordCreate event Main drawback: After saving the record, user is ...


4

UPDATE Seems the approach to retrieve the response is incorrectly mentioned in the documentation. Updated the usage based on a quick test. This is from the documentation for lightning:recordForm: For information about Event Return Parameters and examples of event handlers, see the documentation for lightning:recordEditForm. And based on the ...


4

You won't be able to make a field read only specifically while using lightning:recordForm. It's either all fields or none which you could display as read only depending on the mode selected. The component operates based on the field level security, so if a field is not read only for a User, you cannot make one as read only on the component. Additionally ...


3

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:attribute name="contactfield" type="String[]" default="LastName,AccountId"/> <Lightning:Card class="slds-...


3

lightning:recordForm doesn't support the onchange event. If you think about it, it makes sense: you're usually interested in seeing when a field changes, not when the form as a whole changes. All of the lightning:inputX type fields support the onchange event. (lightning:input, lightning:inputAddress, lightning:inputField, ...) I hope this helps make ...


3

aura:if doesn't even create the components contained within unless isTrue is true. As such, you're really only creating one lightning:recordForm at a time as far as performance is concerned. You can expect nominal performance from this design, assuming there's not too many aura:if elements (they're pretty fast, but too many can be a performance concern), but ...


3

I don't have documented proof of this, but I've also explored something similar to this and found these results, hopefully they point you in the right direction: Per documentation, lightning:recordForm, lightning:recordEditForm, and lightning:recordViewForm all wrap force:recordData or some variant, which itself uses LDS. However, it seems at the upper ...


3

You need to use getReference method of Component to tell the button that which methods needs to call. component.getReference("c.handleSuccess") Your code will look like below handleNewRecordAdder : function(component, event, handler) { var sObjectType = event.getParam("data"); var fields = ["Name"]; component.set("v.isActive", true); ...


3

Yes, You can do that. You need to handle onsubmit event in your record form:- handleSubmit(event){ event.preventDefault(); // it will prevent the submit const fields = event.detail.fields; if (window.confirm("Do you really want to save?")) { this.template.querySelector('lightning-record-form').submit(fields); // it will submit the form ...


3

Here is an approach that leverages lightning/uiRecordApi to get all relevant data and does not rely on a lightning-record-edit/view-form. All visible styling provided is custom styling and can be removed/changed. @op: please ignore fieldNames in screenshot, I am aware they were explicitly not requested. XML <?xml version="1.0" encoding="UTF-8" ?> &...


2

This has now been raised as a Known Issue: https://success.salesforce.com/issues_view?id=a1p3A000000FmjRQAS


2

You should be able to do this with an action. However, let me answer your question. Yes, I have done this. I set an aura:id and then used the javascript controller to set the value. of that field. The issue that can happen is timing. Sometimes the onload script is ran before the component is created. I have seen this from time to time. My solution has ...


2

I was able to do this, albeit is extremely hack-y and I'm not sure how long it'll work but here's a quick example. Component: <aura:if isTrue='{!v.booleanVal}'> <lightning:recordForm aura:id='form' objectApiName='Lead' layoutType='Full' mode='edit' onload='{!c.onLoad}'/> </aura:if> Controller: onLoad: function(component, event, ...


2

I STAND CORRECTED! Apparently, we have an undocumented feature that will force the reload of data. Details are here: Forcing a refresh in force:recordData But basically, just pass a parameter (doesn't matter what the name is) to the reloadRecord method of force:recordData like myLDS.reloadRecord(true). Just be aware that this will FORCE a server call (...


2

I had a conversation with Salesforce support about this. Its a known issue but there is no timeline on fixing it Edit @Homerlex I found a workaround if you find the proper record type Id in the init method of your component and save it to an attribute variable called recordTypeId and then update your lighting record form to this, it should remove the error ...


2

Do not use exceptions in your triggers. You should always use addError on the record or a specific field. Your users will have a much more user-friendly experience if you use the appropriate API.


2

Is it possible to include custom buttons on Lightning:RecordForm or any of its variations ? Specifically a "save and new" button. You cannot inject any buttons on lightning:recordForm directly. But you can always create custom buttons on the component that utilizes this component. You will though need a mechanism to interact with the fields on the record ...


2

No. You do not have any control over how record-form renders. lightning-record-form is less customizable. To customize the form layout or provide custom rendering of record data, use lightning-record-edit-form (add or update a record) and lightning-record-view-form (view a record). Other points to note from doc: To specify the field order, use ...


1

You are trying to use edit form, why dont use - record-edit and try passing values @track recordInfo = { fields: [ { name: "AccountId", value: "001000000000000AAA" }, { name: "Description", value: "Description of this record." } ] } get recordInfoDefined () { return this.recordInfo !== undefined && this.recordInfo.fields ...


1

Are you using the Fields / layoutType attributes for displaying the Fields . My suggestion would be to take out Status field from the above fields/Layout and display it using lightning:outputField. You're not submitting it as an editable form field anyways.


1

Okay, so thanks to @sfdcFox I realized that the error handling override in the lightning-record-form is not able to be canceled, so I just used a combination of lightning-record-edit-form and lightning-record-view-form and I just omitted the lightning-messages tag. I used a js variable called "editMode" to conditionally render lightning-input-field vs ...


1

That seems to be the expected behavior for client-side validations using lightning:recordForm. Referring to the Client-Side Validation section in documentation, it mentions the scenario you are experiencing (emphasis mine): Client-Side Validation The lightning:recordForm component performs client-side validation on record fields only if you interact with ...


1

Alright, chalk this up to beta testing mac OS software. Answer The FLS for the lookup had read only checked true. Bug (I believe) The field or another field looking to the same object MUST be on the layout..... Unfortunately the beta of the new mac OS hides the checkboxes so I could not tell it was set to true.... Doh! Thanks sanket for your answer. ...


1

UPDATE: Just realized that the question is about <lightning:recordForm> but the answer below uses <lightning:recordEditForm>, but believe that the idea is the same. ORIGINAL ANSWER: Whenever something needs to be communicated/done across multiple components, the first thing that should come to our mind is events. Here I am assuming that you ...


1

I think I found some useful information here. There's an excellent blog by Peter Knolle that addressed Lightning recordEditForm, but a lot of it seems to be working with recordForm as well. http://peterknolle.com/lightning-record-edit-form/ Basically, he shows you how to use event.preventDefault() during the onsubmit action. In this example he overrides ...


Only top voted, non community-wiki answers of a minimum length are eligible