• Charisse de Belen
  • SMARTIE
  • 1006 Points
  • Member since 2017
  • Consultant
  • CGI

  • Chatter
    Feed
  • 28
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 177
    Replies
Hi, 
when I try challenge in module "Formulas & Validations" > "Use Formula Fields" I obtain an error:

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: Delete failed. First exception on row 0 with id 0010Y00000TpZJuQAN; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot delete account with related opportunities.: []


I also delete all opportunities but error still appears

anybody can help me ?

thanks, 
regards
Alessandro
Hello!

I am getting a "Attempt to de-reference a null object" error in the developer console. I go to the log section and double click on the log, and find the error message. Though it doesnt tell me anything about what the cause is or where its coming from... all it says is "12:24:10:089 FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object" 


is there anyway I can view the full strack trace? (Would like to see line, column, variable, etc). 
Hi, I am attempting to write a simple test for a for loop that cleans the websites fields of unwanted elements such as 'http', 'www' etc. The script works for me but the test class that I wrote gets me 0% of coverage. Could anyone advise on what I am doing wrong? Thank you in advance.

Here's the actual script:
 
public class standardiseWebsites {
    list<Account> accts = [SELECT Website FROM Account];
    public standardiseWebsites(){
   
        for (Account acct : accts){
            string website = acct.website; 
        	website = website.replace('http://www.','');
            website = website.replace('https://www.','');
            website = website.replace('https://','');
            website = website.replace('http://','');
            website = website.replace('www.','');
            acct.website = website;
            update acct;
            
        }
    }
}

And here's the test script:
 
@isTest
public class standardiseWebsitesTest {
    static testMethod void standardiseWebsitesTest(){
        //Create test Accounts with various types of websites
        
        Account account1 = new Account(Name = 'Test Account1', Website='https://www.test.com');
        insert account1;
		Account account2 = new Account(Name = 'Test Account1', Website='http://www.test.com');
		insert account2;
		Account account3 = new Account(Name = 'Test Account1', Website='https://test.com');
		insert account3;                                      
		Account account4 = new Account(Name = 'Test Account1', Website='http://test.com');
		insert account4;
		Account account5 = new Account(Name = 'Test Account1', Website='www.test.com');                                                           
        insert account5;
		Account account6 = new Account(Name = 'Test Account1', Website='test.com');                                                           
        insert account6;

        Test.startTest();
        
        System.debug(accts);
		StandardiseWebsitesTest obj = new standardiseWebsitesTest();
		
        Test.stopTest();
        
        //Check the desired results
        system.assertEquals(Account1.Website,'test.com');
        system.assertEquals(Account2.Website,'test.com');            
        system.assertEquals(Account3.Website,'test.com');            
        system.assertEquals(Account4.Website,'test.com');
        system.assertEquals(Account5.Website,'test.com');            
        system.assertEquals(Account6.Website,'test.com');        
        
        
        
    }

}

 
I have a business need to restrict a picklist value if a particular DateTime field is within 180 days.  My rule looks like this:
 
AND(
ISPICKVAL(Recurring_Post__c , "Yes"),
 DATEVALUE( Last_Drafted_Date__c )<NOW()-180)
Last_Drafted_Date__c is of type DateTime which is why I am using the DATEVALUE function to return a Date BUT I keep getting the folowing error:  Incorrect argument type for function 'DATEVALUE()'

I cant seem to figure out what Im doing wrong!
Can anyone point me in the right direction if its possible to get object values form a .net website into salesforce. If there are articles which explain this topic and if it possible in 2 directions for example with SOAP?
Hello, 
I can't get the terminal to recognize my ant path. I get the message "'ant' is not recognized as an internal or external command, operable program or batch file.

I have the apache-ant-1.10.1 and salesforce_ant_39.0 files in this location: C:\Users\DJensen\Ant

My ANT_HOME is set up as: C:\Users\DJensen\Ant\apache-ant-1.10.1

I've tried several different paths, but just can't seem to get it to work. Any help would be greatly appreciated. 

I'm using windows 7.
Hello,

I have created a user with Salesforce licnece.
For every new browser, it asks the security code.
the code is sent to Email address and also to Phone.

1) Is it possible to remove this security ?
2) if above is not posible atleast we can remove the phone number ?

thanks for suggestions
  • April 27, 2017
  • Like
  • 0
So I just made my new TP, found the settings to rename it. clicked on the Launch your hands-on org after making sure it was the default hands on org and I get an error:
This site can’t be reached
cunning-raccoon-380385-dev-ed.lightning.force.com’s server DNS address could not be found.

I have my normal DE org connected as well and it takes me to the login page for that org where I can log in successfully. Not sure what I'm missing?
Any help is appreciated, Thanks!
Hi,
I can get the Object name with the following code but how can I get this objName using SOQL?
String objName = recId.getSObjectType().getDescribe().getName()
I'm using java/python code to call SOQLs for some other work (integration) I need to know the object names by record ids in Java/Python. Please advice
 
