• sandy hello
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 0
    Replies
I have requirement to fetch records for current fiscal year through soql in apex.
        currentFiscalYear = [SELECT FiscalYearSettings.Name,StartDate,EndDate FROM Period WHERE Type = 'Year' AND StartDate <= TODAY AND EndDate >= TODAY].FiscalYearSettings.Name;

I am using soql select id,name from Service where CreatedDate >= currentFiscalYear.StartDate and CreatedDate <= currentFiscalYear.EndDate which is giving error System.QueryException: Variable does not exist: currentFiscalYear.StartDate
 
I have a requirent to pass query with where classs in start method in batch class to test few records. I am hard coding name value and executing it in anyonymous window. But the query is failing how can pass it. Similarly i must able to query based on id value. How can i achieve this

global database.querylocator start(Database.BatchableContext BC){ 
    query = ' select id,name from service where name=:test';
 
Here i am creating child record C to a parent record A based on another child record B. I need to identify the picklist field value selected on Child B record to verify the value selected in ceratin set of picklist values which inturn gives record type information to provide on child record C. How can this be achieved using apex code.
I had a requirement to run batch job on records created current fiscal year/current year and the job is executed twice in a year. How to pass curent fiscal year/current year dynamically in soql to fetch records created in current fiscal year.
I have to run a batch job to create child records for the parent object with the help of other child object records field information. Say i hav three objects A,B,C. Where A is the parent object and B,C are child objects, where B is already created, now i have to run batch job on parent A and taking the help of field information from child B i have to create other child C object records. Here C holds some other data  other than B.How can i achieve this.
I nee a recordtypename for record in before update event dynamically without SOQL, based on recordtype name i will proces the record further.How can i achieve this.
I want to retreive value revenue from Object "B" based on input values year and servicetype fields which or common on both objects "A"  & "B" and there is no relationship between both objects, and update revenue value on Object "A"

eg: Year 2020, servicetype - gold which are common on both objects