• Jim Minichiello 2
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 4
    Replies
I am not a developer, and our in-house developer left the company, so I need help. We have a Lightning Component that queries a custom object called Suite Products and returns all records. This component stopped working on Monday, 12/19/2018. I checked the browser console in both Firefox and Chrome, and I am getting an error that says "Unable to getSuiteProducts". Here is the code that the error references:
 
(function(){ return (
function () {$A.componentService.addComponentClass("markup://c:ContractBuilderSuiteProducts",function() {
return {
  "meta":{
    "name":"c$ContractBuilderSuiteProducts",
    "extends":"markup://aura:component"
  },
  "controller":{
    "init":function(component, event, helper) {
		var action = component.get('c.getSuiteProducts');
		action.setStorable();
		action.setCallback(this, function(a){
			var state = a.getState();
			if(state === 'SUCCESS'){
				var result = a.getReturnValue();
				component.set('v.products', result);
				helper.initTable(component, event, result, component.get('v.contractElementId'));
				
			}
			else{
				console.warn('Unable to getSuiteProducts');
			}
		});
		$A.enqueueAction(action);
	},
    "attachProducts":function(component, event, helper) {
		helper.attachProducts(component, event, component.get('v.contractElementId'), component.get('v.contractElementType'), component.get('v.selectedIds'));
	},
    "destroy":function(component, event, helper) {
		component.destroy();
	}
  },
  "helper":{
    "initTable":function(component, event, result, contractElementId) {
		var dataSet = [];
		var columnHeaders = [];
		var i;
		for(i = 0; i < result.length; i++){
			
			dataSet.push({
				'id' : result[i].Id,
				'contractelement' : (result[i].Contract_Element__c || ''),
				'event' : (result[i].MSE_Event__r.Name || ''), 
				'suite' : (result[i].Suite__r.Name || ''), 
				'hometeam' : (result[i].Home_Team__c || ''),
				'gamecolor' : (result[i].Game_Color__c || ''),
				'opposingteam' : (result[i].Opposing_Team__c || ''),
				'eventdate' : (moment(result[i].Event_Date__c).format('M/D/YYYY') || ''),
				'status' : (result[i].Status__c || ''),
				'recordtype' : (result[i].RecordType.Name || ''),
				'heldfor' : (result[i].Account_Held_For__c || '')
			});
		}

		


		$(document).ready(function() {
			if ( $.fn.dataTable.isDataTable( '#suiteproducts' ) ){
				$("#suiteproducts").dataTable().fnDestroy();
				console.log('destroyed first.');
			}

			$.fn.dataTable.moment = function ( format, locale ) {
			    var types = $.fn.dataTable.ext.type;

			    
			    types.detect.unshift( function ( d ) {
			        return moment( d, format, locale, true ).isValid() ?
			            'moment-'+format :
			            null;
			    } );

			    
			    types.order[ 'moment-'+format+'-pre' ] = function ( d ) {
			        return moment( d, format, locale, true ).unix();
			    };
			};

			$.fn.dataTable.moment('M/D/YYYY');
			var table = $('#suiteproducts').DataTable( {
			 	destroy: true,
			 	scrollY: 200,
				data : dataSet,
				select : 'single',
		        columns: columnHeaders,
		        pagination : true,
		        search : true,
		        columns : [
		            { data: "event", title : "Event Name" },
		            { data: "eventdate", title : "Event Date" },
		            { data: "suite", title : "Suite" },
		            { data: "hometeam", title : "Home Team" },
		            { data: "opposingteam", title : "Opposing Team" },
		            { data: "status", title : "Status" },
		            { data: "heldfor", title : "Held For/Account Name" }
		        ],
		        initComplete : function () {

	                this.api()
			        		.column(5)
			        		.data()
		        			.unique()
		        			.each(function ( d, j ) {
			                    $('#status').append( '<option value="'+d+'">'+d+'</option>' )
			                } );
			        component.set('v.spinner', false);

  		        },
  		        "createdRow": function ( row, data, index ) {
		            if ( data.contractelement == contractElementId ) {
		                $('td', row).addClass('table-primary-permanent');
		            }
		        }
		    } );

            $('#selectClose').on('click', function(){
            	$('#suiteproducts').html('<table id="suiteproducts" class="table table-bordered slds-table slds-table_bordered"></table>');
            	console.log('table was destroyed!');
            });

		    $('#suiteproducts tbody').on( 'click', 'tr', function () {
		        var data = table.row( this ).data();

		        if ( data.contractelement != contractElementId ) {
			        var selectedIds = component.get('v.selectedIds');
			        var index = selectedIds.indexOf(data);
			        if(index < 0)
			        	selectedIds.push(data);
			        else{
			        	selectedIds.splice(index, 1);
			        }

			        console.log('Selected: ' + JSON.stringify(selectedIds));
			        component.set('v.selectedIds', selectedIds);

			        if ( $(this).hasClass('table-primary') ) {
			            $(this).removeClass('table-primary');
			        }
			        else {
			            $(this).addClass('table-primary');
			        }

			    }
		    });

		    $('#eventdate').on( 'change', function () {
		    	var value = moment(this.value).format('M/D/YYYY');
		    	if(!moment(this.value).isValid()){
		    		value = '';
		    	}
		        table
		        	.columns(1)
		        	.search(value)
		        	.draw();

		    });

		    $('#event').keyup( function () {
			    table
			        .columns( 0 )
			        .search( this.value )
			        .draw();
			});

			$('#hometeam').keyup( function () {
			    table
			        .columns( 3 )
			        .search( this.value )
			        .draw();
			});

			$('#opposingteam').keyup( function () {
			    table
			        .columns( 4 )
			        .search( this.value )
			        .draw();
			});

		    $('#suite').keyup( function () {
			    table
			        .columns( 2 )
			        .search( this.value )
			        .draw();
			});

	        $('#status').on( 'change', function () {
	            table
			        .columns( 5 )
			        .search( this.value )
			        .draw();
	        });

		} );
	},
    "attachProducts":function(component, event, contractElementId, contractElementType, selectedIds) {
		var objects = [];
		for(var i = 0; i < selectedIds.length; i++){
			var status = '';
			if(contractElementType === 'ESPP'){
				status = 'ESPP';
			}
			else if(contractElementType === 'Suite Rental'){
				status = 'Sold';
			}
			else if(contractElementType === 'Suite Lease'){
				status = 'Lease';
			}
			else{

			}

			objects.push({"Id" : selectedIds[i].id, "sobjectType" : "Suite_Products__c", "Contract_Element__c" : contractElementId, "Status__c" : status});
		}

		console.log('Objects to attach: ' + JSON.stringify(objects));

		component.set('v.spinner', true);
		var action = component.get('c.addProducts');
		action.setParams({ 'products' : JSON.stringify(objects) });
		action.setCallback(this, function(a){
			var state = a.getState();
			component.set('v.spinner', false);
			if(state === 'SUCCESS'){
				component.destroy();
			}
			else{
				alert('There is an error!');
			}
		});
		$A.enqueueAction(action);
	}
  }
};
});
 }
)})();
//# sourceURL=https://mse.lightning.force.com/components/c/ContractBuilderSuiteProducts.js
I'm not sure if this information can help you diagnose the problem or not. Any help would be greatly appreciated. 
 