How can I get parent's parent record fields from a child query? Is it possible? like join in SQL
The following is relationship with objects
Book__c  has lookup field Shop__c
Shop__c has lookup field Account
Account has a externalID

I want to get Account's externalID with the Book__c ID.

to Continue my question, in SQL I'll use to get parent's parent record field with this
select acc.relID 
from BOA b​oa, Contact con, Account acc 
where acc.accID = con.accID 
and con.conID = boa.conID 
and boa.boaID='ABC12342323'
Please advice
 
I am able to get an access_token passing SF via HTTP POST. Now that I have the access_token, how do I leverage in the URL to query for case numbers? I want to return "status" for a lookup on the case number that is passed to the API via the IVR. I think the base URL is incorrect for my query... 

I send the folloing to SFDC:
https://login.salesforce.com/services/oauth2/token/
grant_type=password
&client_id=xxxx
&client_secret=xxxx
&username=email@.com
&password=testpwd

and I receive the access_token successfully and I store that value in a variable
I then want to send a url query to SFDC and return all cases for a specific account ... the url that I use for that is where I am lost. What would an example be of the url for this? 

i tried http://instance.salesforce.com/sid=xxxx&case=xxxx
i get the login page for SFDC. I obviously dont understand why I cannot get beyond the access_token being granted ...

Thanks in advance for any guidance,
Patrick
 
Hi,

I am having a trigger referred in a class which works fine , but fails in some cases , I would like to convert that class to a batch class and use it in my trigger

Kindly help me pls

 
MY TRIGGER CODE:

trigger ContractTrigger on Contract__c(After Update,After Insert) {    
    try{
        Trigger_Status__c ts = Trigger_Status__c.getValues('ContractTrigger');
        if(ts.Active__c){
            
            if(Trigger.isUpdate){

                TravelFundHandler.ValidateContractTermination(Trigger.New,Trigger.oldMap);
                ContractTriggerHandler.ContractfieldsupdateonAccount(Trigger.New, Trigger.oldMap);
                ContractTriggerHandler.contractcommencementdate(Trigger.New, Trigger.oldMap);
                ContractTriggerHandler.contractexpirydate(Trigger.New, Trigger.oldMap);
                 
            }  
            if(Trigger.isInsert){

                
                TravelFundHandler.travelFundMethod(Trigger.New,Trigger.oldMap);
              
            } 
            if(Trigger.isUpdate && TravelFundHandler.firstRun){
                TravelFundHandler.firstRun=false;
                TravelFundHandler.SignOnMethod(Trigger.New,Trigger.oldMap);
                
            }
          
           
            
        }
        
    }catch(Exception e){
        System.debug('Error Occured From Contract Trigger: '+e.getMessage());
    }
}
 
MY CLASS CODE :



