• -_-
  • NEWBIE
  • 50 Points
  • Member since 2013

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 11
    Replies
I'm running into this issue (https://salesforce.stackexchange.com/questions/264977/lightningtreegrid-ontoggle-action-triggers-onrowselection) trying to build select all/deselect all for a hierarchy table built in lwc tree grid and am stuck on this bug firing the onselect when trying to deselect rows programmatically.
I have a 3 level hierarchical data table and when a user de-selects from the lowest level (L3) of any parent, when the parent is unselected the on-toggle fires, which for some reason fires the onrowselect event which is incorrect. Following my example, when the onrowselect fires it still hasn't processed my L1 de-select since it had unselected the L2 and L3 and toggled off the L2 and and so it re-adds the L2 and L3's including any other L2's and L3's that were under L1 but were not explicitly selected before.
how has anyone been able to use this component given this 'known' issue?

Link to Playground (https://developer.salesforce.com/docs/component-library/tools/playground/aM8ParSld/4/edit)

 
  • April 28, 2020
  • Like
  • 0
Hi All,

I am looking to add some pre-validation for which Leads acn be added to a campaigns from the Leads Tab via the 'Add to Campaign' button.

I didn't see any way to really perform this validation outside of a JS button that first performs the validation needed on the Leads selected and then assuming everything checks out, passes the list of leads into the regular 'Add to Campaign' flow.

My trouble comes from understanding how to invoke the existing 'Add to Campaign' functionality, inspecting the element didn't seem to help much either.

Has anyone attempted this in the past and has any advice on how I can invoke the 'Add to Campaign' functionality from a custom JS button?

Thanks to all who read and offer help!
  • December 03, 2018
  • Like
  • 0
Hi All,

A client of mine is having trouble viewing the STG_Settings vf page in their sandbox environment.  This page is part of the Salesfore developed HEDA unmanaged package.

The issue is question is on page load the following error is thrown:
An internal server error has occurred
Error ID: 944520837-278048 (319857279)

I have installed the managed package version of the same package in a developer org and am able to view the page just fine.

In the VF Page I have traced the issue to the section of the code below (towards bottom where it says "<-- THIS IS WHERE MY ISSUE LIES"
<apex:page showHeader="true" standardStylesheets="false" applyBodyTag="false" docType="html-5.0" controller="STG_Base_CTRL">
    <script src="/soap/ajax/35.0/connection.js" type="text/javascript"></script>
    <script src="/soap/ajax/35.0/apex.js" type="text/javascript"></script>
    <script src="/lightning/lightning.out.js" type="text/javascript"></script>
	
    <div class="slds">
        <!-- layout=block makes the outputPanel produce a DIV -->
        <apex:outputPanel layout="block" id="stgContainer" rendered="{!hasPerm}"></apex:outputPanel>
        
        <!-- No Access without Profile.PermissionsCustomizeApplication -->
        <apex:outputPanel layout="block" rendered="{!NOT(hasPerm)}">
            <h1 style="font-size: 1.5em;">You do not have permission to view this page.</h1> 
            <p>Please contact your administrator if you require access.</p>
        </apex:outputPanel>
    </div>

    <script>
        //Because sometimes the session ID is not set correctly
        sforce.connection.sessionId = "{!$Api.Session_ID}";		
		
        // We dont know the ID (because visualforce) so were gonna use a CSS selector to get it
        var stgContainerId = document.querySelector('[id$="stgContainer"]').id;
        
        var namespace = '';
        var namespacePrefix = '';
        
		//This would work with any class. We are just using the one with the shortest name.
        var gettingnamespace = sforce.connection.query("SELECT NamespacePrefix FROM ApexClass where Name = 'REL_Utils' LIMIT 1"); 
        var getname = gettingnamespace.getArray("records");
		if(getname.length > 0) { 
		    namespace = getname[0].NamespacePrefix;
		    if(namespace && namespace.length > 0) {
		      namespacePrefix = namespace + '__';
		    }
		}
        if(!namespace || namespace.length === 0) {
            namespace = "c";
        }
        
        $Lightning.use(namespace + ":STG_App", function() {  <-- THIS IS WHERE MY ISSUE LIES
            loadComponents(namespacePrefix);
        });
        
        function loadComponents(namespacePrefix) {
            $Lightning.createComponent(namespace + ":STG_CMP_Container", {namespacePrefix : namespacePrefix} ,stgContainerId);
        }
    </script>
</apex:page>

Now it's worth mentioning that since this is an unmanaged package there is no namespaceprefix to the VF page so the default is being leveraged "c".  That being said this code I believe should rightfully fail since the namespaceprefix (based on their code) is never being set. 
Now I have tried to rectify this by setting the namespaceprefix to "c" as well but end up getting the same error.

I'm not sure how to proceed debugging at this point as the exact same code works in my dev org albeit, as a managed package with the namespacreprefix intact.

Any help is greatly appreciated.

Thanks!
 
  • January 23, 2018
  • Like
  • 0

I am trying to pull contentVersion out of one org and push it into another cloud based file storage system and it is providing a lot of challenge given that I am unable to find a way to export the VersionData field for large files.

Has anyone found a way to do this?  Here is what I have tried (and failed):
Batch Apex - failed whenever a file larger than the heap space (12MB for batch) was queried
Bulk API using Java - you are not even allowed to query the VersionData field... wish I knew this before I wrote a whole program to retrieve it...

I am at a loss as to how to export the data in a way that I can rebuild it and upload to another cloud based system.  

 

any help is greatly appreciated as I am going mad :(

  • June 22, 2017
  • Like
  • 0
Hi,  I have been spending a lot of time trying to export ContentVersion records OUT of salesforce.  I did not realize this would be such a challenge.

I was doing this in batch apex and it worked but quickly ran out of heap space as there are files larger than 12MB (largest file is 500MB).

I then went to the Java Bulk API as I was made aware that the same heap space limitations did not exist however for files that are large (not sure what the cut off is as of yet) I seem to be getting a reply of: InternalServerError : Failed to write query result".

Does anyone know how to get around this, or in general how to export (programmatically) contentVersion data as I am looking to pull it out of Salesforce and push it into another cloud based system.

Any help would be greatly appreciated as I have been at this for quite some time :(
  • June 22, 2017
  • Like
  • 0
Hi I am trying to dynamically make a remoting call to an action function to query some data, serialize it to JSon and return it to the page for jQuery and the bootstrap table plugin to dynamically update the table.

It seems what is happening is the remote action is returning sooner than the table is being rendered (at least that's the only explination I have) and therefore the table is never rendering even though all my validations are showing that the JSON data is being returned successfully.

Has anyone faced this type of issue before?  Below is the code:

Relevant portion of Page:
<table id="table" >							    	
							    	<thead>
							            <tr>
							                <th data-field="Wait List">Wait List</th>
							                <th data-field="Status">Status</th>
							                <th data-field="Enrollment Date/Time">Enrollment Date/Time</th>							                							                
							            </tr>
							        </thead>
							    </table>

Relevant JS:
var $j = jQuery.noConflict();									
			
			$j(document).ready(function() { 				
				$j('#noWL').hide();
				$j('#waitLists').hide();				

				astro.RADLandingCtrlr.getWaitList(function(result, event){ 
					if (event.status) { 
						if(result == '[]'){
							console.log('RESULT: ' + result);
            				$j('#noWL').show();            				          				            			
            			}else {         
            				myData = he.decode(result);   				
            				console.log('RESULT: ' + he.decode(result));																												
							$j('#waitLists').show();
							$j('#table').bootstrapTable({
						    	data : he.decode(result)														    	
							});																					
						}
					}else if(event.type === 'exception'){
						$j('#showmsg').val(event.message + "<br/>\n<pre>"+event.where+"</pre>");                        
					} else {
	                	$j('#showmsg').val(event.message);                        
					} 
				},{ buffer: false, escape: true, timeout: 30000 } );				
		    });



Action method (pleaes excuse the hardcoding, just a draft atm):
@RemoteAction
    global static String getWaitList(){
    	set<Id> idSet = new set<Id>();
    	List<applicationStatus> apps_list = new List<applicationStatus>();                      
        idSet.add(UserInfo.getUserId());
        idSet.add('003i000004ew75Q');
        String contId_str = '';
        
        
        for(User usr : [select ContactId, Id from user where Id IN :idSet]){
            if(usr.contactId != null){
                contId_str = usr.contactId;
            }else {
                contId_str = '003i000004ew75Q';
            }            
        }
    	
    	system.debug('contId_str: ' + contId_str);  
    	
    	for(astro__Wait_List_Selection__c waitList : [select Id, astro__Applications__c, astro__Applications__r.astro__Application_Status__c, astro__Applications__r.CreatedDate, astro__Wait_List_Type__c, astro__Wait_List_Type__r.Name from astro__Wait_List_Selection__c where astro__Applications__r.astro__Applicant__c = :contId_str AND astro__Applications__r.astro__Application_Status__c NOT IN ('Submitted','Rejected')]){
    		applicationStatus appStatus = new applicationStatus();
    		appStatus.enrollment_dt = waitList.astro__Applications__r.CreatedDate;
    		appStatus.waitList_str = waitList.astro__Wait_List_Type__r.Name;
    		appStatus.status_str = waitList.astro__Applications__r.astro__Application_Status__c;
    		apps_list.add(appStatus);    		    		
    	}
		
		String return_str = JSON.serialize(apps_list);
		
		return_str = return_str.replaceAll('enrollment_dt', 'Enrollment Date/Time');
		return_str = return_str.replaceAll('waitList_str', 'Wait List');
		return_str = return_str.replaceAll('status_str', 'Status');

		
		system.debug(return_str);
								    		
    	return return_str;
    }

  • June 04, 2017
  • Like
  • 0

Hi All,

 

I have overidden the Contact page layout with a custom VF page.  I have added my related list via the <apex:relatedList /> tag however, the related list shown is the default related and I have no way of showing any custom buttons I created.

 

On the related object I have created 2 custom buttons and I wanted to show these custom buttons and NOT the standard 'New' button however I see no way in which I can pull in the custom buttons without re-creating the related list by hand and essentially hacking the SFDC styles in there.

 

Has anyone ever had to do this or am I over-looking a simpler solution.

 

Any help is appreciated.

 

Regards,

 

Omear

  • December 11, 2013
  • Like
  • 0
Hi All, I am trying to rename a few profiles and it looks like that's not really possible. You have to clone your existing and rename it at that point. This is all well and fine, however we have automated deployments and therefore are using the force migration toolkit and as a part of this process once the profiles are correct in our lower environments we need to promote them to our higher environments. The process we thought would work is deleting the profiles from the higher environments using the desctructiveChanges.xml and simply deploying the new profiles as usual. However, the destructiveChanges.xml doesn't seem to be deleting the profiles (although nothing fails). Which leads me to my question, can you delete profiles this way? or is this a scenario for a manual change because profiles touch so many other items, and there may be active users underneath them etc. Thanks
  • October 03, 2013
  • Like
  • 0
I'm running into this issue (https://salesforce.stackexchange.com/questions/264977/lightningtreegrid-ontoggle-action-triggers-onrowselection) trying to build select all/deselect all for a hierarchy table built in lwc tree grid and am stuck on this bug firing the onselect when trying to deselect rows programmatically.
I have a 3 level hierarchical data table and when a user de-selects from the lowest level (L3) of any parent, when the parent is unselected the on-toggle fires, which for some reason fires the onrowselect event which is incorrect. Following my example, when the onrowselect fires it still hasn't processed my L1 de-select since it had unselected the L2 and L3 and toggled off the L2 and and so it re-adds the L2 and L3's including any other L2's and L3's that were under L1 but were not explicitly selected before.
how has anyone been able to use this component given this 'known' issue?

Link to Playground (https://developer.salesforce.com/docs/component-library/tools/playground/aM8ParSld/4/edit)

 
  • April 28, 2020
  • Like
  • 0
<lightning:treeGrid aura:id="accountsTreeComponent"
                    columns="{!v.gridColumns}"
            	    data="{!v.gridData}"
                    keyField="accountId"
                    expandedRows="{! v.gridExpandedRows }"
                    isLoading="{! v.isLoading }"
                    ontoggle="{! c.handleRowToggle }"
                    onrowselection="{!c.onRowSelection}"/>

This is how I am using treegrid component.

When I expand a treegrid row, and then collapse it, automatically onrowselection event is fired, which calls onRowSelection action handler in JS controller.

I have made an important observation. This issue occurs in the following scenario:
1) Expand a row (onrowtoggle fired)
2) Select a child row(onrowselection fired)
3) Collapse the parent row (onrowtoggle fired + onrowselection fired)
I believe step 3 internally deselects the child row selected in step 2 which results in firing of onrowselect event. This is certainly a faulty behaviour.

How can I prevent this or at least handle it?
Hi All,

I am looking to add some pre-validation for which Leads acn be added to a campaigns from the Leads Tab via the 'Add to Campaign' button.

I didn't see any way to really perform this validation outside of a JS button that first performs the validation needed on the Leads selected and then assuming everything checks out, passes the list of leads into the regular 'Add to Campaign' flow.

My trouble comes from understanding how to invoke the existing 'Add to Campaign' functionality, inspecting the element didn't seem to help much either.

Has anyone attempted this in the past and has any advice on how I can invoke the 'Add to Campaign' functionality from a custom JS button?

Thanks to all who read and offer help!
  • December 03, 2018
  • Like
  • 0
Hi All,

A client of mine is having trouble viewing the STG_Settings vf page in their sandbox environment.  This page is part of the Salesfore developed HEDA unmanaged package.

The issue is question is on page load the following error is thrown:
An internal server error has occurred
Error ID: 944520837-278048 (319857279)

I have installed the managed package version of the same package in a developer org and am able to view the page just fine.

In the VF Page I have traced the issue to the section of the code below (towards bottom where it says "<-- THIS IS WHERE MY ISSUE LIES"
<apex:page showHeader="true" standardStylesheets="false" applyBodyTag="false" docType="html-5.0" controller="STG_Base_CTRL">
    <script src="/soap/ajax/35.0/connection.js" type="text/javascript"></script>
    <script src="/soap/ajax/35.0/apex.js" type="text/javascript"></script>
    <script src="/lightning/lightning.out.js" type="text/javascript"></script>
	
    <div class="slds">
        <!-- layout=block makes the outputPanel produce a DIV -->
        <apex:outputPanel layout="block" id="stgContainer" rendered="{!hasPerm}"></apex:outputPanel>
        
        <!-- No Access without Profile.PermissionsCustomizeApplication -->
        <apex:outputPanel layout="block" rendered="{!NOT(hasPerm)}">
            <h1 style="font-size: 1.5em;">You do not have permission to view this page.</h1> 
            <p>Please contact your administrator if you require access.</p>
        </apex:outputPanel>
    </div>

    <script>
        //Because sometimes the session ID is not set correctly
        sforce.connection.sessionId = "{!$Api.Session_ID}";		
		
        // We dont know the ID (because visualforce) so were gonna use a CSS selector to get it
        var stgContainerId = document.querySelector('[id$="stgContainer"]').id;
        
        var namespace = '';
        var namespacePrefix = '';
        
		//This would work with any class. We are just using the one with the shortest name.
        var gettingnamespace = sforce.connection.query("SELECT NamespacePrefix FROM ApexClass where Name = 'REL_Utils' LIMIT 1"); 
        var getname = gettingnamespace.getArray("records");
		if(getname.length > 0) { 
		    namespace = getname[0].NamespacePrefix;
		    if(namespace && namespace.length > 0) {
		      namespacePrefix = namespace + '__';
		    }
		}
        if(!namespace || namespace.length === 0) {
            namespace = "c";
        }
        
        $Lightning.use(namespace + ":STG_App", function() {  <-- THIS IS WHERE MY ISSUE LIES
            loadComponents(namespacePrefix);
        });
        
        function loadComponents(namespacePrefix) {
            $Lightning.createComponent(namespace + ":STG_CMP_Container", {namespacePrefix : namespacePrefix} ,stgContainerId);
        }
    </script>
</apex:page>

Now it's worth mentioning that since this is an unmanaged package there is no namespaceprefix to the VF page so the default is being leveraged "c".  That being said this code I believe should rightfully fail since the namespaceprefix (based on their code) is never being set. 
Now I have tried to rectify this by setting the namespaceprefix to "c" as well but end up getting the same error.

I'm not sure how to proceed debugging at this point as the exact same code works in my dev org albeit, as a managed package with the namespacreprefix intact.

Any help is greatly appreciated.

Thanks!
 
  • January 23, 2018
  • Like
  • 0

I am trying to pull contentVersion out of one org and push it into another cloud based file storage system and it is providing a lot of challenge given that I am unable to find a way to export the VersionData field for large files.

Has anyone found a way to do this?  Here is what I have tried (and failed):
Batch Apex - failed whenever a file larger than the heap space (12MB for batch) was queried
Bulk API using Java - you are not even allowed to query the VersionData field... wish I knew this before I wrote a whole program to retrieve it...

I am at a loss as to how to export the data in a way that I can rebuild it and upload to another cloud based system.  

 

any help is greatly appreciated as I am going mad :(

  • June 22, 2017
  • Like
  • 0
Hi,  I have been spending a lot of time trying to export ContentVersion records OUT of salesforce.  I did not realize this would be such a challenge.

I was doing this in batch apex and it worked but quickly ran out of heap space as there are files larger than 12MB (largest file is 500MB).

I then went to the Java Bulk API as I was made aware that the same heap space limitations did not exist however for files that are large (not sure what the cut off is as of yet) I seem to be getting a reply of: InternalServerError : Failed to write query result".

Does anyone know how to get around this, or in general how to export (programmatically) contentVersion data as I am looking to pull it out of Salesforce and push it into another cloud based system.

Any help would be greatly appreciated as I have been at this for quite some time :(
  • June 22, 2017
  • Like
  • 0
Hi I am trying to dynamically make a remoting call to an action function to query some data, serialize it to JSon and return it to the page for jQuery and the bootstrap table plugin to dynamically update the table.

It seems what is happening is the remote action is returning sooner than the table is being rendered (at least that's the only explination I have) and therefore the table is never rendering even though all my validations are showing that the JSON data is being returned successfully.

Has anyone faced this type of issue before?  Below is the code:

Relevant portion of Page:
<table id="table" >							    	
							    	<thead>
							            <tr>
							                <th data-field="Wait List">Wait List</th>
							                <th data-field="Status">Status</th>
							                <th data-field="Enrollment Date/Time">Enrollment Date/Time</th>							                							                
							            </tr>
							        </thead>
							    </table>

Relevant JS:
var $j = jQuery.noConflict();									
			
			$j(document).ready(function() { 				
				$j('#noWL').hide();
				$j('#waitLists').hide();				

				astro.RADLandingCtrlr.getWaitList(function(result, event){ 
					if (event.status) { 
						if(result == '[]'){
							console.log('RESULT: ' + result);
            				$j('#noWL').show();            				          				            			
            			}else {         
            				myData = he.decode(result);   				
            				console.log('RESULT: ' + he.decode(result));																												
							$j('#waitLists').show();
							$j('#table').bootstrapTable({
						    	data : he.decode(result)														    	
							});																					
						}
					}else if(event.type === 'exception'){
						$j('#showmsg').val(event.message + "<br/>\n<pre>"+event.where+"</pre>");                        
					} else {
	                	$j('#showmsg').val(event.message);                        
					} 
				},{ buffer: false, escape: true, timeout: 30000 } );				
		    });



Action method (pleaes excuse the hardcoding, just a draft atm):
@RemoteAction
    global static String getWaitList(){
    	set<Id> idSet = new set<Id>();
    	List<applicationStatus> apps_list = new List<applicationStatus>();                      
        idSet.add(UserInfo.getUserId());
        idSet.add('003i000004ew75Q');
        String contId_str = '';
        
        
        for(User usr : [select ContactId, Id from user where Id IN :idSet]){
            if(usr.contactId != null){
                contId_str = usr.contactId;
            }else {
                contId_str = '003i000004ew75Q';
            }            
        }
    	
    	system.debug('contId_str: ' + contId_str);  
    	
    	for(astro__Wait_List_Selection__c waitList : [select Id, astro__Applications__c, astro__Applications__r.astro__Application_Status__c, astro__Applications__r.CreatedDate, astro__Wait_List_Type__c, astro__Wait_List_Type__r.Name from astro__Wait_List_Selection__c where astro__Applications__r.astro__Applicant__c = :contId_str AND astro__Applications__r.astro__Application_Status__c NOT IN ('Submitted','Rejected')]){
    		applicationStatus appStatus = new applicationStatus();
    		appStatus.enrollment_dt = waitList.astro__Applications__r.CreatedDate;
    		appStatus.waitList_str = waitList.astro__Wait_List_Type__r.Name;
    		appStatus.status_str = waitList.astro__Applications__r.astro__Application_Status__c;
    		apps_list.add(appStatus);    		    		
    	}
		
		String return_str = JSON.serialize(apps_list);
		
		return_str = return_str.replaceAll('enrollment_dt', 'Enrollment Date/Time');
		return_str = return_str.replaceAll('waitList_str', 'Wait List');
		return_str = return_str.replaceAll('status_str', 'Status');

		
		system.debug(return_str);
								    		
    	return return_str;
    }

  • June 04, 2017
  • Like
  • 0

Hi All,

 

I have overidden the Contact page layout with a custom VF page.  I have added my related list via the <apex:relatedList /> tag however, the related list shown is the default related and I have no way of showing any custom buttons I created.

 

On the related object I have created 2 custom buttons and I wanted to show these custom buttons and NOT the standard 'New' button however I see no way in which I can pull in the custom buttons without re-creating the related list by hand and essentially hacking the SFDC styles in there.

 

Has anyone ever had to do this or am I over-looking a simpler solution.

 

Any help is appreciated.

 

Regards,

 

Omear

  • December 11, 2013
  • Like
  • 0
Hi All, I am trying to rename a few profiles and it looks like that's not really possible. You have to clone your existing and rename it at that point. This is all well and fine, however we have automated deployments and therefore are using the force migration toolkit and as a part of this process once the profiles are correct in our lower environments we need to promote them to our higher environments. The process we thought would work is deleting the profiles from the higher environments using the desctructiveChanges.xml and simply deploying the new profiles as usual. However, the destructiveChanges.xml doesn't seem to be deleting the profiles (although nothing fails). Which leads me to my question, can you delete profiles this way? or is this a scenario for a manual change because profiles touch so many other items, and there may be active users underneath them etc. Thanks
  • October 03, 2013
  • Like
  • 0
<lightning:treeGrid aura:id="accountsTreeComponent"
                    columns="{!v.gridColumns}"
            	    data="{!v.gridData}"
                    keyField="accountId"
                    expandedRows="{! v.gridExpandedRows }"
                    isLoading="{! v.isLoading }"
                    ontoggle="{! c.handleRowToggle }"
                    onrowselection="{!c.onRowSelection}"/>

This is how I am using treegrid component.

When I expand a treegrid row, and then collapse it, automatically onrowselection event is fired, which calls onRowSelection action handler in JS controller.

I have made an important observation. This issue occurs in the following scenario:
1) Expand a row (onrowtoggle fired)
2) Select a child row(onrowselection fired)
3) Collapse the parent row (onrowtoggle fired + onrowselection fired)
I believe step 3 internally deselects the child row selected in step 2 which results in firing of onrowselect event. This is certainly a faulty behaviour.

How can I prevent this or at least handle it?