• Ashok Rathva
  • NEWBIE
  • 25 Points
  • Member since 2015
  • Certified Salesforce Developer
  • ET Marlabs


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies
 "Locked filter" related error during check challenge of Report dashboards super badge. Attached screenshot please replay.
User-added image
Hi, I am getting problem to insert records into custom object's fields using batch class.

Scenario is user input's fields value (more than 100) and I stored into list variable (sqrList) now I want to insert that list variable (sqrList) data using batch execute method but from start method what I have to pass. There is no error but record is not inserted into object.

Please help me.
 
List <Answer__c> sqrList = new List<Answer__c>();
for (question q : allQuestions)
        {
          Answer__c sqr = new Answer__c();
           
            if (q.renderSelectRadio == 'true')
            {
                
                if (q.required &&  (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.singleOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
            }
            else if (q.renderFreeText == 'true')
            {
                if (q.required && q.choices == '')
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                System.debug('*****Select Radio ' + q.choices);
                
                sqr.Response__c = q.choices;
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
                System.debug('*****Test List ----- ' + sqrList);
                
            }
            else if (q.renderSelectCheckboxes == 'true')
            {
                if (q.required && (q.selectedOptions == null || q.selectedOptions.size() == 0))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                for (String opt : q.selectedOptions)
                {
                    sqr = new Answer__c();
                    if (opt == '' || opt == null)
                    {
                        sqr.Response__c = '';
                    }               
                    else
                    {   
                        sqr.Response__c = q.multiOptions.get(Integer.valueOf(opt)).getLabel();
                    }
                    sqr.Question__c = q.Id;
                    sqrList.add(sqr);
                }
            }
            else if (q.renderSelectRow == 'true')
            {
                if (q.required && (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.rowOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
            }


 
I have installed surveyForce package from app exchange. After create survey with questions more then 30 it will fire SOQL governor limit exceed How to resolve it please guide me below is code snipest. 

public void submitResults()
   {
        List <Survey_Answer__c> sqrList = new List<Survey_Answer__c>();
        for (question q : allQuestions)
        {
            Survey_Answer__c sqr = new Survey_Answer__c();
            if (q.renderSelectRadio == 'true')
            {
                
                if (q.required &&  (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.singleOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Survey_Question__c = q.Id;
                sqrList.add(sqr);
            }
            else if (q.renderFreeText == 'true')
            {
                if (q.required && q.choices == '')
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                System.debug('*****Select Radio ' + q.choices);
                
                sqr.Response__c = q.choices;
                sqr.Survey_Question__c = q.Id;
                sqrList.add(sqr);
            }
            else if (q.renderSelectCheckboxes == 'true')
            {
                if (q.required && (q.selectedOptions == null || q.selectedOptions.size() == 0))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                for (String opt : q.selectedOptions)
                {
                    sqr = new Survey_Answer__c();
                    if (opt == '' || opt == null)
                    {
                        sqr.Response__c = '';
                    }               
                    else
                    {   
                        sqr.Response__c = q.multiOptions.get(Integer.valueOf(opt)).getLabel();
                    }
                    sqr.Survey_Question__c = q.Id;
                    sqrList.add(sqr);
                }
            }
            else if (q.renderSelectRow == 'true')
            {
                if (q.required && (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.rowOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Survey_Question__c = q.Id;
                sqrList.add(sqr);
            }                       
        }
        if(AddSurveyTaker())
        {
            for (Survey_Answer__c sqr : sqrList)
            {
                sqr.SurveyTaker__c = surveyTakerId;
            }
            insert sqrList;         
            thankYouRendered=true;      
        }  
    }
 "Locked filter" related error during check challenge of Report dashboards super badge. Attached screenshot please replay.
User-added image
Hi All,

I am trying to assign dynamically rowcause reason to my custom objects but erroring out like below:

//Smaple Map Format
recordIdsMap.put(objetapiname, Record);




 for (String obj: recordIdsMap.keySet()) { //This will fetch names of objects defined in custom setting
    //if(i<10){
            if (obj.contains('__c')) {
            
                String objName = obj.split('__')[0];
                system.debug('---' + obj);
                access = 'AccessLevel';
                pId = 'ParentId';
                ShareObject = objName + '__Share';
                ShareObject2 = objName + '__Share';
                system.debug('PJJJJ' + ShareObject);
           }else {
                ShareObject = obj + 'Share';
                access = obj + 'AccessLevel';
                pId = obj + 'Id';
                system.debug('PJJJJ2' + ShareObject);
    }
    
    
  
   
            Schema.SObjectType sobjType = gd.get(ShareObject2);
            
         //Here are i am trying to get my Rowcausereason in string 
           //string RowcauseReason = Schema.sobjType.rowCause.ApexSharing__c;

            string RowcauseReason = Schema.ShareObject.rowCause.ApexSharing__c;

But its showing compile time error as below : 

Variable does not exist: Schema.sobjType.rowCause.ApexSharing__c at line 264 column 37    
Hi, I am getting problem to insert records into custom object's fields using batch class.

Scenario is user input's fields value (more than 100) and I stored into list variable (sqrList) now I want to insert that list variable (sqrList) data using batch execute method but from start method what I have to pass. There is no error but record is not inserted into object.

Please help me.
 
List <Answer__c> sqrList = new List<Answer__c>();
for (question q : allQuestions)
        {
          Answer__c sqr = new Answer__c();
           
            if (q.renderSelectRadio == 'true')
            {
                
                if (q.required &&  (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.singleOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
            }
            else if (q.renderFreeText == 'true')
            {
                if (q.required && q.choices == '')
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                System.debug('*****Select Radio ' + q.choices);
                
                sqr.Response__c = q.choices;
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
                System.debug('*****Test List ----- ' + sqrList);
                
            }
            else if (q.renderSelectCheckboxes == 'true')
            {
                if (q.required && (q.selectedOptions == null || q.selectedOptions.size() == 0))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                for (String opt : q.selectedOptions)
                {
                    sqr = new Answer__c();
                    if (opt == '' || opt == null)
                    {
                        sqr.Response__c = '';
                    }               
                    else
                    {   
                        sqr.Response__c = q.multiOptions.get(Integer.valueOf(opt)).getLabel();
                    }
                    sqr.Question__c = q.Id;
                    sqrList.add(sqr);
                }
            }
            else if (q.renderSelectRow == 'true')
            {
                if (q.required && (q.selectedOption == null || q.selectedOption == ''))
                {
                    Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please fill out all required fields'));
                    return;
                }
                
                if (q.selectedOption == null || q.selectedOption == '')
                {
                    sqr.Response__c = '';
                }
                else
                {
                    sqr.Response__c = q.rowOptions.get(Integer.valueOf(q.selectedOption)).getLabel();
                }
                sqr.Question__c = q.Id;
                sqrList.add(sqr);
            }


 
In class declaration if we don’t write keyword “with sharing” then it runs in system mode then why keyword “without sharing” is introduced in apex?

I'm currently testing out Survey Force from Force.com Labs http://appexchange.salesforce.com/listingDetail?listingId=a0N30000003I2gDEAS

I
've manage to install, deploy and create my first survey, however when I select 'Email link with Contact & Case merge' it is not finding any sites to expose to. The only option I have is internal despite the fact I have a site enabled with the required vforce pages.

I am doing this in a sandbox, would this cause this to happen?

If anyone can advise, I would be very grateful!

Cheers,

Graeme

  • February 23, 2012
  • Like
  • 0