• Filip Poverud 1-9
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
I'm trying to figure out where a field is used and one of the places is referred to as: ProcessTransition Start.

I'm unable to find out where in SalesForce this is.
Any ideas of how I can figure this out ?

So far I can Exclude: APEX, Process Buider, Flows.
Hi all.
I'm creating a dynamic LE DataTable component using Aura.
I'm producing the Columns in the Controller based upon FieldSets and in the Helper I rewrite Columns in order to cover Related Fields.

I have a small issue with labeling HyperLinks:

Controller Code:
 
public class DynamicLightningDataTableController {
    /*
	Method Name	: getObjectRecords
	Purpose		: Create a Lightning Data Table configured by LAB and FieldSets
	*/
    @AuraEnabled
    public static DataTableResponse getObjectRecords(String strObjectName, String strFieldSetName, String strRelativeId, String strRecordId, String strPartnerType){                
       	
        //Get the fields from the FieldSet
        Schema.SObjectType SObjectTypeObj = Schema.getGlobalDescribe().get(strObjectName);
        Schema.DescribeSObjectResult DescribeSObjectResultObj = SObjectTypeObj.getDescribe();            
        Schema.FieldSet fieldSetObj = DescribeSObjectResultObj.FieldSets.getMap().get(strFieldSetName);
        
        //Table Headers
        List<DataTableColumns> lstDataColumns = new List<DataTableColumns>();
        
        //Fields added to the SOQL query
        List<String> lstFieldsToQuery = new List<String>();
        
        //The final wrapper response returned to the component
        DataTableResponse response = new DataTableResponse();
        
        for( Schema.FieldSetMember eachFieldSetMember : fieldSetObj.getFields() ){
            String dataType = String.valueOf(eachFieldSetMember.getType()).toLowerCase();
            //Mapping Schema Object DataTypes with lightning:datatable component structure
            if(dataType == 'datetime'){
                dataType = 'date';
            }
            //Create a wrapper instance and store Label, fieldName, Type and typeAttributes.
            DataTableColumns datacolumns = new DataTableColumns(	String.valueOf(eachFieldSetMember.getLabel()) , 
                                                                	String.valueOf(eachFieldSetMember.getFieldPath()), 
                                                                	String.valueOf(eachFieldSetMember.getType()).toLowerCase(),
                                                                	''
                                                               );
			lstDataColumns.add(datacolumns);
            lstFieldsToQuery.add(String.valueOf(eachFieldSetMember.getFieldPath()));
        }
        
        //Form an SOQL to fetch the data - Set the wrapper instance and return as response
        if(! lstDataColumns.isEmpty()){            
            response.lstDataTableColumns = lstDataColumns;
            String query = 'SELECT ' + String.join(lstFieldsToQuery, ',') + ' FROM ' + strObjectName + ' WHERE ' + strRelativeId + ' = ' + '\'' + strRecordId + '\' AND ' + strPartnerType + ' !=null';
            System.debug(query);
            response.lstDataTableData = Database.query(query);
        }
        
        return response;
    }
    
    //Wrapper class to hold Columns with Headers
    public class DataTableColumns {
        @AuraEnabled
        public String label {get;set;}
        @AuraEnabled       
        public String fieldName {get;set;}
        @AuraEnabled
        public String type {get;set;}
        @AuraEnabled
        public Object typeAttributes {get;set;}
        
        //Create and set three variables label, fieldname and type as required by the lightning:datatable
        public DataTableColumns(String label, String fieldName, String type, String typeAttributes){
            this.label = label;
            this.fieldName = fieldName;
            this.type = type;
			this.typeAttributes = typeAttributes;            
        }
    }
    
    //Wrapper class to hold response - This response is used in the lightning:datatable component
    public class DataTableResponse {
        @AuraEnabled
        public List<DataTableColumns> lstDataTableColumns {get;set;}
        @AuraEnabled
        public List<sObject> lstDataTableData {get;set;}                
        
        public DataTableResponse(){
            lstDataTableColumns = new List<DataTableColumns>();
            lstDataTableData = new List<sObject>();
        }
    }
}
As you can see I set typeAttributes to blank for now.

In the Helper I do the rearrangement:
 
// Rename Related Column FieldNames
                var crows = response.getReturnValue().lstDataTableColumns;
                for(var i = 0 ; i < crows.length;i++) {
                    var crow = crows[i];
                    if(crow.fieldName == "Customer__r.Name"){
                        crow.fieldName = "CustomerName";
                    };
                    if(crow.fieldName == "Consultant_View__c"){
                        crow.type = "url";
                        crow.typeAttributes = "label: \'linkLabel\'";
                        console.log("Columns");
                    	console.log(crow);
                    };
                }
                
                // Rename Related Data Pointers
                var drows = response.getReturnValue().lstDataTableData;
                for(var i = 0 ; i < drows.length;i++) {
                    var drow = drows[i];
                    if(drow.Customer__r){
                        drow.CustomerName = drow.Customer__r.Name;
                    };
                    if(drow.Consultant_View__c){
                        drow.Consultant_View__c = "/lightning/r/PM_Partner__c/a2k0E000000MVkIQAW/view";
                        drow.linkLabel = "View Detail";
                        console.log("Data");
                    	console.log(drow);
                    };
                }
And the returned LE DataTable looks like this:

User-added image

If we look at the actual datasets produced:

User-added imageSo the problem is basically the Labeling of the link.
I have looked at examples and as long as I hardcode the Columns the traditional way with a component.set, everything works. But since this is produced in the controlle and I override it, I'm not sure how to set the proper values in the attribute so it is interpreted correctly.

Thank you in advance
Hi all.
I'm trying to create relationships the following wat:

Account - Partners
For this purpose I have created a custom object Partners and a junction object AccountPartner with a MasterDetail relationship both ways.

I'm able to add Partners to Accounts, and from the Partner object I can see all Accounts related to that Partner. A good working M:M model.

Now I want to introduce Partner Types.

Partner Types
For this purpose I have created a custom object PartnerType with multiple Record Types, one for each Partner Type.
I have then created a custom object for each Partner Type.
This is because one Partner may be multiple Types.

PartnerType has Lookup relations to each Type Object so I'm able to create a link from the Partner Object to each individual Type Object.

But I want to show it like this:

Account (Page)
Partners (Related List)
Record: Partner A - Partner Type A - Link to A object
Record: Partner A - Partner Type B - Link to B object
Record: Partner B - Partner Type A - Link to A object
...

I'm sure the key is how I should relate Partners through PartnerTypes with the individual objects related to each RecordType in PartnerTypes.

Thank you in advance.
 
Hi all. I have a lightning component firing a Flow and I use this on a Global Action. However, every time I want to fire different flows from different buttons, I create new components.

Is there a way to use the design system or otherwise make it generic ?
Hi all. I have a lightning component firing a Flow and I use this on a Global Action. However, every time I want to fire different flows from different buttons, I create new components.

Is there a way to use the design system or otherwise make it generic ?