• raj_sfdcc
  • NEWBIE
  • 45 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 47
    Replies
can anyone give me apex trigger examples for better understanding of the apex trigger 
Hi please can anyone give me clear idea about workflow Rule in Salesforce with understable example
if(!conList.isEmpty()){
            Database.SaveResult[] srList = Database.insert(conList, false);
            
            
            system.debug('srList'+srList);
            integer size=srList.size();
             system.debug('srList size'+size);
               List<Database.SaveResult> Result=srList;
                //Failed Records
                failedconlist=new List<contact>();
                for (Integer i = 0; i<srList.size(); i++) {
                Database.SaveResult s = Result[i];
                contact origRecord = conList[i];
                system.debug('origRecord'+origRecord);
       
                 if(!s.isSuccess()){
                 failedconlist.add(origRecord);
                  // List<Database.Error> err= s.getErrors();
                    ErrorLog__c log=new ErrorLog__c();
                    log.AccountId__c= origRecord.Accountid;
                    
                    log.AccountName__c=origRecord.Account.Name; 
                    
                    for(Database.Error err : s.getErrors()) {
                    // log.ErrorStatusCode__c=err.getStatusCode();   
                    // log.ErrorMessage__c=err.getMessage();
                   // log.ErrorFields__c=err.getFields();
                    }
                    logList.add(log); 
                } 
            }

Hello Experts ,
i have batch class which will insert thousand's of records .so if some records fail  i am trying to insert into error log object .
Help Needed :
1.while i am creating these records into custom object i am not able to insert error messages from DataBase.saveresult .
2.After inserting how to re-process them other than manual process .

Below is my sample code :
when i try to assign errormessage or statuscode to text fileds to not allowing .

Please give me some sample code or suggestion .

Thankyou in advance.
 
Hello Experts ,

Description :
i have a visualforcepage called 'generate_records' and 'schedulebatch' custom controller .From Controller i am calling batch class(MyBatchclass) and which process the large number of records .

Help Needed :
When user clicks on button that bacth starts running in the backgroud .so till the process is completed user should wait .Can you please help me how to show user something like"Loading plese wait" till the process is completed and then redirecing to some other page.
Hello All ,
We have VisualForce page which includes button called 'Generate'  so when we click on that button apex class( 'createRecord' ) will be called and which will create two types of objects records .

Issue :Now the problem is the apex class is creating more number of records which is hitting governor limt(Error :CPU Limit Exceeded) .

So we are planning to conver apex class to Batch apex class to avoid hitting governor limits .

Help Needed :
Since apex class is undergoing with many Lists ,Maps and validations in apex class before preparing final records list to insert ..

So is it possible to call batch class from current apex class by passing two final list of records to insert to the batch class and do the insertion in excute method ?

If above is not possible then can we include all complex list ,maps and validation to get final insert list of records in batch class .if yes please give me an idea .
i am getting this error while logging through username and password through login.salesforce.com.But iam able to login into the application through SSO .
when data is coming into salesforce from some other database through integration how can we make particular field as required .Kindly give me the all possible ways.
i have below Trigger:
trigger AccountTrigger on Account (before update) {
    List<account> acclist=new List<account>();
    for(account acc:trigger.new){
        acclist.add(acc);
    }
    AccountTriggerHandler.updateaccount(acclist);
}

Class:
public class AccountTriggerHandler {
 Public static void updateaccount(List<account> acclist){
        List<account> updatelist=new List<account>();
        for(Account acc:acclist){
            acc.phone='90000324902';
                updatelist.add(acc);
        }}

So when iam triying updating records through Workbench  with account Name field as null also it is running fine.Ideally Account​ Name is RequiredField so we shoud get error while updating.iam confused weather it is due to order of execution or any other reason kindly help me out with this.
i have a site called abc contains a form . after user fills the form and submit he will enter into the new page with success message.
Now the problem is if he press back button in the browser it will move to the form again with all enterd values.if he re submite the page Duplicate record is getting created. Please help me out how to avoid entry through back button.
Hi,
 
I have a strange problem..
 
I have a class where I'm inserting the records to an object from that class.
Lets say the object is Data__c..
 
I have all records in one list variable. Suppose i have 5 records in that list..
 
so., if i wrote
 insert data;(data is a list variable) all 5 records are inserted successfuly.. But I have a trigger on that object(before insert)..
 
For five records trigger is firing only once.. That trigger is firing only for the last record..
 
How to do an insert in which for all the records trigger will fire one by one..
 
Thanks
Raj

Hello all,
i have a india__c(parent) object with status__c field and ap__c(child) object with same status__c field.now whenver status__c field in child updates or inserts .the status__c field in india__c has to get updated.Please help me with it while writing trigger.
trigger StatusFieldUpdate on AP__c (after update,after insert) {
List<india__c> parentList=new List<india__c>();
for(AP__c child:trigger.new){
india__c instancee=new india__c();
instancee.status__c=child.status__c;
parentList.add(instancee);
}
update parentList;
}

 

can anyone give me apex trigger examples for better understanding of the apex trigger 
what is the difference between list and map
Hello All,
        I am new to salesforce and  i need to improve apex coding. can you provide some trigger examples? so that i can learn apex from that exapmles.
Hi,
I am trying to complete the challenge Lightning Data Service Basics - Manipulate Records with force:recordData and I am getting the followling error:
Challenge Not yet complete... here's what's wrong:
Could not find either the 'accEdit' component, 'accDisplay' component or both components in the Account Record Page.
This is strange because the 2 components are indeed on the page:
User-added image
Could please assist ?
Thanks for your help.
 
Hi Can some one explain me how to use two components with Lightning Data Service, i tried the following code for accDisplay and accEdit.
This worked as i expected but i got the following error!

I am missing some thing, can some one explain me how LDS works with multiple componets!
 
Challenge Not yet complete... here's what's wrong: 
The 'accDisplay' Lightning Component does not appear to be displaying the 'Name' using 'ui:outputText' and the value 'v.accountRecord.Name
 
<!--accDisplay component-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
 <aura:attribute name="accountRecord" type="Object" />
<force:recordData aura:id="AccountRecordCreator"
    recordId="{!v.recordId}"
    layoutType="FULL"
    targetRecord="{!v.accountRecord}"
    targetFields="{!v.simpleNewAccount}"
    targetError="{!v.newContactError}"
                  mode="VIEW"
    />
   



    <!-- Display a header with details about the record -->
    <div class="slds-form--stacked">
        <div class="slds-form-element">
            <label class="slds-form-element__label" for="recordName">Name: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordName"
                value="{!v.simpleNewAccount.Name}" />
            </div>
            <label class="slds-form-element__label" for="recordIndustry">Industry: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordIndustry"
                value="{!v.simpleNewAccount.Industry}" />
            </div>
             <label class="slds-form-element__label" for="recordDescription">Description: </label>
            <div class="slds-form-element__control">
              <ui:outputTextArea class="slds-input" aura:id="recordDescription"
                value="{!v.simpleNewAccount.Description}" />
            </div>
             <label class="slds-form-element__label" for="recordPhone">Phone: </label>
            <div class="slds-form-element__control">
              <ui:outputPhone class="slds-input" aura:id="recordPhone"
                value="{!v.simpleNewAccount.Phone}" />
            </div>
        </div>
    </div>

   

   
</aura:component>
<!--accEdit-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">

<aura:attribute name="accountRecord" type="Object"/>
<aura:attribute name="simpleNewAccount" type="Object"/>
<aura:attribute name="newContactError" type="String"/>

<force:recordData aura:id="AccountRecordCreator"
    recordId="{!v.recordId}"
    layoutType="FULL"
    targetRecord="{!v.accountRecord}"
    targetFields="{!v.simpleNewAccount}"
    targetError="{!v.newContactError}"
                  mode="EDIT"
    />
   
    <ui:outputText class="slds-output" 
                value="Edit Account" />
     <lightning:input aura:id="recordName" name="accountRecord" label="Name"
                  value="{!v.simpleNewAccount.Name}" />

     <lightning:button label="Save Account" onclick="{!c.handleSaveRecord}"
               variant="brand" class="slds-m-top--medium"/>
</aura:component>

 
Hi Experts,
I need to create a trigger on account object which will prevent the users in creating duplicate account based on the name.
Kindly provide me the same.

Regards.

Hi All,

I want to know that why we use map instead of list in salesforce. Please help with scenario.

Thanks,
Parteek

Hi Guys,

Can any one explain me which purposes we are using list,set and Map with each one one real time scenarios.please
I am too confused in trigger.new and trigger.old.I fyou could give scenario based trigger example.
  • September 09, 2016
  • Like
  • 0
Iam new to customization, I want to know In  which situation we can go with List,set and map.
 
Hello

Can someone explain when to use different collection types in Apex with some real-life scenarios? 

Some explanation why a certain collection is used would be awesome. (Especially on maps!)

Additionally, are there any collection-specific limitations or best practises which would be good to know?

Thank you!
  • July 03, 2016
  • Like
  • 0
Hello All,
   i have gone through list and map, would any one share same example using LIST and MAP using 2 object. i am still confused when do i use list and when do i use map? please give me one common example , how MAP reduces code over LIST ?

Thanks,
 
Hi  All, I would like to know what is the Difference between Apex sharing and and sharing rules. If anybody know the difference please share to me.

Can any one please let me know when do we use list? when do we use map? when do we use set?

 

I'm bit confused regarding their usage.

  • September 13, 2012
  • Like
  • 0

I am new to programming in apex am studding from apex code developer guide.

 

I need some assignments so that I can practices some body provide me some link on a PDF so that I cold get some help.

Hi,

 

I have read the Apex concepts but I am not getting enough confidence in Apex coding, probably I need to practice more.

I was looking for Apex code examples/samples and use cases in google, but couldnt get any.

Can you please let me know if you have links to the Apex code examples/samples and use cases for Apex to try practicing.

 

Also for Apex classes and triggers, please let me know the following:

 

1. On which parts of Apex, I need to start for code practice and how to proceed further.

2. While practicing, what should be the areas that I need to practice more

3. What areas of Apex are commonly used

4. What areas of Apex are complex which needs more practice

5. How to frame the use cases myself for Apex code practice.

 

 

Thanks,

Priya.

HI all, i m new to this platform, also to Apex code development.

I m creating an application in which i need to use Apex programming,

i have java development background.

 

So what i need is, as many examples as possible in Apex programming,

so if anybody can provide me the websites which i can look into, so it will be helpful.

 

Thank You