• Mukesh Kumar 470
  • NEWBIE
  • 25 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies
@istest
public class FileUpload_ctrlTest {
   @isTest
    public static void Unittest()  { 
        Account Acc = new Account ();
        Acc.Name = 'Test Account';
        //Fill All Required fields
        insert Acc;
       system.debug('account name'+Acc.name);
       Id parentId = Acc.Id; 
       String fileName = 'TestFile';
       String base64Data = EncodingUtil.urlDecode('Test base64Data For testing', 'UTF-8');
       String contentType = 'jpg'; 
       String fileDescription = 'Testing File';
       FileUpload_ctrl.saveFile(parentId,fileName,base64Data,contentType,fileDescription );
   
  }
public without sharing class FileUpload_ctrl {

    @AuraEnabled
    public static Id saveFile(Id parentId, String fileName, String base64Data, String contentType, String fileDescription )  { 
        
        ContentVersion contentToInsert = new ContentVersion(); 
        contentToInsert.Title = fileDescription + ' - ' + fileName; 
        contentToInsert.VersionData = EncodingUtil.base64Decode(EncodingUtil.urlDecode(base64Data, 'UTF-8'));
        contentToInsert.PathOnClient = '/' + fileName ;
        contentToInsert.Description = fileDescription;
        contentToInsert.IsMajorVersion = false;
        insert contentToInsert; 
        
        contentToInsert = [select id, ContentDocumentId from ContentVersion WHERE Id =: contentToInsert.Id];
        ContentDocumentLink cl = new ContentDocumentLink();
        cl.ContentDocumentId = contentToInsert.ContentDocumentId;
        cl.LinkedEntityId = parentId; 
        cl.ShareType = 'V';
        cl.Visibility = 'AllUsers';
        insert cl;
        
        return contentToInsert.id;
    }
}
 
###########################################
public with sharing class HTMLEmailStatusController {
    @TestVisible
    private static Boolean doNotApplyRecordId = false;
    
    @AuraEnabled(cacheable=true)
    public static List<Map<String, Object>> getEmailStatuses(String objectName, String recordId){
        
        // Get list of all the EmailStatus records 
        // associated with the passed recordId
        
        System.debug( ' Querying ' + objectName + ' with id = ' + recordId );
        
        // Build SOQL query
        String query = 'SELECT';
                query += ' ( SELECT';
                query += ' Id,'; 
                query += ' TaskId,'; 
                query += ' Task.Subject,'; 
                query += ' CreatedDate,'; 
                query += ' FirstOpenDate,'; 
                query += ' LastOpenDate,'; 
                query += ' TimesOpened,'; 
                query += ' EmailTemplateName'; 
                query += ' FROM'; 
                query += ' EmailStatuses'; 
                query += ' ) ';
                
            query += ' FROM';
            query +=  ' ' + objectName;
            
            if( !doNotApplyRecordId )  // Added to bypass the test because of platform limitations
                query += ' WHERE Id = \'' + recordId + '\'';
        
        System.debug( ' Constructed Query ' + query );
        
        List<Map<String, Object>> emailStatuses = new List<Map<String, Object>>();
        
        // Query records
        for( sObject s : Database.query( query ) ) {
            
            if( s.getSObjects( 'EmailStatuses' ) != null ) {
            
                for( EmailStatus es : (List<EmailStatus>) s.getSObjects( 'EmailStatuses' ) ) {
                     
                    emailStatuses.add( new Map<String, Object> {
                        'Id' => es.Id,
                        'TaskId' => es.Task.Id,
                        'Subject' => es.Task.Subject,
                        'CreatedDate' => es.CreatedDate,
                        'CreatedDateTimestamp' => es.CreatedDate != null ? es.CreatedDate.getTime() : null,
                        'FirstOpenDate' => es.FirstOpenDate,
                        'FirstOpenDateTimestamp' => es.FirstOpenDate != null ? es.FirstOpenDate.getTime() : null,
                        'LastOpenDate' => es.LastOpenDate,
                        'LastOpenDateTimestamp' => es.LastOpenDate != null ? es.LastOpenDate.getTime() : null,
                        'TimesOpened' => es.TimesOpened
                    });
                    
                }
            }
        }
        
        return emailStatuses;
        
    }
    
}
public with sharing class HTMLEmailStatusController {
    @TestVisible
    private static Boolean doNotApplyRecordId = false;
    
    @AuraEnabled(cacheable=true)
    public static List<Map<String, Object>> getEmailStatuses(String objectName, String recordId){
        
        // Get list of all the EmailStatus records 
        // associated with the passed recordId
        
        System.debug( ' Querying ' + objectName + ' with id = ' + recordId );
        
        // Build SOQL query
        String query = 'SELECT';
                query += ' ( SELECT';
                query += ' Id,'; 
                query += ' TaskId,'; 
                query += ' Task.Subject,'; 
                query += ' CreatedDate,'; 
                query += ' FirstOpenDate,'; 
                query += ' LastOpenDate,'; 
                query += ' TimesOpened,'; 
                query += ' EmailTemplateName'; 
                query += ' FROM'; 
                query += ' EmailStatuses'; 
                query += ' ) ';
                
            query += ' FROM';
            query +=  ' ' + objectName;
            
            if( !doNotApplyRecordId )  // Added to bypass the test because of platform limitations
                query += ' WHERE Id = \'' + recordId + '\'';
        
        System.debug( ' Constructed Query ' + query );
        
        List<Map<String, Object>> emailStatuses = new List<Map<String, Object>>();
        
        // Query records
        for( sObject s : Database.query( query ) ) {
            
            if( s.getSObjects( 'EmailStatuses' ) != null ) {
            
                for( EmailStatus es : (List<EmailStatus>) s.getSObjects( 'EmailStatuses' ) ) {
                     
                    emailStatuses.add( new Map<String, Object> {
                        'Id' => es.Id,
                        'TaskId' => es.Task.Id,
                        'Subject' => es.Task.Subject,
                        'CreatedDate' => es.CreatedDate,
                        'CreatedDateTimestamp' => es.CreatedDate != null ? es.CreatedDate.getTime() : null,
                        'FirstOpenDate' => es.FirstOpenDate,
                        'FirstOpenDateTimestamp' => es.FirstOpenDate != null ? es.FirstOpenDate.getTime() : null,
                        'LastOpenDate' => es.LastOpenDate,
                        'LastOpenDateTimestamp' => es.LastOpenDate != null ? es.LastOpenDate.getTime() : null,
                        'TimesOpened' => es.TimesOpened
                    });
                    
                }
            }
        }
        
        return emailStatuses;
        
    }
    
}
how can i implement this code into LWC.
please help me




####HTMLEmailStatus.cmp#############

<aura:component controller="HTMLEmailStatusController" implements="flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName" access="global" >
<aura:attribute name="recordId"
type="String"
description="The ID of the record which is parent of EmailStatus records. Provided by force:hasRecordId interface."/>
<aura:attribute name="componentCardTitle"
type="String"
default="HTML Email Status"
access="global"
description="Title of the lightning:card component wrapping content."/>
<aura:attribute name="sObjectName"
type="String"
default="Contact"
access="global"
description="sObject Name which is the type of record and either can be Lead or Contact. Provided by force:force:hasSObjectName interface."/>
<aura:attribute name="fetchedEmailStatuses"
type="EmailStatus[]"
description="Array of email status objects. These are the records displayed in the component."/>
<!-- Events -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!-- Component Markup -->
<lightning:spinner aura:id="init-spinner" variant="brand" class="slds-hide"/>
<lightning:spinner aura:id="spinner" variant="brand" class="slds-hide"/>
<lightning:card iconName="{!( empty(v.componentCardTitle) ? '' : 'standard:email' )}" title="{!v.componentCardTitle + ' (' + v.fetchedEmailStatuses.length + ')'}">
<div>
<table class="slds-table slds-table_bordered slds-max-medium-table_stacked-horizontal">
<thead>
<tr class="slds-text-title_caps">
<th scope="col" class="slds-cell-wrap">
<div title="Subject">Subject</div>
</th>
<th scope="col" class="slds-cell-wrap">
<div title="Date Sent">Date Sent</div>
</th>
<th scope="col" class="slds-cell-wrap">
<div title="Date Opened">Date Opened</div>
</th>
<th scope="col" class="slds-cell-wrap">
<div title="Times Opened"># Times Opened</div>
</th>
<th scope="col" class="slds-cell-wrap">
<div title="Last Opened">Last Opened</div>
</th>
<th scope="col" class="slds-cell-wrap">
<div title="Actions"> &nbsp; </div>
</th>
</tr>
</thead>
<tbody>
<aura:if isTrue="{! empty( v.fetchedEmailStatuses ) }">
<tr>
<th colspan="5">
<div class="slds-text-align_center">No items to display.</div>
</th>
</tr>
</aura:if>
<aura:iteration var="emailStatus" items="{!v.fetchedEmailStatuses}">
<tr>
<td data-label="Subject" class="slds-cell-wrap">
<div title="{!emailStatus.Subject}">
<a href="javascript:void(0);"
data-taskId="{!emailStatus.TaskId}"
onclick="{!c.handleLinkClick}">
{!emailStatus.Subject}
</a>
</div>
</td>
<td data-label="Date Sent" class="slds-cell-wrap">
<div title="{!emailStatus.CreatedDateTimestamp}">
<lightning:formattedDateTime value="{!emailStatus.CreatedDateTimestamp}" year="numeric" month="numeric" day="numeric" hour="numeric" minute="numeric"/>
</div>
</td>
<td data-label="Date Opened" class="slds-cell-wrap">
<div title="{!emailStatus.FirstOpenDateTimestamp}">
<lightning:formattedDateTime value="{!emailStatus.FirstOpenDateTimestamp}" year="numeric" month="numeric" day="numeric" hour="numeric" minute="numeric"/>
</div>
</td>
<td data-label="Times Opened" class="slds-cell-wrap">
<div title="{!emailStatus.TimesOpened}" class="slds-text-align_center">
{!emailStatus.TimesOpened}
</div>
</td>
<td data-label="Last Opened" class="slds-cell-wrap">
<div title="{!emailStatus.LastOpenDateTimestamp}">
<lightning:formattedDateTime value="{!emailStatus.LastOpenDateTimestamp}" year="numeric" month="numeric" day="numeric" hour="numeric" minute="numeric"/>
</div>
</td>
<td data-label="Actions" class="slds-cell-wrap">
<lightning:buttonMenu alternativeText="Actions" onselect="{! c.handleMenuSelect }">
<lightning:menuItem label="Edit" value="{!'edit:' + emailStatus.TaskId}"/>
<lightning:menuItem label="Delete" value="{!'delete:' + emailStatus.TaskId}"/>
</lightning:buttonMenu>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
</div>
</lightning:card>
</aura:component>

#########HTMLEmailStatusController.js#########
({
doInit : function(component, event, helper) {
var objectName = component.get( 'v.sObjectName' );
var recordId = component.get( 'v.recordId' );
helper.getEmailStatusesAsync( component, objectName, recordId )
.then( $A.getCallback( function( emailStatuses ) {
component.set( 'v.fetchedEmailStatuses', emailStatuses );
})).catch( $A.getCallback( function( err ) {
console.log(err);
var toastEvent = $A.get( 'e.force:showToast' );
toastEvent.setParams({
'title' : 'Problem occured while initializing component',
'message' : err,
'type' : 'error',
'mode': 'sticky'
}).fire();
}));
},
handleLinkClick : function( component, event, helper ) {
var clickedTaskId = event.target.getAttribute( 'data-taskId' );
helper.navigateToRecord( clickedTaskId );
},
handleMenuSelect : function( component, event, helper ) {
var selectedMenuItemValue = event.getParam( 'value' );
if(selectedMenuItemValue.startsWith( 'edit' )) {
var recordId = selectedMenuItemValue.split( ':' )[1];
var editRecordEvent = $A.get("e.force:editRecord");
editRecordEvent.setParams({
"recordId": recordId
});
editRecordEvent.fire();
}
}
})

######HTMLEmailStatus.cmp-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>40.0</apiVersion>
<description>A Lightning Component Bundle</description>
</AuraDefinitionBundle>


########HTMLEmailStatus.design

<design:component label="HTML Email Status">
<design:attribute name="componentCardTitle"
label="Title"
default="HTML Email Status"
description="Title of the component on the page."/>
</design:component>

###########HTMLEmailStatusHelper.js###########


({
getEmailStatusesAsync : function( component, objectName, recordId ) {
var helper = this;
return helper.enqueueAction( component, 'c.getEmailStatuses', {
'objectName' : objectName,
'recordId' : recordId
}).then( $A.getCallback( function( emailStatuses ) {
return emailStatuses;
}));
},
enqueueAction : function( component, actionName, params, options ) {
var helper = this;
var p = new Promise( function( resolve, reject ) {
helper.showSpinner( component );
var action = component.get( actionName );
if ( params ) {
action.setParams( params );
}
if ( options ) {
if ( options.background ) { action.setBackground(); }
if ( options.storable ) { action.setStorable(); }
}
action.setCallback( helper, function( response ) {
helper.hideSpinner( component );
if ( component.isValid() && response.getState() === 'SUCCESS' ) {
resolve( response.getReturnValue() );
} else {
console.error( 'Error calling action "' + actionName + '" with state: ' + response.getState() );
helper.logActionErrors( response.getError() );
reject( response.getError() );
}
});
$A.enqueueAction( action );
});
return p;
},
showSpinner : function( component ) {
$A.util.removeClass( component.find( 'spinner' ), 'slds-hide' );
},
hideSpinner : function( component ) {
$A.util.addClass( component.find( 'spinner' ), 'slds-hide' );
},
navigateToRecord : function( recordId ) {
console.log( 'Navigating to the record>> ' + recordId );
var event = $A.get( 'e.force:navigateToSObject' );
if ( event ) {
event.setParams({
'recordId' : recordId
}).fire();
} else if ( ( typeof sforce !== 'undefined' ) && ( typeof sforce.one !== 'undefined' ) ) {
sforce.one.navigateToSObject( recordId );
} else {
window.location.href = '/' + recordId;
}
},
logActionErrors : function( errors ) {
if ( errors ) {
if ( errors.length > 0 ) {
for ( var i = 0; i < errors.length; i++ ) {
console.error( 'Error: ' + errors[i].message );
}
} else {
console.error( 'Error: ' + errors );
}
} else {
console.error( 'Unknown error' );
}
}
})




#############HTMLEmailStatusController.cls################

public with sharing class HTMLEmailStatusController {
/**
* Queries EmailStatuses in the sub-query
* on the given object name where the Id equals passed recordId.
*
* Example:
* Calling getEmailStatuses( 'Contact', '0039000001om22A' )
* returns EmailStatuses associated with the passed recordId.
*/
@TestVisible
private static Boolean doNotApplyRecordId = false;
@AuraEnabled
public static List<Map<String, Object>> getEmailStatuses(String objectName, String recordId){
// Get list of all the EmailStatus records
// associated with the passed recordId
System.debug( ' Querying ' + objectName + ' with id = ' + recordId );
// Build SOQL query
String query = 'SELECT';
query += ' ( SELECT';
query += ' Id,';
query += ' TaskId,';
query += ' Task.Subject,';
query += ' CreatedDate,';
query += ' FirstOpenDate,';
query += ' LastOpenDate,';
query += ' TimesOpened,';
query += ' EmailTemplateName';
query += ' FROM';
query += ' EmailStatuses';
query += ' ) ';
query += ' FROM';
query += ' ' + objectName;
if( !doNotApplyRecordId ) // Added to bypass the test because of platform limitations
query += ' WHERE Id = \'' + recordId + '\'';
System.debug( ' Constructed Query ' + query );
List<Map<String, Object>> emailStatuses = new List<Map<String, Object>>();
// Query records
for( sObject s : Database.query( query ) ) {
if( s.getSObjects( 'EmailStatuses' ) != null ) {
for( EmailStatus es : (List<EmailStatus>) s.getSObjects( 'EmailStatuses' ) ) {
emailStatuses.add( new Map<String, Object> {
'Id' => es.Id,
'TaskId' => es.Task.Id,
'Subject' => es.Task.Subject,
'CreatedDate' => es.CreatedDate,
'CreatedDateTimestamp' => es.CreatedDate != null ? es.CreatedDate.getTime() : null,
'FirstOpenDate' => es.FirstOpenDate,
'FirstOpenDateTimestamp' => es.FirstOpenDate != null ? es.FirstOpenDate.getTime() : null,
'LastOpenDate' => es.LastOpenDate,
'LastOpenDateTimestamp' => es.LastOpenDate != null ? es.LastOpenDate.getTime() : null,
'TimesOpened' => es.TimesOpened
});
}
}
}
return emailStatuses;
}
}
Create a LWC component to show EmailStatus.
There is an object named as email status show that in LWC.

please help me
@istest
public class FileUpload_ctrlTest {
   @isTest
    public static void Unittest()  { 
        Account Acc = new Account ();
        Acc.Name = 'Test Account';
        //Fill All Required fields
        insert Acc;
       system.debug('account name'+Acc.name);
       Id parentId = Acc.Id; 
       String fileName = 'TestFile';
       String base64Data = EncodingUtil.urlDecode('Test base64Data For testing', 'UTF-8');
       String contentType = 'jpg'; 
       String fileDescription = 'Testing File';
       FileUpload_ctrl.saveFile(parentId,fileName,base64Data,contentType,fileDescription );
   
  }
public without sharing class FileUpload_ctrl {

    @AuraEnabled
    public static Id saveFile(Id parentId, String fileName, String base64Data, String contentType, String fileDescription )  { 
        
        ContentVersion contentToInsert = new ContentVersion(); 
        contentToInsert.Title = fileDescription + ' - ' + fileName; 
        contentToInsert.VersionData = EncodingUtil.base64Decode(EncodingUtil.urlDecode(base64Data, 'UTF-8'));
        contentToInsert.PathOnClient = '/' + fileName ;
        contentToInsert.Description = fileDescription;
        contentToInsert.IsMajorVersion = false;
        insert contentToInsert; 
        
        contentToInsert = [select id, ContentDocumentId from ContentVersion WHERE Id =: contentToInsert.Id];
        ContentDocumentLink cl = new ContentDocumentLink();
        cl.ContentDocumentId = contentToInsert.ContentDocumentId;
        cl.LinkedEntityId = parentId; 
        cl.ShareType = 'V';
        cl.Visibility = 'AllUsers';
        insert cl;
        
        return contentToInsert.id;
    }
}
 
public with sharing class HTMLEmailStatusController {
    @TestVisible
    private static Boolean doNotApplyRecordId = false;
    
    @AuraEnabled(cacheable=true)
    public static List<Map<String, Object>> getEmailStatuses(String objectName, String recordId){
        
        // Get list of all the EmailStatus records 
        // associated with the passed recordId
        
        System.debug( ' Querying ' + objectName + ' with id = ' + recordId );
        
        // Build SOQL query
        String query = 'SELECT';
                query += ' ( SELECT';
                query += ' Id,'; 
                query += ' TaskId,'; 
                query += ' Task.Subject,'; 
                query += ' CreatedDate,'; 
                query += ' FirstOpenDate,'; 
                query += ' LastOpenDate,'; 
                query += ' TimesOpened,'; 
                query += ' EmailTemplateName'; 
                query += ' FROM'; 
                query += ' EmailStatuses'; 
                query += ' ) ';
                
            query += ' FROM';
            query +=  ' ' + objectName;
            
            if( !doNotApplyRecordId )  // Added to bypass the test because of platform limitations
                query += ' WHERE Id = \'' + recordId + '\'';
        
        System.debug( ' Constructed Query ' + query );
        
        List<Map<String, Object>> emailStatuses = new List<Map<String, Object>>();
        
        // Query records
        for( sObject s : Database.query( query ) ) {
            
            if( s.getSObjects( 'EmailStatuses' ) != null ) {
            
                for( EmailStatus es : (List<EmailStatus>) s.getSObjects( 'EmailStatuses' ) ) {
                     
                    emailStatuses.add( new Map<String, Object> {
                        'Id' => es.Id,
                        'TaskId' => es.Task.Id,
                        'Subject' => es.Task.Subject,
                        'CreatedDate' => es.CreatedDate,
                        'CreatedDateTimestamp' => es.CreatedDate != null ? es.CreatedDate.getTime() : null,
                        'FirstOpenDate' => es.FirstOpenDate,
                        'FirstOpenDateTimestamp' => es.FirstOpenDate != null ? es.FirstOpenDate.getTime() : null,
                        'LastOpenDate' => es.LastOpenDate,
                        'LastOpenDateTimestamp' => es.LastOpenDate != null ? es.LastOpenDate.getTime() : null,
                        'TimesOpened' => es.TimesOpened
                    });
                    
                }
            }
        }
        
        return emailStatuses;
        
    }
    
}
Hi everyone ,using aura component how to display the modal popup on the contact record whose name starts with test.

Thanks in advance
  • August 28, 2021
  • Like
  • 0
Hi please take it as a priority because I am new in vf page learning and the client has required a pdf of the render vf page.

 
I hope u understand my question. Please help as I am very very new to Lightning web component. Is there any way to insert both these using uiRecordApi ???? if yes plz explain how.
I need to show a slider with output value below it like in this img  User-added image 
but when I use lightning-slider it's default output value is coming like this   User-added image
Can anyone pls tell me Is there anyway to hide the min, max and output value or to display the output value only below the slider I can't use input type= range cause need to display the slider just like lightning-slider here is my code. It is in lwc
<div class="slds-box sliders">
  <h1>TIME TO AIRPORT</h1>
  <lightning-slider min="10" max="190" data-id="time" onchange={time}>
  </lightning-slider>
</div>

.sliders {
  background-color: #f4f4f4;
}

 
Hi folks,
I have created a lightning record edit form in LWC. The form should open on pop up. After modal opens the background is visible. It should not visible. Any suggestions. Please refer my html and js code. If any CSS should to be create, please let me know.
User-added image------html----------
<template>
    <div class="slds-m-bottom_large">
        <div class="slds-grid slds-gutters">
            <div class="slds-col slds-size_4-of-5" style='font-weight: 500;font-size: 18px'>
                <span>RMA Case Line Item History</span>
            </div>
            <div class="slds-clearfix">
                <lightning-button label="New" variant="Neutral" onclick={newRmaForm} class="slds-float_right"></lightning-button>
            </div>
        </div>
    </div>
    <div class="landingpagebody">      
        <lightning-card title="">          
        <div class="slds-m-top_large">           
            <lightning-datatable key-field="id" data={rmarecord} columns={columns}></lightning-datatable>            
        </div>
    </lightning-card>
   