public class triggerhandler{   
  
     
       public static void ContractfieldsupdateonAccount(List<Contract__c> newList, Map<Id, Contract__c> oldMap){
         
            Map<Id, Date> accMaptomaxcontractenddate = new Map<Id, Date>();
            Set<Id> accIds = new Set<Id>();
            List<Account> updateAcccontinfo = new List<Account>();
            Date d;
                
                        //Collecting the Account information from the Contract where the Status is 'Signed by Customer'
                        
                        for(Contract__c contr: newList){
        
                  if(contr.Status__c == 'Signed by Customer') 
                
                accIds.add(contr.Account__c);
                
                  System.debug('Account Ids: '+accIds);

                AggregateResult[] groupedResults = [SELECT Id,Account__c,MAX(Contract_End_Date__c)  
  FROM Contract__c where Account__c IN :accIds and Contracted__c = TRUE group by Account__c,Id ORDER BY MAX(Contract_End_Date__c) DESC NULLS LAST LIMIT 1]; 
                     // To get the Maximum contract end date of the Active (End Date > Today > Start date) Contract
            
                     for(AggregateResult ar :groupedResults){
  
  d = (Date)ar.get('expr0');
 System.debug('Maximum Contract End date: '+d);
  accMaptomaxcontractenddate.put((Id)ar.get('Account__c'),(Date)ar.get('expr0'));
  System.debug('Accmap for contracted Maximum Contract End date: : '+accMaptomaxcontractenddate);
  }
                   // To get the Account information associated to the Maximum contract end date of the Active (End Date > Today > Start date) Contract 
                   Map<id,Account> accMaptocontractfields = new Map<id,Account>();
            
                    
                   accMaptocontractfields = new Map<Id, Account>([SELECT Id, Contract_Start_Date__c, Contract_End_Date__c, Contract_Commencement_Date__c, 
                   Contract_Expiry_Date__c, No_of_Contracts__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,Domestic_Annual_Share__c, International_Annual_Share__c,
                   Unit_Spend_per_term__c, Contracted__c,(SELECT Id, Contract_Start_Date__c, Contracted__c, Contract_End_Date__c, 
                   Domestic_Annual_Share__c, International_Annual_Share__c, Type__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,
                   Unit_Spend_per_term__c  FROM Contracts__r where (Contract_End_Date__c = :d AND Contracted__c = TRUE) ORDER BY CreatedDate DESC NULLS LAST limit 1 ) FROM Account where Id IN : accIds ]);
                   
                  System.debug('Account map for contract end date:'+accMaptocontractfields);
                    
                     // To get the Contract associated to the Account from the map mentioned above
                  
                  Account acco = accMaptocontractfields.get(contr.Account__c);
                    
                             Date startDate,endDate;
                             Decimal domShare, intShare, unitspend,qantasannual,term;
                             String type;
                             Boolean contracted = false;
                    
                      for(Contract__c contr1 : acco.Contracts__r){
                          
                                  
                                   if(startDate == null && endDate == null){
                                        
                                        startDate = contr1.Contract_Start_Date__c;
                                        endDate = contr1.Contract_End_Date__c;
                                        domShare = contr1.Domestic_Annual_Share__c;
                                        intShare = contr1.International_Annual_Share__c;
                                        unitspend = contr1.Unit_Spend_per_term__c;
                                        qantasannual = contr1.Qantas_Annual_Expenditure__c;
                                        type = contr1.Type__c;
                                        term = contr1.Contract_Term_in_Months__c;
                                        contracted = contr1.Contracted__c;
                                        
                                    }else if(startDate.daysBetween(endDate) < contr1.Contract_Start_Date__c.daysBetween(contr1.Contract_End_Date__c)){
                                        
                                        startDate = contr1.Contract_Start_Date__c;
                                        endDate = contr1.Contract_End_Date__c;
                                        domShare = contr1.Domestic_Annual_Share__c;
                                        intShare = contr1.International_Annual_Share__c;
                                        unitspend = contr1.Unit_Spend_per_term__c;
                                        qantasannual = contr1.Qantas_Annual_Expenditure__c;
                                        type = contr1.Type__c;
                                        term = contr1.Contract_Term_in_Months__c;
                                        contracted = contr1.Contracted__c;
                                    }                                
                                 
                             }
                             
                    //Setting the Highest end date Active Contract information on Account 
                 
                    acco.Contract_Start_Date__c = startDate;
                    acco.Contract_End_Date__c = endDate;
                    acco.Domestic_Annual_Share__c =  domShare;
                    acco.International_Annual_Share__c = intShare;
                    acco.Type__c = type  ;
                    acco.Qantas_Annual_Expenditure__c = qantasannual;
                    acco.Contract_Term_in_Months__c =  term;
                    acco.Unit_Spend_per_term__c = unitspend;
                    acco.Contracted__c =    contracted;
                    
                    
                    System.debug('Account Contract Start Date: '+  acco.Contract_Start_Date__c );
                    System.debug('Account Contract End date: '+acco.Contract_End_Date__c);
                    System.debug('Contract Term in Months: '+acco.Contract_Term_in_Months__c);
                    System.debug('Units spend per term: '+acco.Unit_Spend_per_term__c);
                    System.debug('Account Contract Category: '+acco.Type__c);
                    System.debug('Forecast QF Spend: '  +acco.Qantas_Annual_Expenditure__c);
                    System.debug('Forecast QF Share (Dom) [System]: '+acco.Domestic_Annual_Share__c);
                    System.debug('Forecast QF Share (Int) [System]: '+acco.International_Annual_Share__c);
                    System.debug('Contracted:'+acco.Contracted__c);
                    
                      updateAcccontinfo.add(acco);
                    }

         
                    
            try{
          
            Database.SaveResult[] srlist = Database.Update(updateAcccontinfo, false);
                for (Database.SaveResult sr : srlist){
if (!sr.isSuccess()) {
    
    // Updation failed due to duplicate detected
    for(Database.Error duplicateError : sr.getErrors()){
        Datacloud.DuplicateResult duplicateResult = 
                  ((Database.DuplicateError)duplicateError).getDuplicateResult();
        System.debug('Duplicate records have been detected by ' + 
                  duplicateResult.getDuplicateRule());
        System.debug(duplicateResult.getErrorMessage());
    }

    // If the duplicate rule is an alert rule, we can try to bypass it
    Database.DMLOptions dml = new Database.DMLOptions(); 
    dml.DuplicateRuleHeader.AllowSave = true;
    Database.SaveResult[] sr2list = Database.Update(updateAcccontinfo, dml);
     for (Database.SaveResult sr2 : sr2list){
    if (sr2.isSuccess()) {
        System.debug('Duplicate account has been updated in Salesforce!');
    }
}
}
}
            }

catch(Exception e){
               System.debug(' Exception Occured: '+e.getMessage());
               }
        }
        
        /* This method is being used to populate the Account fields "Contract Commencement Date" of the 
      Minimum contract start date with the status "Signed by Customer" */
        
