This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class SObjectHelper { | |
public static Object getRelatedFieldValue(sObject obj, String fieldName) { | |
if(fieldName.contains('.')){ | |
String relation = fieldName.substringBefore('.'); | |
String relatedField = fieldName.substringAfter('.'); | |
return SObjectHelper.getRelatedFieldValue((sObject)obj.getSObject(relation), relatedField); | |
} else { | |
return obj.get(fieldName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, api } from 'lwc'; | |
export default class LightningRecordViewForm extends LightningElement { | |
@api recordId; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-record-view-form record-id={recordId} object-api-name="Position__c"> | |
<div class="slds-grid"> | |
<div class="slds-col slds-size_1-of-2"> | |
<lightning-output-field field-name="Name"></lightning-output-field> | |
<lightning-output-field field-name="Status__c"></lightning-output-field> | |
</div> | |
<div class="slds-col slds-size_1-of-2"> | |
<lightning-output-field field-name="Location__c"></lightning-output-field> | |
<lightning-output-field field-name="Hire_By__c"></lightning-output-field> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, api, wire, track } from 'lwc'; | |
import { getObjectInfo } from 'lightning/uiObjectInfoApi'; | |
import ACCOUNT_OBJECT from '@salesforce/schema/Account'; | |
import ACCOUNT_NAME from '@salesforce/schema/Account.Name'; | |
import INDUSTRY_NAME from '@salesforce/schema/Account.Industry'; | |
import PHONE_VALUE from '@salesforce/schema/Account.Phone'; | |
export default class RecordFormWithRecordTypes extends LightningElement { | |
@api recordId; | |
@api objectApiName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-card title="Account form with Record Type"> | |
<template if:true={objectInfo.data}> | |
<lightning-record-form object-api-name={objectApiName} | |
record-type-id={recordTypeId} | |
fields={fields}> | |
</lightning-record-form> | |
</template> | |
</lightning-card> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, api } from 'lwc'; | |
import { ShowToastEvent } from 'lightning/platformShowToastEvent'; | |
import Name_Field from '@salesforce/schema/Account.Name'; | |
import Revenue_Field from '@salesforce/schema/Account.AnnualRevenue'; | |
import Industry_Field from '@salesforce/schema/Account.Industry'; | |
export default class LightningRecordFormModeCreate extends LightningElement { | |
@api objectApiName; | |
fields = [Name_Field, Revenue_Field, Industry_Field]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-record-form object-api-name={objectApiName} | |
fields={fields} onsuccess={handleSuccess}> | |
</lightning-record-form> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, api } from 'lwc'; | |
import Name_Field from '@salesforce/schema/Account.Name'; | |
import Revenue_Field from '@salesforce/schema/Account.AnnualRevenue'; | |
import Inductry_Field from '@salesforce/schema/Account.Industry'; | |
export default class LightningRecordFormModeEdit extends LightningElement { | |
@api recordId; | |
@api objectApiName; | |
fields = [Name_Field, Revenue_Field, Inductry_Field]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-record-form mode="Edit" | |
record-id={recordId} | |
object-api-name={objectApiName} | |
fields={fields} | |
columns="2"> | |
</lightning-record-form> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, api } from 'lwc'; | |
export default class LightningRecordForm extends LightningElement { | |
@api recordId; | |
} |