• Vinod Chokkula 3
  • NEWBIE
  • 35 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 16
    Replies
Hi All,
Really need help with this issue:  I am trying to populate field Version__c [Lookup(Product)] on QuotLine__c object, whenever New_Management_Version__c (checkbox field) on Product object is set to true. But don't know why Version__c is not getting populated.
Also would like to mention here, QuoteLine child object of Product parent object.
Here is my Apex Class:
public without sharing class QuoteLineManager{
public static void updateVersion(List<QuoteLine__c> lstQuoteLine){
        
        List<QuoteLine__c> softwareQlines = new List<QuoteLine__c>();
        List<QuoteLine__c> versionQlines = new List<QuoteLine__c>();
         
        for(QuoteLine__c ql:lstQuoteLine){
            if(ql.ProductFamily__c == 'Software'){
                softwareQlines.add(ql);
            }
                        if(ql.ProductFamily__c == 'Version'){
                versionQlines.add(ql);
            }
        }
        
        for(QuoteLine__c softQl:softwareQlines){
            for(QuoteLine__c versQl:versionQlines){
                if(versQl.Parent_Product_Name__c == softQl.Parent_Product_Name__c){
                     softQl.Version__c = versQl.SBQQ__Product__c;
            }
          }
        }        
    }
}
   
Apex Trigger:
trigger QuoteLineBeforeUpdate on QuoteLine__c (before update) {
    
    
    List<QuoteLine__c> listQuotelinesNewVersionManagementTrue =  new  List<QuoteLine__c>();
   
// need to verify if the New Version Management is true :
  for (QuoteLine__c ql : Trigger.new) {
         
        if (ql.ProductFamily__c == 'Software' &&  ql.Product__r.New_Version_Management__c == true ){
            //if is true I put it in the list
            listQuotelinesNewVersionManagementTrue.add(ql);
        } 
     }
   
  if (!listQuotelinesNewVersionManagementTrue.isEmpty()) {
           QuoteLineManager.updateVersion(listQuotelinesNewVersionManagementTrue);
      }
     
             
    }

Please let me know if you didn't get clear picture of issue. Looking forward for positive feedback. Thanks in advance.
I have this Custom Task object.. Help me to calculate the Due Date based on Dependency’s Days After value.

This is the example..
this is manual insert and it automatically create a Due Date.
and it’s complicated to do programmatically.User-added image
System.QueryException: List has no rows for assignment to SObject 
Class.IITStudyAbroadAppTrackerController.<init>: line 21, column 1

Below is my Apex class 

public with sharing class IITStudyAbroadAppTrackerController {
    
    Public id contactID {get; set;}
    Public id studyAbroadApplicationID {get; set;}
    Public Study_Abroad_Application__c studyAbroadApplication {get; set;}
    Public List<TargetX_SRMb__Essay__c> essayList {get; set;}
    Public List<Study_Abroad_Interest__c> studyAbroadInterestList {get; set;}
    Public Study_Abroad_Application__c enroll {get; set;}
    Public Study_Abroad_Application__c essay {get; set;}
    Public Study_Abroad_Application__c AppEssay{get; set;}
    Public Study_Abroad_Application__c ConEssay{get; set;}
    Public TargetX_SRMb__Application__c getapplication() {
        return null;
    }
    //Public Boolean accessError{get;set}
     
    Public IITStudyAbroadAppTrackerController(ApexPages.StandardController controller) {
        this.studyAbroadApplicationID = controller.getRecord().id;
        this.contactID = ([SELECT ID, Contact__c,Name
                           FROM Study_Abroad_Application__c
                          WHERE id = :studyAbroadApplicationID LIMIT 1]).Contact__c;
        this.studyAbroadApplication = this.queryStudyAbroadApplication();
        this.essayList = this.queryEssayList();
        this.studyAbroadInterestList = this.queryStudyAbroadInterestList();
    }
       
    Public Study_Abroad_Application__c queryStudyAbroadApplication(){
        // queryStudyAbroadApplication queries for a list of Study Abroad Application records that match the application ID, then takes the first record to return
        List<Study_Abroad_Application__c> appList = [
            SELECT ID,
            IIT_Study_Abroad_Application_Status__c,
            IIT_Study_Abroad_Advisor_Approval_Date__c,
            IIT_Banner_ID__c,
            Name
            FROM Study_Abroad_Application__c
            WHERE ID = :studyAbroadApplicationID    
        ];
        
        if(appList.size() > 0) {
            return appList[0];
        } else {
            // If the query fails to find a record, return null.  This shouldn't occur since the method uses an ID 
            return null;
        }
    }
    
    Public List<TargetX_SRMb__Essay__c> queryEssayList() {
        // queryEssayList queries for a list of Essay records that match the contact and study abroad application ID
        List<TargetX_SRMb__Essay__c> essayList = [
            SELECT ID,
            TargetX_SRMb__Contact__c,
            TargetX_SRMb__Application__c,
            TargetX_SRMb__Essay_File_URL__c,
            TargetX_SRMb__Essay_Key__c,
            TargetX_SRMb__Personal_Essay_Type__c,
            TargetX_SRMb__SRM_ETL_ID__c,
            TargetX_SRMb__Complete__c,
            TargetX_SRMb__IsRequired__c,
            TargetX_SRMb__RequirementID__c,
            TargetX_SRMb__Type__c,
            IIT_Insufficiency_ID__c,
            IIT_Insufficiency_ID_Desc__c
          
            FROM TargetX_SRMb__Essay__c
            WHERE TargetX_SRMb__Contact__c = :contactID AND IIT_Study_Abroad_Application__c = :studyAbroadApplicationID
        ];
        return essayList;
    }
    
    Public List<Study_Abroad_Interest__c> queryStudyAbroadInterestList() {
        // queryStudyAbroadInterestList queries for a list of Study Abroad Interest records that match the study abroad application ID
        List<Study_Abroad_Interest__c> studyAbroadInterestList = [
            SELECT ID,
            IIT_Contact__c,
            IIT_Available_Fall__c,
            IIT_Available_Spring__c,
            IIT_Available_Summer__c,
            Elevate_Study_Abroad_Opportunities__c,
            IIT_Opportunity_Type__c,
            IIT_Study_Abroad_Program_Start_Date__c,
            IIT_Study_Abroad_Program_End_Date_del__c
            FROM Study_Abroad_Interest__c
            WHERE IIT_Study_Abroad_Application__c = :studyAbroadApplicationID
        ];
        return studyAbroadInterestList;
    }
}
Here are some examples of fake contacts in our database which we would like to clean. 
User-added image
Hi All,