        public static void contractcommencementdate(List<Contract__c> newList, Map<Id, Contract__c> oldMap){
           
            Map<Id, Date> accMaptomincontractstartdate = new Map<Id, Date>();
            Set<Id> accoIds = new Set<Id>();
            List<Account> updateAcccommdate = new List<Account>();
            Date d;
            Date commencementDate;
            
            //Collecting the Account information from the Contract where the Status is 'Signed by Customer'
        
         for(Contract__c contr: newList){
           
         if(contr.Status__c == 'Signed by Customer' ) 
                
            accoIds.add(contr.Account__c);
    
             // To get the Minimum contract start date of the ""Signed by Customer" Contract    
             
            AggregateResult[] groupedResults = [SELECT Id,Account__c, MIN(Contract_Start_Date__c)  
  FROM Contract__c where Account__c IN :accoIds and Status__c = 'Signed by Customer' group by Account__c,Id ORDER BY MIN(Contract_Start_Date__c) ASC NULLS LAST LIMIT 1];
          
  for(AggregateResult ar : groupedResults){
      accMaptomincontractstartdate.put((Id)ar.get('Account__c'),(Date)ar.get('expr0'));
      
      System.debug('Accmap for Minimum Contract Start date: : '+accMaptomincontractstartdate);
      d=(Date)ar.get('expr0');
      System.debug('Least Commencement Date: '+d);
     }
                 
                 // To get the Account information associated to the Minimum contract start date of the "Signed by Customer" Contract
                 Map<id,Account> accMaptocommencementdate = new Map<id,Account>();
     
                     accMaptocommencementdate = new Map<Id, Account>([SELECT Id, Contract_Start_Date__c, Contract_End_Date__c, Contract_Commencement_Date__c, 
                   Contract_Expiry_Date__c, No_of_Contracts__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,Domestic_Annual_Share__c, International_Annual_Share__c,
                   Unit_Spend_per_term__c, Contracted__c,(SELECT Id, Contract_Start_Date__c, Contracted__c, Contract_End_Date__c, 
                   Domestic_Annual_Share__c, International_Annual_Share__c, Type__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,
                   Unit_Spend_per_term__c  FROM Contracts__r where (Contract_Start_Date__c = :d and Status__c = 'Signed by Customer')limit 1 ) FROM Account where Id IN : accoIds]);
  
   
               // To get the Contract associated to the Account from the map mentioned above
   Account accou = accMaptocommencementdate.get(contr.Account__c);
  
  for(Contract__c contr2 : accou.Contracts__r){
  commencementDate = contr2.Contract_Start_Date__c;
  }
  
  //Setting the Minimum Contract start date to the Account Contract commencement date
 
 accou.Contract_Commencement_Date__c =  commencementDate;
 
 System.debug('Account Contract Commenecement Date:'+accou.Contract_Commencement_Date__c);
     updateAcccommdate.add(accou);
      }
           
 
     
        
            try{
          
            Database.SaveResult[] srlist = Database.Update(updateAcccommdate, false);
                for (Database.SaveResult sr : srlist){
if (!sr.isSuccess()) {
    
    // Updation failed due to duplicate detected
    for(Database.Error duplicateError : sr.getErrors()){
        Datacloud.DuplicateResult duplicateResult = 
                  ((Database.DuplicateError)duplicateError).getDuplicateResult();
        System.debug('Duplicate records have been detected by ' + 
                  duplicateResult.getDuplicateRule());
        System.debug(duplicateResult.getErrorMessage());
    }

    // If the duplicate rule is an alert rule, we can try to bypass it
    Database.DMLOptions dml = new Database.DMLOptions(); 
    dml.DuplicateRuleHeader.AllowSave = true;
    Database.SaveResult[] sr2list = Database.Update(updateAcccommdate, dml);
     for (Database.SaveResult sr2 : sr2list){
    if (sr2.isSuccess()) {
        System.debug('Duplicate account has been updated in Salesforce!');
    }
}
}
}
            }

catch(Exception e){
               System.debug(' Exception Occured: '+e.getMessage());
               }
        }
        
        
         public static void contractexpirydate(List<Contract__c> newList, Map<Id, Contract__c> oldMap){
         
          Map<Id, Date> accMaptomaxcontractexpdate = new Map<Id, Date>();
          Set<Id> accIds = new Set<Id>();
          List<Account> updateAccexpdate = new List<Account>();
          Date d;
          Date expiryDate;
        
                //Collecting the Account information from the Contract where the Status is 'Signed by Customer'
                for(Contract__c contr: newList){
                   
                if(contr.Status__c == 'Signed by Customer' ) 
                
                accIds.add(contr.Account__c);
          
                
        
            // To get the Maximum contract end date of the ""Signed by Customer" Contract

          AggregateResult[] groupedResults =  [SELECT Id,Account__c, MAX(Contract_End_Date__c)
  FROM Contract__c where Account__c IN :accIds and Status__c = 'Signed by Customer' group by Account__c,Id Order by MAX(Contract_End_Date__c) DESC NULLS LAST LIMIT 1];         
            
                     for(AggregateResult ar : groupedResults){
      accMaptomaxcontractexpdate.put((Id)ar.get('Account__c'),(Date)ar.get('expr0'));
      
        System.debug('Accmap for Maximum Contract End date: : '+accMaptomaxcontractexpdate);
        
      d=(Date)ar.get('expr0');
      
      System.debug('Highest Expiry Date: '+d);
      
  }
  
  // To get the Account information associated to the Maximum contract end date of the ""Signed by Customer" Contract
  
   Map<id,Account> accMaptoExpirydate = new Map<id,Account>();
   
          accMaptoExpirydate = new Map<Id, Account>([SELECT Id, Contract_Start_Date__c, Contract_End_Date__c, Contract_Commencement_Date__c, 
                   Contract_Expiry_Date__c, No_of_Contracts__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,Domestic_Annual_Share__c, International_Annual_Share__c,
                   Unit_Spend_per_term__c, Contracted__c, Account_Contract_No__c,(SELECT Id, Contract_Start_Date__c, Contracted__c, Contract_End_Date__c, 
                   Domestic_Annual_Share__c, International_Annual_Share__c, Type__c,Qantas_Annual_Expenditure__c,Contract_Term_in_Months__c,
                   Unit_Spend_per_term__c,Contract_Number__c FROM Contracts__r where (Contract_End_Date__c = :d and Status__c = 'Signed by Customer')ORDER BY CreatedDate DESC NULLS LAST limit 1) FROM Account where Id IN : accIds ]);
  
  
  // To get the Contract associated to the Account from the map mentioned above

  
   Account accoun = accMaptoExpirydate.get(contr.Account__c);
   
   String Accconno;
   
     for(Contract__c contr2 : accoun.Contracts__r){
         Accconno = contr2.Contract_Number__c;
  expiryDate = contr2.Contract_End_Date__c;
  }
  
    //Setting the Maximum Contract end date to the Account Contract commencement date
   
   accoun.Contract_Expiry_Date__c = expiryDate;
   accoun.Account_Contract_No__c = Accconno;
 
System.debug('Account Contract Expiry Date:'+ accoun.Contract_Expiry_Date__c);
System.debug('Account Contract No: '+  accoun.Account_Contract_No__c);
 updateAccexpdate.add(accoun);
      
        }
        

       
            try{
          
            Database.SaveResult[] srlist = Database.Update(updateAccexpdate, false);
                for (Database.SaveResult sr : srlist){
if (!sr.isSuccess()) {
    
    // Updation failed due to duplicate detected
    for(Database.Error duplicateError : sr.getErrors()){
        Datacloud.DuplicateResult duplicateResult = 
                  ((Database.DuplicateError)duplicateError).getDuplicateResult();
        System.debug('Duplicate records have been detected by ' + 
                  duplicateResult.getDuplicateRule());
        System.debug(duplicateResult.getErrorMessage());
    }

 
    Database.DMLOptions dml = new Database.DMLOptions(); 
    dml.DuplicateRuleHeader.AllowSave = true;
    Database.SaveResult[] sr2list = Database.Update(updateAccexpdate, dml);
     for (Database.SaveResult sr2 : sr2list){
    if (sr2.isSuccess()) {
        System.debug('Duplicate account has been updated in Salesforce!');
    }
}
}
}
            }

catch(Exception e){
               System.debug(' Exception Occured: '+e.getMessage());
               }
        }
        
    }

