File tree 4 files changed +8
-7
lines changed
4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,10 @@ public with sharing class RelatedList {
4
4
return Database.query (soql);
5
5
}
6
6
7
- @AuraEnabled (cacheable = true ) public static Integer countRecords (String objectName ) {
8
- if (String .isNotEmpty (objectName )) {
9
- return database .countQuery (' SELECT count() FROM ' + objectName );
7
+ @AuraEnabled (cacheable = true ) public static Integer countRecords (String countSOQL ) {
8
+ if (String .isNotEmpty (countSOQL )) {
9
+ return database .countQuery (countSOQL );
10
10
}
11
11
return 0 ;
12
- }
12
+ }
13
13
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public with sharing class RelatedList_Test {
17
17
User testUser = [Select id from user where id = :UserInfo .getUserId ()];
18
18
Test .startTest ();
19
19
System .runAs (testUser ){
20
- RelatedList .countRecords (' Contact' );
20
+ RelatedList .countRecords (' Select count() FROM Contact LIMIT 1 ' );
21
21
RelatedList .countRecords (null );
22
22
}
23
23
Test .stopTest ();
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export default class LightningDatatable extends NavigationMixin(
46
46
} ) ;
47
47
this . columns = cols ;
48
48
this . buildSOQL ( ) ;
49
- countRecords ( { objectName : this . objectName } ) . then ( ( result ) => {
49
+ countRecords ( { countSOQL : this . buildCountSOQL ( ) } ) . then ( ( result ) => {
50
50
this . totalRows = result ;
51
51
} ) ;
52
52
this . fetchRecords ( ) ;
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
<LightningComponentBundle xmlns =" http://soap.sforce.com/2006/04/metadata" >
3
- <apiVersion >48 .0</apiVersion >
3
+ <apiVersion >49 .0</apiVersion >
4
4
<isExposed >true</isExposed >
5
5
<targets >
6
6
<target >lightning__RecordPage</target >
14
14
<property name =" columns" type =" String" required =" true" label =" Enter Columns JSON" />
15
15
<property name =" relatedFieldAPI" type =" String" default =" " label =" Enter Related field API Name" />
16
16
<property name =" whereClause" type =" String" default =" " label =" Enter WHERE clause" />
17
+ <property name =" limit" type =" String" default =" 10" label =" Enter number of records to display on screen" />
17
18
</targetConfig >
18
19
</targetConfigs >
19
20
</LightningComponentBundle >
You can’t perform that action at this time.
0 commit comments