    <div if:true={showModal}>
        <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_small"
            aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
            <div class="slds-modal__container">
                <header class="slds-modal__header">
                    <lightning-icon style="cursor: pointer;" class="slds-float_right" icon-name="utility:close" size="small" onclick={handleClose} ></lightning-icon>
                    <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">Create Case Line Item</h2>
                </header>
                <div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
    <lightning-record-edit-form object-api-name="R4C_Case_Line_Item__c" columns = "2" layout-type = "compact">
        <lightning-messages></lightning-messages>
    <lightning-input-field field-name="Name"></lightning-input-field>
    <lightning-input-field field-name="Case__c"></lightning-input-field>
        <lightning-input-field field-name="EPM_Name__c"></lightning-input-field>
            <lightning-input-field field-name="MMID_BU_Hierarchy__c"></lightning-input-field>
                <lightning-input-field field-name="Remedy__c"></lightning-input-field>
                    <lightning-input-field field-name="Return_Reason__c"></lightning-input-field>
                    <lightning-input-field field-name="Return_Type__c"></lightning-input-field>
                    <lightning-input-field field-name="Stocking__c"></lightning-input-field>
            
            
        <lightning-button type="submit"
                          name="submit"
                          label="Create Case Line Item">
            </lightning-button>
    </lightning-record-edit-form>
    </div>
                <footer class="slds-modal__footer">
                    <button class="slds-button slds-button_neutral" onclick={handleCancel}>Cancel</button>
                    <button class="slds-button slds-button_brand" onclick={handleSave}>Save</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </div>
    </div>
</template>
-------------------------js-------------------------
import { LightningElement, wire, track, api} from 'lwc';
import { getRecord, getFieldValue } from "lightning/uiRecordApi";
import { loadStyle } from 'lightning/platformResourceLoader';
// import CUSTOMCSS from '@salesforce/resourceUrl/recordForm'; //this is my static resource file name
import CONTACT_ID from "@salesforce/schema/User.ContactId";
import USER_ID from "@salesforce/user/Id";
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
/* import NAME from '@salesforce/schema/R4C_Case_Line_Item__c.Name';
import Case from '@salesforce/schema/R4C_Case_Line_Item__c.Case__c';
import EPM_Name from '@salesforce/schema/R4C_Case_Line_Item__c.EPM_Name__c';
import MMID_BU_Hierarchy from '@salesforce/schema/R4C_Case_Line_Item__c.MMID_BU_Hierarchy__c';
import Remedy from '@salesforce/schema/R4C_Case_Line_Item__c.Remedy__c';
import Return_Reason from '@salesforce/schema/R4C_Case_Line_Item__c.Return_Reason__c';
import Return_Type from '@salesforce/schema/R4C_Case_Line_Item__c.Return_Type__c';
import Stocking from '@salesforce/schema/R4C_Case_Line_Item__c.Stocking__c'; */

export default class RmaCaseLineItem extends LightningElement {
    isCssLoaded = false;
    @api recordId;
    objectApiName = 'R4C_Case_Line_Item__c';
    showModal = false;
    @track rmarecord = false;
    @track conid;
  