Kindly help me pls

Thanks in advance
Hello,
I am not able to complete following challange.

Developer Beginner -> Process Automation->Automate Basic Business Processes with Process Builder

Step 1Step 2Step 3Step 4Step 5
Tried all variations like "Updated records meet all conditions" and "No criteria—just update the records!". 
"Conditions are met" and "No criteria—just execute the actions!"

Please help
I'm having difficulties completing the challenge at the end of "Determine the Order of Your Process Criteria" in the "Workflow Rule Migration" trail.  The challenge is very straight forward and asks you to rearrange some criteria in the process builder and change some of the end behavior of certain end criteria.

I am getting the following error: "The end behavior for the ‘New Opportunity’ criteria node isn’t properly configured."

The rules of this challenge specify "If “New Opportunity” evaluates to true, the process stops" and below, you can see that the process is set to stop if this criteria evaluates true.  Anyone else having an issue here or know what could be wrong?

User-added image
In following the instructions of the last step of Reports and Dashboards and many examples noted, when I access the App exchange to download the Salesforce Adoption Dashboard, it only gives me the options to load it in "Production" or the "Sandbox".  I have no problem completing the task once it loaded in Production; however, when selecting the Check Challenge, the system is obviously looking for the Dashboard in a different location. When trying the process in the Sandbox, the system errors on login.  The window that opens when clicking "Launch your own hands-on org" takes me to a screen that won't permit launching the App Exchange.  Any suggestions?   


 
Hello Developers!

