• Kunagu Varun Kumar Srinivasarao
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I'm new to Apex and I stumbled upon this. I've a custom object named Cast which has a Rating field. I wanted to update all the Rating values to 3. I selected the Id field and updated all of them.
User-added image

I've a similar problem in which I want to update birth date field of all records where birth date is > 2000. This is my code. However I'm getting an exception SObject row was retrieved via SOQL without querying the requested field:

If I include Birthdate__c field in my query, the error goes away.
List<Person__c> listPersons = [SELECT Id FROM Person__c WHERE BirthDate__c > 2000-01-01];
for(Person__c person : listPersons){
	person.BirthDate__c = person.BirthDate__c.addYears(-100); 
}

try{
 Update listPersons;   
}
catch(DMLException ex){
    System.debug(ex.getMessage());
}
Why is that in my first code sample to update Rating field I was able to do that without selecting itin my query but why do I have to select Birthdate field for my second code?
 
I've recently switched from Chrome to Safari as my primary browser. Evrytime I click on an action within Lightning, the action opens up in a new Tab.

For ex: Edit Object and create a New field, the New field wizard opens up in a new page. This new field wizard opened within the same page on Chrome.

I've alredy tried clearing cache, cookies, remove all website data. Can someone help with this please?
I'm new to Apex and I stumbled upon this. I've a custom object named Cast which has a Rating field. I wanted to update all the Rating values to 3. I selected the Id field and updated all of them.
User-added image

I've a similar problem in which I want to update birth date field of all records where birth date is > 2000. This is my code. However I'm getting an exception SObject row was retrieved via SOQL without querying the requested field:

If I include Birthdate__c field in my query, the error goes away.
List<Person__c> listPersons = [SELECT Id FROM Person__c WHERE BirthDate__c > 2000-01-01];
for(Person__c person : listPersons){
	person.BirthDate__c = person.BirthDate__c.addYears(-100); 
}

try{
 Update listPersons;   
}
catch(DMLException ex){
    System.debug(ex.getMessage());
}
Why is that in my first code sample to update Rating field I was able to do that without selecting itin my query but why do I have to select Birthdate field for my second code?
 
I've recently switched from Chrome to Safari as my primary browser. Evrytime I click on an action within Lightning, the action opens up in a new Tab.

For ex: Edit Object and create a New field, the New field wizard opens up in a new page. This new field wizard opened within the same page on Chrome.

I've alredy tried clearing cache, cookies, remove all website data. Can someone help with this please?
Working on Superbadge challenge, and I'm on part 6. 

Automate Fulfillment Cancellation Actions
User-added image

*Fulfillment is a custom object
*Adventure is the product object renamed 

This is the error I'm getting: 
User-added image

I believe I did everything correctly, but the error seems to be the cancelled fulfillment not updating the adventure package correctly. I believe I may not be referencing the original adventure package correctly. 

*adventure package is opportunity product renamed. 

Here is what I did:
User-added image

Please can anyone give me any insight into this. Thank you.