• Manish Arvind
  • NEWBIE
  • 75 Points
  • Member since 2018

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 12
    Replies
trigger conlists on Account (before insert) {
    if(trigger.isInsert && trigger.isAfter)
    {
        List<Contact> lstCon = new List<Contact>();
        for(Account acc : trigger.new)
        {
            Contact con = new Contact();
            con.lastName=acc.Name;
            con.AccountId = acc.Id;
            lstCon.add(con);
        }
        insert(lstCon);
    }
    if(trigger.isUpdate && trigger.isAfter)
    {
        Map<Id,Account> mapACC = new Map<Id,Account>([select (select id,name from contacts)
                                                      from account where id IN: trigger.new]);
        List<Contact> newCon = new List<Contact>();
        for(Account updatedAcc : trigger.New)
        {
            Account oldAcc = trigger.oldMap.get(updatedAcc.Id);
            if(mapACC.ContainsKEY(updatedAcc.Id) && oldAcc.Name != updatedAcc.Name)
            {
                for(Contact con : mapACC.get(updatedAcc.Id).contacts)
                {
                    con.lastname = updatedAcc.Name;
                    newCon.add(con);
                }
            }
        }
        update newCon;
    }
}
Hi Experts Please Help me For Below Code

in this code i used lightning data table it show not proper in salesforce1 mobile app its shows like this:User-added image
<aura:component implements="force:LightningQuickAction,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="Eventrecordcomponent">
  
    <!-- attributes -->
    <aura:attribute name="recordId" type="String"></aura:attribute>
     <aura:attribute name="recordTypes" type="String"></aura:attribute>
    <aura:attribute name="mydata" type="Object"></aura:attribute>
    <aura:attribute name="mycolumns" type="List"></aura:attribute>
    <aura:attribute name="noResults" type="String"></aura:attribute>
   
    <!-- handlers-->
    <aura:handler name="init" value="{!this }" action="{!c.init }"></aura:handler>
   <article aura:id="gridContainer" class="slds-card slds-card_boundary">
        <lightning:card title="Check In/Check Out Manager" iconName="standard:document">
            <div class="slds-card__header slds-grid">
                <aura:if isTrue="{!not(empty(v.mydata))}" >
                    <!-- the container element determine the height of the datatable -->
                    <lightning:datatable keyField="id"
                            data="{! v.mydata }"
                            columns="{! v.mycolumns }"
                            hideCheckboxColumn="true"
                         
                         ></lightning:datatable>
                </aura:if>
                <aura:if isTrue="{!empty(v.mydata)}" >
                    <p Style="color:red;">{! v.noResults }</p>
                  
                </aura:if>
            </div>
        </lightning:card>
    </article>
</aura:component>

So Please Replay ASAP 
Thanks in Advance
Neeraj
I have process builder that looks at a custom lookup field on the account object and uses that to assign the related contacts to that user. The logic is that if that custom lookup field is not "unassigned" then the related contact owners are transferred to that user id. If it is "unassigned" then the related contact owners are transferred to the account owner user id.

I am getting hundreds of these flowapplication errors:

Error element myRule_4_A1 (FlowRecordUpdate).
The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: DSCORGPKG.DiscoverOrgCustomMapping_Contact: System.LimitException: Apex CPU time limit exceeded.

I don't know how to fix this or why it is referencing a discoverorg pakage field... nothing like that is even part of the process! Please help! TIA!
I am working on one trigger where I need to concatinate two fields and populate in third field.
On hed__Course_Offering__c object, I want to concatinate hed__Course__c and hed__Term__c field and need to populate on Name field. I tried below trigger.
trigger ModuleOfferingName on hed__Course_Offering__c (before insert) {
    for(hed__Course_Offering__c con : trigger.New){
        string nameupd = '';
        nameupd += con.hed__Course__r.Name +','+ con.hed__Term__r.Name ;
        con.Name = nameupd;
}
}
The issue is its populating but the hed__Course__c and hed__Term__c are lookup fields so its populating ids but I want names to populate. Can anyone help me out in this issue please.
 
We have apex code to validate ABN in Account Lighting Record Page. This is custom component added to the lighting record page. all users were able to see this before. Suddenly we are not able to to see this tool. We have below visibility critieria set. we are not able to see this tool even Criteria is matched. 
when I remove higlighted filter, it works. but it was working before with all these criteria suddenly it stops working.

Can anyone give me idea?
I checked apex class permission for profile. fields are also visible for all usersUser-added image
trigger conlists on Account (before insert) {
    if(trigger.isInsert && trigger.isAfter)
    {
        List<Contact> lstCon = new List<Contact>();
        for(Account acc : trigger.new)
        {
            Contact con = new Contact();
            con.lastName=acc.Name;
            con.AccountId = acc.Id;
            lstCon.add(con);
        }
        insert(lstCon);
    }
    if(trigger.isUpdate && trigger.isAfter)
    {
        Map<Id,Account> mapACC = new Map<Id,Account>([select (select id,name from contacts)
                                                      from account where id IN: trigger.new]);
        List<Contact> newCon = new List<Contact>();
        for(Account updatedAcc : trigger.New)
        {
            Account oldAcc = trigger.oldMap.get(updatedAcc.Id);
            if(mapACC.ContainsKEY(updatedAcc.Id) && oldAcc.Name != updatedAcc.Name)
            {
                for(Contact con : mapACC.get(updatedAcc.Id).contacts)
                {
                    con.lastname = updatedAcc.Name;
                    newCon.add(con);
                }
            }
        }
        update newCon;
    }
}
Hi Experts Please Help me For Below Code