I need assistance with my Apex Class. I'm getting the error below for the Apex Class below. Any assistance will be gladly appreciated!

Error: Compile Error: Didn't understand relationship 'Products__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 16 column 6
 
public class StockroomConfVouchersController {

    Public List<Product2> Product2List{get;set;}
    public String contId{get;set;} 
    public String dcid{get;set;}
    public Product2 Product2Obj{get;set;}
    Public string editid{get;set;} 
    public Stockroom__c S {get;set;}
        public Id selectedDetailID { get;set; }

    
    String currentRecordId ; 
    public StockroomConfVouchersController (ApexPages.StandardController controller) {
    
   currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
   S=[SELECT ID,Name,(SELECT ID,Name,Balance__c,Capacity__c,UsedNEW__c,IsActive,Start_Date__c,End_Date__c, Status__c FROM Products__r WHERE Status__c = 'Active') FROM Stockroom__c WHERE ID=:currentRecordId ];
     
     
     
     
        system.debug('ssssssssss'+Product2List);
        system.debug('uuuuu'+currentRecordId );

     
   if(S==null)
   {
    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,''+'No Confernce Vouchers to Display'));
   } 
 }
 

     
    public PageReference save()
    {
    system.debug('sssssssssssssuuuu'+S);
        upsert S.Products__r;
        
    PageReference pageRef = new PageReference('/apex/StockroomConfVouchers');
    pageRef.setRedirect(true);
    return null;    }  
     
     
       public pagereference deleteCon() {
       String s1 = System.CurrentPageReference().getParameters().get('dtlIdParam');
       Product2 p=[ select id,IsActive From Product2 Where id=:s1];
       p.IsActive = false;
      
       upsert p;
       PageReference pageRef = new PageReference('/apex/StockroomConfVouchers');
       pageRef.setRedirect(true);
       return null;
   } 
    
 
   
   
}ß

 
  • April 13, 2017
  • Like
  • 0
I started the trail monday, have since restarted, want to finish and am not sure how to get back to that playground.
Apex Code:
public class savecontroller {
private final Account acct;
    public savecontroller(ApexPages.StandardController controller) {
        this.acct = (Account)controller.getRecord();
    }
    public void autosave()
    {
        update acct;
    }  
}

Visual Force Page code:
<apex:page standardController="Account" extensions="savecontroller">
<apex:form >
<apex:pageblock >
<!-- The action function which calles the Apex function 'autosave' -->
<apex:actionFunction name="autosave" action="{!autosave}" rerender="out" status="savestatus"/>

<!-- A status denotion of the update -->
<apex:actionStatus id="savestatus">
          <apex:facet name="start"> Auto Saving....</apex:facet> 
</apex:actionStatus>

<apex:pageblocksection columns="2">
      <apex:inputfield value="{!Account.Name}"/>
      <apex:inputfield value="{!Account.BillingCity}"/>
      <apex:inputfield value="{!Account.BillingCountry}"/>
      <apex:inputfield value="{!Account.BillingState}"/>
</apex:pageblocksection>      
</apex:pageblock>

<!-- A javascript recursive function which calls itself every 10 seconds, the setTimeout method calls the apex function 'autosave' defined in the <apex:actionfunction> tag above -->
<script>
          window.setTimeout(recursivecall,10000);
          function recursivecall()
          {
              window.setTimeout(recursivecall,10000);
              autosave();
          }    
</script>
                
</apex:form>      
</apex:page>

Error:

Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!autosave}' in page sample: Class.savecontroller.autosave: line 8, column 1
I'm having some issues and the response was to try a new org - how do I do that and link it to my Trailhead account?
I'm trying to make a simple change to Case Management record page (add tab)
I go to Lightning App Builder make the change, press save and it shows saved. When I go back to Lightning App Builder main page in setup I see that Last Modified changes
I go back to the page and the changes are not there.
I tried to create a new page instead and got more or less the same result. The header is saved ok the rest is not saved
Any idea what could be the problem?
 
 
  • April 05, 2017
  • Like
  • 0
Hello everyone,

I'm trying to create a REST endpoint that will execute a batch job. What I have now looks like this:
@RestResource(urlMapping='/runBatch')
global class BatchRestWebService {

	@HttpPost
	global static void runBatch() {
		BatchJob restBatchJob = new BatchJob();
        Database.executeBatch(restBatchJob, 50);
	}

}

Is this on the right track? How do I unit test this? Here's the beginnings of a potential unit test:
@isTest
private class TestBatchRestWebService {

    @isTest
	static void test() {
		RestRequest request = new RestRequest();

		request.requestURI = 'https://my-dev-org.salesforce.com/services/apexrest/runBatch';
		request.httpMethod = 'POST';

		RestContext.request = request;

        // Now what?
    }

}

