Coder Social home page Coder Social logo

pegros / peg_misc Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 5.5 MB

Small package of standalone LWC components for the App Builder, addressing simple Use Cases in a very easy to configure approach.

License: MIT License

Shell 0.02% Apex 26.14% CSS 2.98% HTML 20.23% JavaScript 50.62%
lightning lwc salesforce

peg_misc's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

peg_misc's Issues

[feat] sfpegMediaPlayCmp - Use standard related list instead of custom field

Is your feature request related to a problem? Please describe.
Using a text custom field to store the id can compromise data integrity if the contentDocument is deleted.
To avoid this, it would be great if we could use the related list relation name instead of a custom field to store the ContentDocumentId

Describe the solution you'd like
We can have parameters on the LWC to store the relatedList relation name and a filter.

image

Describe alternatives you've considered

Use wire api to retrieve relatedList records

// Related list Data Fetch
    error;
    records;
    @wire(getRelatedListRecords, {
        parentRecordId: "$recordId",
        relatedListId: 'ListEmails',
        fields: ['ListEmail.Id'],
        where: "{ and: [{ Name: { like: \"Bob%\" }}] }"
    }) listInfo({ error, data }) {
        console.log('wiredRelated: wired');
        if (data) {
            this.records = data.records;
            this.error = undefined;
        } else if (error) {
            this.error = error;
            this.records = undefined;
        }
    }

Use apex soql to retrieve the related list record

@AuraEnabled(cacheable=true)
	public static Id getContentDocumentId(Id sobjectId, String relationName, String fieldName, String title){

		String sobjectName = sobjectId.getSobjectType().getDescribe().getName();

		String query = 'SELECT Id, (SELECT ' + fieldName + ' FROM ';
		query+= relationName +  ' WHERE Title LIKE \'' + title + '\') FROM ' + sobjectName + ' WHERE Id=:sobjectId';
		SObject sobj = Database.query(query);
		List<SObject> sobjList = sobj.getSObjects(relationName);
		return objList.get(0).get(fieldName);
	}

Additional context
WARNING:
All the related list are not available through the wire service, for example AttachedContentDocuments on Campaign

[bug] sfpegRelatedListKpisCmp - error message on KPI on ActivitiesHistories related list

Describe the bug
When selecting "ActivityHistories" for a Related List, there following error message when component is displayed by a non administrator user.
"There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and you must specify a LIMIT with a maximum of 500"_

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Lightning App Builder'
  2. Add component "sfpegRelatedListKpisCmp"
  3. Select "ActivityHistories" for a "Related list"
  4. Save
  5. Logon as a non admin user
  6. Display the lightning page (for a record)

Expected behavior
The KPI should be displayed without error message.

Screenshots
Capture d’écran 2022-12-14 à 21 49 04

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome

[bug] sfpegRelatedListKpisCmp - Master Detail relationships not available in App Builder configuration

Describe the bug
Master-Detail relations do not appear in "Related list #" while configuring the component in Lightning App builder. Seems that only related lists are displayed.

To Reproduce
Steps to reproduce the behavior:
0. Having Objet A and Object B, with a Master-Detail relation (A is master of B, field A__r on Object B)

  1. Go to a, Object A record
  2. Launch 'Lightning App Builder'
  3. Add "SP PEG Related List KPIs" component
  4. Click on "Related List #1" picklist
  5. Related relation "A__r" does not appear

Expected behavior
Related relation "A__r" to appear (like other related lists).

Screenshots
n/a

Desktop (please complete the following information):

  • OS: MacOs
  • Browser Chrome

[feat] sfpegRelatedListKpisCmp - Replace server SOQL by standard uiRelatedListApi wire service to fetch KPIs

Is your feature request related to a problem? Please describe.
Currently, KPIs are generated server side and not automatically updated if the related lists change.
The refresh button may be provided but requires user intervention to trigger KPI updates.

Describe the solution you'd like
LWC framework provides the uiRelatedListApi
wire service which could be leveraged to automatically refresh the KPIs if an update occurs on a related list
(e.g. the getRelatedListCount wire adapter).

Describe alternatives you've considered
N/A

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.