• Daniel Probert 10
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 8
    Replies
i've had this a couple of time in the last few week where a lighting component will not out put a date field to the page in an iteration.

apex class
@AuraEnabled
public static List<Start_Network_Activity__c> getSNAEvents(){
        return [SELECT ID,End_Date__c,Date__c,Name FROM Network_Activity__c];
}

component (not entire componet but the issue parts are there)
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="ActivityCtrl" >

<!-- fire onload controller to populate page with content -->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

<!-- setup a list of records that are default loaded onto the page ready for filtering in progress records -->
    <aura:attribute access="global" name="activities" type="Network_Activity__c[]" />

<table aura:id="activitytable" class="slds-table slds-table_bordered slds-max-medium-table_stacked-horizontal slds-show">
                                <thead>
                                    <tr class="slds-text-title_caps">
                                        <th scope="col">
                                            <div class="slds-truncate" title="Title of Activity">Title of Activity</div>
                                        </th>
                                        <th scope="col">
                                            <div class="slds-truncate" title="Status">Start Date</div>
                                        </th>
                                        <th scope="col">
                                            <div class="slds-truncate" title="Status">End Date</div>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <aura:iteration items="{!v.activities}" var="act">
                                        <tr class="slds-hint-parent">
                                            <td data-label="Title of Activity">
                                                <div class="slds-truncate" title="{!act.Name}"><a href="{!'/one/one.app?#/sObject/'+ act.Id + '/view'}" target="_blank">{!act.Name}</a></div>
                                            </td>
                                            <td data-label="Type">
                                                <div class="slds-truncate" title="{!act.RecordTypeName__c}">{!act.RecordTypeName__c}</div>
                                            </td>
                                            <td data-label="Start Date">
                                                <div class="slds-truncate" title="{!act.Date__c}"><ui:outputDate value="{!act.Date__c}"/></div>
                                            </td>
                                            <td data-label="End Date">
                                                <div class="slds-truncate" title="{!act.End_Date__c}"><ui:outputDate value="{!act.End_Date__c}"/></div>
                                            </td>
                                        </tr>
                                    </aura:iteration>
                                    
                                </tbody>
                            </table>
</aura:component>

controller
 
({
    // preloads the content on the page
	doInit : function(component, event, helper) {
helper.getActivities(component);
	}
)}

js helper
 
{(
getActivities: function(component, event) {
        
        // prepare a var to pull in a list of activities from the db
        var action = component.get("c.getSNAEvents");
        // perform the actual call to db
        action.setCallback(this, function(response) {
            // get the query state so we can handle error
            var state = response.getState();
            // confirm if the call was successful
            if (state === "SUCCESS") {
                // get the response in a var
                var storeResponse = response.getReturnValue();
                // check the length of the response if it is zero we need to display an error message
                if (storeResponse.length == 0) {
                   console.log('no records');
                } else {
                    component.set("v.activities", storeResponse);
                }
            } else {
               console.log('error');
            }
        });                           
        $A.enqueueAction(action);
    }
)}

permissions are fine, as debug shows the field is pulling back the only way i can get it to display is by making it into a formula field and then displaying the formula which works fine.

what am i missing? ​
There are two record types in account. using Trigger I'm populating account industry field from record type 1 to record type 2 Now I want to make account industry as read only field in record type2
Hi below is my Simple Trigger and Test classes.
I am not able to Cover the code for Custom settings, can anyone help me
 