Please let me know if I'm heading in the right direction.
Once you complete a superbadge, you can no longer view the challenge list. Is there a list somewhere of all the superbadge challenges so I can go back and review them?
Hello,

I have a custom sObject called AccountDetail that is the child in a lookup relationship with Account. It is also the parent in a lookup relationship with Opportunity. In my situation, I have Master Accounts that have AccountDetail objects, and I have Child Accounts that have Opportunity objects. Here's a diagram to help you visualize these relationships:

Diagram describing relationship between the relevant sObjects
I need to find all the Child Accounts related to each Master Account based on the relationships between their Opportunity and AccountDetail objects (I understand that organizing the data this way does not seem to make sense, but because of reasons outside of my control, this is how I have to do it). 

The query I am trying to use looks like this:
List<Account> accounts = 
   [SELECT Account.Id, Account.Name FROM Opportunity
    WHERE AccountDetail__c IN 
    (SELECT Id FROM AccountDetail__c
    WHERE Account__r.Id= :masterAccountId)].Account;
but this results in an Illegal assignment from Account to List<Account> error.

How do I make this query work to select all the Child Accounts instead of just one? Is there a better way to query the Child Accounts?
In the Trailhead module called "Override A Standard Action with a Lightning Component", everything is going OK up till the point where we add SLDS styling to the cmp to make it a modal. They provide the code (see below), but for some reason, it's not displaying as modal for me. (Yes, I've refreshed, multiple times, even relaunching the playground.) Anybody else experiencing this?
<aura:component implements="lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId" access="global">
    <aura:attribute name="picklistValues" type="Object" />
    <aura:attribute name="propertyRecord" type="Property__c" />
    <force:recordData aura:id="forceRecord"
                      recordId="{!v.recordId}"
                      targetFields="{!v.propertyRecord}"
                      fields="Id,Name,Beds__c,Baths__c,Price__c,Status__c"
                      mode="EDIT" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <c:PickListValues sObjectName="Property__c" fieldName="Status__c" picklistValues="{!v.picklistValues}" />

    <div aura:id="editDialog" role="dialog" tabindex="-1" aria-labelledby="header43" class="slds-modal slds-fade-in-open">
        <div class="slds-modal__container">
                <div class="slds-modal__header">
                    <h2 class="slds-text-heading--medium">New Record</h2>
            </div>
            <div class="slds-modal__content slds-p-around--medium slds-grid slds-wrap ">
                <lightning:input aura:id="propName" name="propName" label="Property Name" required="true" class="slds-size--1-of-1 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propBeds" name="propBeds" label="Beds" class="slds-size--1-of-2 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propBaths" name="propBaths" label="Baths" class="slds-size--1-of-2 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propPrice" name="propPrice" label="Price" class="slds-size--1-of-2 slds-p-horizontal_x-small" />    
                <lightning:select aura:id="propStatus" name="propStatus" label="Status" class="slds-size--1-of-2 slds-p-horizontal_x-small">
                    <aura:iteration items="{!v.picklistValues}" var="item">
                        <option value="{!item}">{!item}</option>
                    </aura:iteration>
                </lightning:select>
            </div>
            <div class="slds-modal__footer">                
                <lightning:button variant="neutral" label="Cancel" />
                <lightning:button variant="brand" label="Submit" onclick="{!c.saveRecord}" />
            </div>
        </div>
    </div>
    <div aura:id="overlay" class="slds-backdrop slds-backdrop--open"></div>
</aura:component>

 
Hi,

I feel i have done all the steps but still get Could not find the 'New Customer Flow' flow in the default Home Page.

for the Collect Information from Users and then Operate on It with Visual Workflow badge. 
Any help would be great. 
 
I would like to finish the Analytics Trails and therefore need to connect my Trailhead with my newly generate "Wave Playground"-Account. Though I cannot click on any of the options within the dropdown menu (see attachment), simply nothing happens when I click on anything. 
Following error message occurs: 
"The 'Trailhead_Data_Manager' app was not found. Please follow the requirements and ensure the wave enabled org is setup correctly."

Would be great if someone knows what to do now? 

Thanks
Angie User-added image
Hi

 I am getting this error when I try to check challenge even though I have done what was required. Not able to understand the error.

Thanks
Pallavi
When creating the sales dashboard I can see from other threads people have changed the label of "Record Count" to "Number of Deals" - How do you do this ?  thanks 
 
Is it possible to use the batchable class in an anonymous block?
I'm attempting to update to a few hundred accounts from within the Execute Anonymous environment, but because of the existing Apex, Im getting "Too many SOQL queries: 50001".
So I attempted the following code (still within an  anonymous block) and it will come back with 

"Execute Anonymous Error
Line: 13, Column: 14
Global type must be contained inside of a global class"

I think the developer console doesn't like global classes...    Does it ?
Do I absolutely need a global modifier to use the SFDC batchable classes ?
Advise will be appreciated