We have an apex integration to an external system. A trigger calls two Classes.
  • The first Class checks to see if the corresponding record exists in the external system. If it does not, the Class sends a create command to the external system and the record should be created.
  • The second Class comes into play if the corresponding record already exists in the external system. If it does, the Class sends an update command to the external system
I am getting this error whenever the trigger is fired:
Update failed. First exception on row 0 with id 0010v000007pcrVAAQ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountTrigger: execution of BeforeUpdate

caused by: System.AsyncException: Future method cannot be called from a future or batch metho

Can someone help my developer and I solve this issue? I can provide the code for the trigger and the two classes.
We have an apex integration to an external system. A trigger calls two Classes.
  • The first Class checks to see if the corresponding record exists in the external system. If it does not, the Class sends a create command to the external system and the record should be created.
  • The second Class comes into play if the corresponding record already exists in the external system. If it does, the Class sends an update command to the external system
I am getting this error whenever the trigger is fired:
Update failed. First exception on row 0 with id 0010v000007pcrVAAQ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountTrigger: execution of BeforeUpdate

caused by: System.AsyncException: Future method cannot be called from a future or batch metho

Can someone help my developer and I solve this issue? I can provide the code for the trigger and the two classes.
I have a controller that queries the CollaborationGroup table to pull Groups (the groups are part of a Community and therefore have a NetworkID).  However when the controller is run by a Site Guest User the query comes up empty, even though the controller is set to "without sharing".  Any idea why this would be, or how to fix/workaround?

Thanks.

  • September 18, 2014
  • Like
  • 1
I have a controller that queries the CollaborationGroup table to pull Groups (the groups are part of a Community and therefore have a NetworkID).  However when the controller is run by a Site Guest User the query comes up empty, even though the controller is set to "without sharing".  Any idea why this would be, or how to fix/workaround?

Thanks.

  • September 18, 2014
  • Like
  • 1