in this code i used lightning data table it show not proper in salesforce1 mobile app its shows like this:User-added image
<aura:component implements="force:LightningQuickAction,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="Eventrecordcomponent">
  
    <!-- attributes -->
    <aura:attribute name="recordId" type="String"></aura:attribute>
     <aura:attribute name="recordTypes" type="String"></aura:attribute>
    <aura:attribute name="mydata" type="Object"></aura:attribute>
    <aura:attribute name="mycolumns" type="List"></aura:attribute>
    <aura:attribute name="noResults" type="String"></aura:attribute>
   
    <!-- handlers-->
    <aura:handler name="init" value="{!this }" action="{!c.init }"></aura:handler>
   <article aura:id="gridContainer" class="slds-card slds-card_boundary">
        <lightning:card title="Check In/Check Out Manager" iconName="standard:document">
            <div class="slds-card__header slds-grid">
                <aura:if isTrue="{!not(empty(v.mydata))}" >
                    <!-- the container element determine the height of the datatable -->
                    <lightning:datatable keyField="id"
                            data="{! v.mydata }"
                            columns="{! v.mycolumns }"
                            hideCheckboxColumn="true"
                         
                         ></lightning:datatable>
                </aura:if>
                <aura:if isTrue="{!empty(v.mydata)}" >
                    <p Style="color:red;">{! v.noResults }</p>
                  
                </aura:if>
            </div>
        </lightning:card>
    </article>
</aura:component>

So Please Replay ASAP 
Thanks in Advance
Neeraj
I have process builder that looks at a custom lookup field on the account object and uses that to assign the related contacts to that user. The logic is that if that custom lookup field is not "unassigned" then the related contact owners are transferred to that user id. If it is "unassigned" then the related contact owners are transferred to the account owner user id.

I am getting hundreds of these flowapplication errors:

Error element myRule_4_A1 (FlowRecordUpdate).
The flow tried to update these records: null. This error occurred: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: DSCORGPKG.DiscoverOrgCustomMapping_Contact: System.LimitException: Apex CPU time limit exceeded.

I don't know how to fix this or why it is referencing a discoverorg pakage field... nothing like that is even part of the process! Please help! TIA!
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="contact1" type="Contact" 
               default="{ 'sobjectType': 'Contact' }"/>
    <aura:attribute name="contact2" type="Contact" 
               default="{ 'sobjectType': 'Contact' }"/>
    <aura:attribute name="contact3" type="Contact" 
               default="{ 'sobjectType': 'Contact' }"/>
    <aura:attribute name="contact4" type="Contact" 
               default="{ 'sobjectType': 'Contact' }"/>
   
   
    <table class="slds-table slds-table_bordered slds-table_striped slds-table_cell-buffer slds-table_fixed-layout">
        <thead>
            <tr class="slds-text-heading_label">
                <th scope="col"><div class="slds-truncate" title="number"></div></th>
                <th scope="col"><div class="slds-truncate" title="ID">NAme</div></th>
                    <th scope="col"><div class="slds-truncate" title="Name">Lst anesdjsalk</div></th>
                    <th scope="col"><div class="slds-truncate" title="Type">lksdnasdkjds</div></th>
                </tr>
            
            </thead>
        <table>
            <tr>
                <td>
                    <force:inputField value="{!v.contact1.LastName}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact1.AccountId}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact1.Email}"/>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <force:inputField value="{!v.contact2.LastName}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact2.AccountId}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact2.Email}"/>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <force:inputField value="{!v.contact3.LastName}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact3.AccountId}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact3.Email}"/>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td>
                    <force:inputField value="{!v.contact4.LastName}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact4.AccountId}"/>
                </td>
                <td>
                    <force:inputField value="{!v.contact4.Email}"/>
                </td>
            </tr>
        </table>
    </table>
    <lightning:button type="submit" label="NDC Verify" class="slds-float--right">
    </lightning:button>
</aura:component>
HI all,
I habve created a quick lightning action button and in the pop up i have placed one checkbox.

Problrm is that when condition is false it is working perfectly when it is true it is not calling the aura enabled class in controller.

 
Hello! I'm referencing two lookup fields in my Lightning component -- Account ID and Contact ID in the Case object. These fields, unfortunately, appear that way on the front end. Could someone help figure out the syntact for changing the field labels to appear as Account and Contact Name? What I'd use on a VF page doesn't work for Lightning components, as I've found out. Thank you! Contact and Account ID Fields