• manu manu 23
  • NEWBIE
  • 15 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 15
    Replies
I am very new to Salesforce so I would really appreciate some help in this.

I am creating multiple multiple job application records from selecting candidates on a data table. The position field is a lookup field connected to Job Application so whenever a job application is created the name of the Job application is set into an ID.The left side is the Id of the Job Application and I would like to replace that Id with the Position Title
I would like help to create a trigger that when I create a job application the ID name is replaced with the position title name. 
  • August 29, 2021
  • Like
  • 0

Hi All,

Below are the requirements to complete Challenge
The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.


I have created new custom Checkbox(MatchBillingAddress) and Below is my trigger:

trigger AccountAddressTrigger on Account (before insert,  before update) {

       for(Account a:Trigger.New){
            If (a.Match_Billing_Address__c && a.BillingPostalCode!= Null) {
                a.BillingPostalCode= a.ShippingPostalCode ;  
        } 
    }



Im getting the following error message :

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AddRelatedRecord: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c] Trigger.AddRelatedRecord: line 23, column 1: []

I had same errors on both my demo triggers as well.Please drop your suggestions.:)

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,
 
we handle recursive via static boolean variable.but my question is why should we use static boolean variable.instead of object variable(as i understand static is a class variable.we can call directly by class name no object is require) 
Hi

Been looking around with no luck - is there a simple equivalent to the SQL not null statement in SOQL (ie return rows where the column contains a value?)

Current query:

SELECT Id, Name, customfield__c from Account
Where customfield__c !=null

Any help greatly appreciated! I feel the answer is obvious but it is driving me mad. 

Cheers



 

I am new to salesforce, I want to Know

 

what is the use of  standardsetcontroller??????

 

can you give me manual explanation, I am not able to understanding salesforce documents....

 

please help me....

 

 

Thanks In Advance.

 

 

  • September 17, 2013
  • Like
  • 0

Hi,

i want to call inner class member in Apex , A very simple code i was trying to run:

 

public class Outer

{

  class Inner

    {

      public void show()

        {

             System.debug('Hello');

        }

   }

}

When i tries to call the show() of inner class in developer console with the below statement:

new Outer().new Inner().show();

Then after clicking execute button i m getting unexpected token 'new' error.

however the above code is working in fine in Java, i m new to apex, could you help me please

In apex, while working with List, I have a query-

 

When do we use '.add' and '.addAll' method? Can anyone help me to educate this concept? I've gone through the Apex Guide, but didn't understand much. Thanks in advance?

  • July 29, 2013
  • Like
  • 0

I'm getting this error when I try to update a contact record:

 

Review all error messages below to correct your data.
Apex trigger ContactStageTrigger caused an unexpected exception, contact your administrator: ContactStageTrigger: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.ContactStageTrigger: line 6, column 1

 

Here is my Code:

 

trigger ContactStageTrigger on Contact (after insert, after update) {

    Contact myContact = trigger.new[0];
    Account myAccount = [SELECT OwnerId FROM Account WHERE Id = :myContact.AccountId];
    if(myContact.Status__c == 'Prospect'){
        myContact.OwnerId = myAccount.OwnerId;
        update myContact;
    }
 }

 


Pls explain me what is Recursive Trigger & how to avoid Recursive problem?

I am trying to follow the link

 

 Best Practice #6: Querying Large Data Sets states:

 

SOQL queries that return multiple records can only be used if the query results do not exceed 1,000 records, the maximum size limit of a list. If the query results return more than 1,000 records, then a SOQL query for loop must be used instead, since it can process multiple batches of records through the use of internal calls to query and queryMore.

For example, if the results are too large, the syntax below causes a runtime exception:

//A runtime exception is thrown if this query returns 1001 or more records.
Account[] accts = [SELECT id FROM account];

Instead, use a SOQL query for loop as in one of the following examples:

// Use this format for efficiency if you are executing DML statements 
// within the for loop
for (List<Account> accts : [SELECT id, name FROM account
WHERE name LIKE 'Acme']) {
// Your code here
update accts;
}

Let the Force.com platform chunk your large query results into batches of 1000 records by using this syntax where the SOQL query is in the for loop definition, and then handle the individual datasets in the for loop logic.

 

 --------------------------------------------------------------------------------------------------------------------

 

I have a test object with more than 1000 test records on it.  The test trigger is

 

trigger testProfileEffect on ProfileBasedTest__c (before insert)
{
for(List<ProfileBasedTest__c> pbt:[SELECT description__c FROM ProfileBasedTest__c])
{
pbt[0].description__c = 'Hello world!';
update pbt;
}


}

 

As a test, i am trying to update the existing record's description fields while inserting a new record & get exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger Test.testProfileEffect caused an unexpected exception, contact your administrator: Test.testProfileEffect: execution of BeforeInsert caused by: System.Exception: Too many query rows: 1001: Trigger.Test.testProfileEffect: line 3, column 38

 

 

 The exception is because of List limitation but how can I make the Best Practice #6: Querying Large Data Sets workable in this scenerio?

 

Thanks in advance.

 

 

 

Hi,

I am using a visualforce page and would like to add some error messages into it for example if some field is empty etc...... I do not want to set a validation rule, but would like to work on the save function in the controller to display the error message. Would be of great help if someone could point me out the direction to do that.

I have one more question relating to displaying an output in visualforce. I have a lookup field, it has quantity field too, i would like to populate the quantity from the master object, if i change the lookup the value for quantity should also change respectively, I tried formulas but they effect after save, I would like to have immediate change.

Thanks

KD 

  • June 08, 2009
  • Like
  • 1