trigger CreateRecord on Deals__c (after insert, after update) 
{
    
    set<id> triggerIds = trigger.newMap.keyset();
    List <Project__c> Project = [select id, Name from Project__c where id in :triggerIds];
    List <Project__c> newProject = new List<Project__c>() ;
    
    for(Deals__c Deal : [Select id,Name,Property__r.Region__c,Type__c,Status__c,Manager__c,Property__r.Site__c from LMS_Deal__c where id IN :triggerIds])
    {
        if(Deal.Type__c == 'New')
        {
            string Name = Deal.Name + ' - ' + Deal.Property__r.Site__c;
            List <Project__c> ProjectList = [select id,Name,OwnerId,Property__r.Site__c from Project__c where Name =: Name];
            Region__c customSettings = Region__c.getInstance(Userinfo.getUserId());
			if (ProjectList.size() == 0)
            {
                if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi')
                {
                    Deal.Manager__c = customSettings.Delhi__c;
    	        }     
                    newProject.add(new Project__c
                               (   Name = Deal.Name + ' - ' + Deal.Property__r.Site__c, 
                                   OwnerId = Deal.Manager__c
                    insert newProject;
            }//if
            else if (ProjectList.size() >> 0)
            {
                if(Deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi')
				{
                    Deal.Manager__c = customSettings.Delhi__c;
                }
               Project__c NewProjectList = [select id,Name,OwnerId,Property__r.Site__c,Property__r.Region__c from Project__c where Name =: Name];
                NewProjectList.OwnerId = Deal.Manager__c; 
                update NewProjectList;
            }    
        }
    }
}

My test class:
 
@isTest(SeeAllData=true)
private class CreateRecordTest {
    static testmethod void CreateRecord(){
		// creating property
        Property__c prop = new Property__c(Name = 'Test property', Site_c = 'New Site', Region__c = 'Delhi');
        insert prop;
		// creating Units 
        Unit__c units = new Unit__c(Name = 'Test Unit', Property_Unit__c = prop.Id);
        insert units;
		// creating a user 
        Profile objProfile = [SELECT Id, Name FROM Profile WHERE Name='System Administrator'];
        User objUser = new User(Alias = 'Swill', 
                                Email='swill@mymail.com', 
                                EmailEncodingKey='UTF-8', 
                                LastName='Will', 
                                LanguageLocaleKey='en_US', 
                                LocaleSidKey='en_US', 
                                ProfileId = objProfile.Id, 
                                TimeZoneSidKey='America/Los_Angeles', 
                                UserName='will@gmail.com');
        insert objUser;
		// creating another user for assigning custom setting 
        Profile objProfile1 = [SELECT Id, Name FROM Profile WHERE Name='System Administrator'];
        User objUser1 = new User(Alias = 'Kaka', 
                                Email='kaka@kakamail.com', 
                                EmailEncodingKey='UTF-8', 
                                LastName='Mkaka', 
                                LanguageLocaleKey='en_US', 
                                LocaleSidKey='en_US', 
                                ProfileId = objProfile1.Id, 
                                TimeZoneSidKey='America/Los_Angeles', 
                                UserName='kaka_M@gmail.com');
        insert objUser1;
		// creating custom settings 
		Region__c CustomSettings = new Region__c ( Name = 'test custom setting',
													Delhi__c = objUser1.Id);
        insert CustomSettings;
       // creating deal  
       Deal__c deal = new Deal__c(Name = 'Test Deal',
                                  Manager__c = objUser1.Id,
                                  Type__c = 'New');
                          insert LMSdeal1;
       // creating property 
        Project__c TP = new Project__c(
                Name = deal.Name +  ' - '  + deal.Property__r.Site__c,
                OwnerId = deal.Manager__c);
            insert TP;
        
        
            
}
}

The problem -  not able to Pass the values into if conditions 
if(deal.Manager__c == Null && Deal.Property__r.Region__c == 'Delhi')
                {
                    Deal.Manager__c = customSettings.Delhi__c;
    	        }

 
  • January 19, 2019
  • Like
  • 0
How to add an asset to a certain account in apex?

@isTest

private class AssetTriggerTest{
    @isTest static void testclass(){
     
        Account acc = new Account();
        acc.Name = 'farah test';
        
        
        insert acc;
    }
    
}
Hello,
I have needed to validate input email on blur of text field but i am unable to fire onblur on <lightning:input.
Please read full post before answer and give me appropriate solution.


Thanks & HNY 2019
i've had this a couple of time in the last few week where a lighting component will not out put a date field to the page in an iteration.

apex class
@AuraEnabled
public static List<Start_Network_Activity__c> getSNAEvents(){
        return [SELECT ID,End_Date__c,Date__c,Name FROM Network_Activity__c];
}

component (not entire componet but the issue parts are there)
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="ActivityCtrl" >

<!-- fire onload controller to populate page with content -->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

<!-- setup a list of records that are default loaded onto the page ready for filtering in progress records -->
    <aura:attribute access="global" name="activities" type="Network_Activity__c[]" />

<table aura:id="activitytable" class="slds-table slds-table_bordered slds-max-medium-table_stacked-horizontal slds-show">
                                <thead>
                                    <tr class="slds-text-title_caps">
                                        <th scope="col">
                                            <div class="slds-truncate" title="Title of Activity">Title of Activity</div>
                                        </th>
                                        <th scope="col">
                                            <div class="slds-truncate" title="Status">Start Date</div>
                                        </th>
                                        <th scope="col">
                                            <div class="slds-truncate" title="Status">End Date</div>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <aura:iteration items="{!v.activities}" var="act">
                                        <tr class="slds-hint-parent">
                                            <td data-label="Title of Activity">
                                                <div class="slds-truncate" title="{!act.Name}"><a href="{!'/one/one.app?#/sObject/'+ act.Id + '/view'}" target="_blank">{!act.Name}</a></div>
                                            </td>
                                            <td data-label="Type">
                                                <div class="slds-truncate" title="{!act.RecordTypeName__c}">{!act.RecordTypeName__c}</div>
                                            </td>
                                            <td data-label="Start Date">
                                                <div class="slds-truncate" title="{!act.Date__c}"><ui:outputDate value="{!act.Date__c}"/></div>
                                            </td>
                                            <td data-label="End Date">
                                                <div class="slds-truncate" title="{!act.End_Date__c}"><ui:outputDate value="{!act.End_Date__c}"/></div>
                                            </td>
                                        </tr>
                                    </aura:iteration>
                                    
                                </tbody>
                            </table>
</aura:component>

controller
 
({
    // preloads the content on the page
	doInit : function(component, event, helper) {
helper.getActivities(component);
	}
)}

js helper
 
{(
getActivities: function(component, event) {
        
        // prepare a var to pull in a list of activities from the db
        var action = component.get("c.getSNAEvents");
        // perform the actual call to db
        action.setCallback(this, function(response) {
            // get the query state so we can handle error
            var state = response.getState();
            // confirm if the call was successful
            if (state === "SUCCESS") {
                // get the response in a var
                var storeResponse = response.getReturnValue();
                // check the length of the response if it is zero we need to display an error message
                if (storeResponse.length == 0) {
                   console.log('no records');
                } else {
                    component.set("v.activities", storeResponse);
                }
            } else {
               console.log('error');
            }
        });                           
        $A.enqueueAction(action);
    }
)}

permissions are fine, as debug shows the field is pulling back the only way i can get it to display is by making it into a formula field and then displaying the formula which works fine.

what am i missing? ​
Hello,

I have below errror message i received from a process builder.

Error Occurred: The flow tried to update these records: null. This error occurred: DUPLICATES_DETECTED: Click on the links below to view or edit the potential duplicate records.. For details, see API Exceptions.

what can be reason

thanks for suggestion !
  • July 19, 2017
  • Like
  • 1
Hello,

I have below errror message i received from a process builder.

Error Occurred: The flow tried to update these records: null. This error occurred: DUPLICATES_DETECTED: Click on the links below to view or edit the potential duplicate records.. For details, see API Exceptions.

what can be reason

thanks for suggestion !
  • July 19, 2017
  • Like
  • 1