I have 4 objects Forecast__c, ForeCast_Details__C, Opportunity and Opportunity_Forecast__c.  Opportunity object contains multiple Opportunity_Forecast__c. Forecast__c has looup to Opportunity Object. Now i have to write batch apex class with upsert the ForeCast_Details__C  object records with value of Opportunity_Forecast__c.Could anyone please help on this.

Thanks in Advance.
I'm working with list of lists and there is a syntax I'm seeing that I'm not familiar with.  Can someone clarify what this is doing?
 
List<List<sObject>> myListOfLists = New List<List<sObject>>();
myListOfLists = [SOME SOSL QUERY];

List<myObject> oneList = New List<myObject>();

oneList = ((List<myObject>)myListOfLists[0]);
The section in bold is what I don't understand is happening?  Can someone explain?   It almost looks like it's casting the first list as my new list type but I'm not sure.
Thanks for the help.
 
Hello everyone,

I am trying to write a trigger that checks to see if a case is open for an account. If there is no case open then i want it to open a case with certain criteria. I have gotten the code to not throw any errors right up into the end. I was wondering if anyone can help me polish off my last 2 lines of code so that the Case will be Inserted.
trigger caseCheck on Account (After update) {
    for(Account myAccount : Trigger.new){
    List<Case> openCase =[Select id
                          From Case
                          Where (Accountid = :myAccount.Id 
                                 AND
                                 Status IN('New','Open')) ];    
        System.debug(openCase.size() + ' Open case(s) found');
 
        if(openCase.isEmpty()){
            Case c = new Case();
            c.Accountid = myAccount.Id;
            c.Type = 'ICM';
            c.Origin = 'SHIP';
            c.Division__c = 'Case Management';
            c.Status = 'New';
            c.RecordTypeId = '01236000000OJLq';
            }  
        Case.add(c);
        Insert Case;       
    }
}

I am reveiving the following errors;
Variable does not exist: c
Variable does not exist: Case
 
Hi All,
Really need help with this issue:  I am trying to populate field Version__c [Lookup(Product)] on QuotLine__c object, whenever New_Management_Version__c (checkbox field) on Product object is set to true. But don't know why Version__c is not getting populated.
Also would like to mention here, QuoteLine child object of Product parent object.
Here is my Apex Class:
public without sharing class QuoteLineManager{
public static void updateVersion(List<QuoteLine__c> lstQuoteLine){
        
        List<QuoteLine__c> softwareQlines = new List<QuoteLine__c>();
        List<QuoteLine__c> versionQlines = new List<QuoteLine__c>();
         
        for(QuoteLine__c ql:lstQuoteLine){
            if(ql.ProductFamily__c == 'Software'){
                softwareQlines.add(ql);
            }
                        if(ql.ProductFamily__c == 'Version'){
                versionQlines.add(ql);
            }
        }
        
        for(QuoteLine__c softQl:softwareQlines){
            for(QuoteLine__c versQl:versionQlines){
                if(versQl.Parent_Product_Name__c == softQl.Parent_Product_Name__c){
                     softQl.Version__c = versQl.SBQQ__Product__c;
            }
          }
        }        
    }
}
   
Apex Trigger:
trigger QuoteLineBeforeUpdate on QuoteLine__c (before update) {
    
    
    List<QuoteLine__c> listQuotelinesNewVersionManagementTrue =  new  List<QuoteLine__c>();
   
// need to verify if the New Version Management is true :
  for (QuoteLine__c ql : Trigger.new) {
         
        if (ql.ProductFamily__c == 'Software' &&  ql.Product__r.New_Version_Management__c == true ){
            //if is true I put it in the list
            listQuotelinesNewVersionManagementTrue.add(ql);
        } 
     }
   
  if (!listQuotelinesNewVersionManagementTrue.isEmpty()) {
           QuoteLineManager.updateVersion(listQuotelinesNewVersionManagementTrue);
      }
     
             
    }

Please let me know if you didn't get clear picture of issue. Looking forward for positive feedback. Thanks in advance.
i want to write trigger to popolate account owner name into SalesRep__c(Text) field on the account object.