This is the actual code:  
global class SICS implements Database.Batchable<Account>{
   global final String Query;
   string q = 'Select Id, CMSIC8A__c, Temp_BadCMSIC__c from Account' +
               'where Temp_BadCMSIC__c != NULL ';
    
  global UpdateAccountFields(String q){ Query=q;}

  global Database.querylocator start(Database.BatchableContext BC){
            return Database.getQueryLocator(query);}
    
 global void execute(Database.BatchableContext BC, List<Account> scope){
   
LIST<Account> SIC2Up  = [Select Id, CMSIC8A__c, Temp_BadCMSIC__c from Account where Temp_BadCMSIC__c != ''];
List <Account> Acc2Up = new List<Account>();
    for(Account acc : scope){
    IF(acc.Temp_BadCMSIC__c != NULL){
       acc.CMSIC8A__c = acc.Temp_BadCMSIC__c;
    }
    Acc2Up.add(acc);
}
Update Acc2Up;
}
}

// SICS obj = new SICS(); 
Id batchJobId = Database.executeBatch(new SICS(),200);
Thanks
RSM
 
I am trying to complete the "Adding Business Logic" portion of the Suggestion Box Module in Trailhead.  I keep getting the following error:
Challenge Not yet complete... here's what's wrong: 
Process builder failed to update the 'Status' on a Suggestion record. Please recheck the business process logic.

I have now redone the section about 5 different times.  The funny thing is that each time I delete it and redo it, I get the correct results in the dev org.  The date cannot go past today and once the implemented date is placed, the status automatically updates to Implemented.  Each time this has worked on each record I try or create.  I am not understanding why I am still getting this error.

How do I proceed?
I have more than 50000 records in production after applying all required filters to soql query. I have Used LIMIT, it is not helping. batch size, i have passed as 200 while execute. Still no go. I do not prefer to use Visualforce page with readonly= true. any better solution please..?

global class abc implements Database.Batchable<sObject>{
String strQuery='';     
global List<Opportunity> ListOfDeals = new List<Opportunity>();     
global List<Policy__c> listtobeUpdated = new List<Policy__c>();     
global map<string,Opportunity> Oppmap = new map<string,opportunity>();     
global Abc(){         strQuery ='SELECT Former_Policy__c,id,Opp__c FROM Policy__c WHERE Form_Policy__c != null AND opp__c = null AND Not_Belong_to_ABC__c=False AND Not_To_Be_Linked_To_Opp__c=False AND Stage__c !=Null AND Status__c != Null LIMIT 49000';     }              
global Database.QueryLocator start(Database.BatchableContext context) {                   
 return Database.getQueryLocator(strQuery);              }         global void execute(Database.BatchableContext context, List<Policy__c> policyBatch){             
  if(policyBatch.size()>0)
{              

AutoMatchRenewedPolicyHelper.autoMatchRenewedPolicy(policyBatch);          

}      
}
          global void finish(Database.BatchableContext context){     }      }
I 'm trying to import account records to partial sandbox and get an error code below.  Tested 10 records with successful import.  Now importng 517 records from same file and get this error  message.  What does this message mean? 
Thank you
User-added image
Hi,

I'm new to the SF scene, and have an Oracle background.
A reoccuring procedure I'm doing in Oracle is:
  • Execute a DML (insert, update, delete) statement
  • Check the correctness by executing a query (select) statement
  • If OK, I commit. If not, I rollback all DML
My question: is this way of working possible using Developer Console ? As I understand, DML statements are always commited. Unless you set some savepoint. Can I first execute some anonymous Apex with DML code preceded by a savepoint, then execute a select, then execute commit or rollback.
Or is there another way, maybe outside Developer Console, to handle this ?

One more question: is there a way to save/open scripts having anonymous Apex ?

Thanks,
Patrick
I have a summed value of 5.57, i want this value to be 5.75 (the next rounded quarter). If I try ROUND(5.57+.124, 2) this returns 5.69 not 5.75. What am I missing?
I want to get record by id without specifying record type. i have tried with following ways.

/services/data/v39.0/search/suggestions?q=00108000003ul2wAAZ&sobject=Account&account.fields=Id
/services/data/v39.0/search/?q=0010800000Abti7AAZ
/services/data/v39.0/search/?q=FIND {0010800000Abti7AAZ}
/services/data/v39.0/parameterizedSearch/?q=0010800000Abti7AAZ

are there any ways to get record by id?
Thanks in advance
So I just made my new TP, found the settings to rename it. clicked on the Launch your hands-on org after making sure it was the default hands on org and I get an error:
This site can’t be reached
cunning-raccoon-380385-dev-ed.lightning.force.com’s server DNS address could not be found.

I have my normal DE org connected as well and it takes me to the login page for that org where I can log in successfully. Not sure what I'm missing?
Any help is appreciated, Thanks!