 /* renderedCallback(){
        if(this.isCssLoaded) return
        this.isCssLoaded = true;
        loadStyle(this,CUSTOMCSS).then(()=>{
            console.log('loaded');
        })
        .catch(error=>{
            console.log('error to load');
        });
    } */
  
    newRmaForm(event){
    this.showModal = true;
   // fields = [NAME, Case, EPM_Name, MMID_BU_Hierarchy, Remedy, Return_Reason, Return_Type, Stocking];
}
 handleClick(){
        this.showModal = true;
    }
    handleClose(){
        this.showModal = false;
    }
handleSave(){
        this.template.querySelector('lightning-record-edit-form').submit();
        this.showModal = false;
        const evt = new ShowToastEvent({
            title: "Success!",
            message: "Case Line Item Created",
            variant: "success",
        });
        this.dispatchEvent(evt);
    }
    handleCancel(){
        this.showModal = false;
    }
    handleSubmit(event){
        event.preventDefault();       // stop the form from submitting
        const fields = event.detail.fields;
        fields.LastName = 'My Custom Last Name'; // modify a field
        this.template.querySelector('lightning-record-form').submit(fields);
     }
    @track columns = [
        {label:'R4C configuration name', fieldName:'R4C configuration name', type:'string'},
        {label:'Case', fieldName:'Case__c', type:'text'},
        {label:'EPM Name', fieldName: 'EPM_Name__c', type:'text'},
        {label:'Remedy', fieldName: 'Remedy__c',type:'data'},
        {label:'Return Reason', fieldName: 'Return_Reason__c',type:'data'},
        {label:'Return Type', fieldName:'Return_Type__c',type:'data'},
        {label:'Stocking', fieldName:'Stocking__c', type:'data'},
        {label:'MMID', fieldName:'MMID_BU_Hierarchy__c', type:'text'}
    ]
  @wire (getRecord, {recordId : USER_ID, fields: [CONTACT_ID]})
user;
get contactId() {
        this.conid = getFieldValue(this.user.data, CONTACT_ID);
        return getFieldValue(this.user.data, CONTACT_ID);
    } 
}