• Puja Dev 6
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies
Hi All,

Please help me to bulkiefy the following :

 private void getAccountD(List<Account> acc){
         List<Account> account = new List<Account>();
         List<State_Master__c> SM = [SELECT TerritoryState__c,District__c,Town__c,Zone__c,RO__c,Territory_Code__c FROM State_Master__c];
         for(State_Master__c e : SM){
            for(Account g : acc){
                    if((e.TerritoryState__c == g.State_Name__c) && (e.District__c == g.District__c) && (e.Town__c == g.Town__c)){
                        system.debug('Update Acc');                        
                        g.Sales_Office_Text__c = e.Zone__c;
                        g.Sales_District_Text__c = e.Territory_Code__c;
                        g.Sales_Group_Text__c = e.RO__c;
                        account.add(g);
                    }     
            }
        }
        if(account.size() <= 0){
            for(Account g : acc){
                   g.Sales_Office_Text__c = '';
                   g.Sales_District_Text__c = '';
                   g.Sales_Group_Text__c = '';
                   account.add(g);            
            }
        }  
    }

It is working fine for individual record insert and update event.

But it gives
"AccountTrigger: System.LimitException: Apex CPU time limit exceeded" this error at the time of bulk data import.


Thanks in Advance,
Puja
Hello All,

<!-- NewAccount -->
<aura:component implements="force:appHostable" controller="AccountController">
    <aura:attribute name="newAccount" type="Account" default="{ 'sobjectType': 'Account', 'Name': '', }" access="public"/>
    <div >
        <center>
            <form>
                Name <force:inputField aura:id="Name" value="{!v.newAccount.Name}"/>
                Note <force:inputField aura:id="Note" value="{!v.newAccount.Description}"/>
                Categories<force:inputField aura:id="Categories" value="{!v.newAccount.Categories_del__c}"/>
                SubCategories<force:inputField aura:id="SubCategories" value="{!v.newAccount.Sub_Categories__c    }"/>
                Assign to<force:inputField aura:id="Assign To " value="{!v.newAccount.Assigned_To__c}"/>
                Billing Street <force:inputField aura:id="Street " value="{!v.newAccount.BillingStreet}"/>
                Billing City <force:inputField aura:id="City " value="{!v.newAccount.BillingCity}"/>
                Billing State <force:inputField aura:id="State " value="{!v.newAccount.BillingState}"/>
                Billing Country <force:inputField aura:id="Country " value="{!v.newAccount.BillingCountry}"/>
                Billing Postal Code<force:inputField aura:id="Postal Code " value="{!v.newAccount.BillingPostalCode}"/>
                <lightning:button label="Save" onclick="{!c.createAccount}" />
                
            </form>
        </center>
    </div>
</aura:component>



This is my sample code to save Account Record using Lightning Component. "Assign To"  is custom field of "User Lookup" ,  but it gives the following error. Check screen shot as well. I also enabled Lightning component checkbox.


"This page has an error. You might just need to refresh it.
Access Check Failed! AttributeSet.get(): attribute 'inContextOfRecordId' of component 'markup://c:NewAccount {3:0}' is not visible to 'markup://c:NewAccount {3:0}'.
Failing descriptor: {markup://c:NewAccount}"



User-added image
Hi All,

I have formula field of text datatype. It used to captured QR code of each Campaign Member Record.
On VFPage it's working fine.
But on Render as PDF, it shows currepted image.

Following is the formula field :
QR Code :
IMAGE('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=MECARD://tjt--aresssbox.cs64.my.salesforce.com/'&Id ,'Scan QR code to open record in mobile.')
Hi,

I want to copy value of "discounted box price(Currency field)" in to the standard field "Unit Price" of OrderLineItem Object.
I have tryed using Workflow rule. Its working but it can not fullfill my requirment. So,I want trigger to copy "discounted box price" to "Unit Price".
Please let me know the solution.

Thanks, in advanced.
Puja
Hi,
I have following After Update Trigger... I have to write test class for same...
Please some one help me..?

trigger AccountChanged on Asset (after update) {

    List<Opportunity> OppList= new List<Opportunity>();
   
    for (Asset newAsset : Trigger.new) {

                                        // If account of equipment is changed..
        if ( newAsset.AccountId != Trigger.oldMap.get( newAsset.Id ).AccountId ){    
            
                                        //Create new Opportunity for Sales i.e. OEM Record Type...
            Opportunity newOpp1 = new Opportunity();
            
            Id oppRecordTypeId1 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('OEM').getRecordTypeId();
            newOpp1.RecordTypeId = oppRecordTypeId1;
            
            
            newOpp1.Asset__c = newAsset.id;
            newOpp1.Name = 'New Sales Opportunity';
            newOpp1.AccountId = newAsset.AccountId;
            newOpp1.StageName = 'Qualification';
            newOpp1.CloseDate = system.today();
            

            OppList.add(newOpp1);
            
          
                                            //Create new Opportunity for Parts i.e. Parts Record Type...
            Opportunity newOpp2 = new Opportunity();
            
            Id oppRecordTypeId2 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Parts').getRecordTypeId();
            newOpp2.RecordTypeId = oppRecordTypeId2;
            
            
            newOpp2.Asset__c = newAsset.id;
            newOpp2.Name = 'New Parts Opportunity';
            newOpp2.AccountId = newAsset.AccountId;
            newOpp2.StageName = 'Qualification';
            newOpp2.CloseDate = system.today();
            

            OppList.add(newOpp2);
            
            If(OppList.Size()>0){
            Insert OppList;
            }
        }

    }
}