• Satish Prajapat
  • NEWBIE
  • 216 Points
  • Member since 2017
  • Software Engg.
  • Cloud Chillies

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 20
    Questions
  • 63
    Replies
Hi All,
I have written code for check box select all functionality. It is working, but is having one issue please help me. I am sharing my code.
public class Mainclass{
 public WrapperClass viewWrapper {get;set;}
public void SelectAll(){

    
        if(viewwrapper.check){
            for(WrapperClass.SearchItem s : viewWrapper.resultList)
            {
                s.checked = true;
            }
        }
        else
        {
            for(WrapperClass.SearchItem s : viewWrapper.resultList)
            {
                s.checked = false;
            }
            
        }        
       
    }
}
 
public class WrapperClass 
{
 public Boolean check{get;set;}
  public List<SearchItem> resultList{ get; set; }
  public class SearchItem {
    public Boolean checked{ get; set; }
	\\ some other fields are also there
	
	}
	}
 
<apex:page>
<apex:form>
<apex:coloumn>
<apex:facet>
<apex:inputCheckbox style="margin:2px;" value="{!viewWrapper.check}">
                            <apex:actionSupport action="{!selectAll}" event="onclick" reRender="resultsBlock"/></apex:inputCheckbox>
                        </apex:facet>
</apex:coloumn>
</apex:form>
</apex:page>

Here if I check main check box, it is selecting all checkboxes under it. If I am unselecting all, it is unselecting all.
But issue is, If I unselect any check box from result check box main checkbox is not getting unselected. the below image is reference. 1st check is main check box. when I deselect 3rd checkbox the 1st one should uncheck. right now it is not happening. Please help me

User-added image
Thanks in Advance
Hi All,
I am working with the Create Object-Specific Quick Actions Challenge.

Challenge:
Your brokers want to capture the feedback of their potential buyers after they look at a property. Create a quick action on the event object so brokers can update an event with their notes immediately after a showing. Add the action to the publisher for the Showing layout.
Create a quick action for the event object
Action type: Update a Record
Label: Enter Feedback
Remove all the fields on the page layout except for Name
Put the Feedback field on the page layout
Add the Enter Feedback quick action to the publisher for the Showing Layout. You might have to override the predefined actions in the Salesforce1 section of the publisher.

Error:
Error:The 'Name' and 'Feedback' fields either do not appear on the new action page layout or they are not the only fields present.

I tried to put the Feedback field on the page layout but couldn't find it and couldn't create one. But I added the Enter Feedback quick action(with Name Field) to the publisher for the Showing Layout.

Can somebody help me complete the challenge?

Thanks,
Venkata
I need help on the following requirement as follows,

I have a text field called "Latest date" which has values in "March -2017" format

I want another formula field to convert the above text to dd/mm/yyyy format


The date can be 1st of every month

I shouldnt make any changes to the existing field and need this functionality in  a new field

Help me how to acheive this

Thanks in Advance
Hi All,

I have created custom fields Credit_Card_Name__c, Credit_Card_Number__c in Contact object. And i have created one custom object - Credit_Card__c with fields Name, Card_Holder_Email__c, Credit_Card_Number__c. 
I have created one custom button (name: Credit Card) on contact object of type (Display Type: Detail Page Button, Content Source: Visualforce Page).
I have inserted the records for Credit Card object.

When I click on custom button (name: Credit Card), I want to retrieve and display only those records which are related to Contact email in the form PageBlockTable with Radio buttons. After selecting one credit card, those details should be displayed in Contact object fields Credit_Card_Name__c, Credit_Card_Number__c. Please help to achieve this.

Below is the controller & vf page i tried.

public Class ContactCreditDetailsPage
{


    public Contact con {get; set;}
    public List<Credit_Card__c> ccard {get; set;}
    
    public ContactCreditDetailsPage(ApexPages.StandardController stdCtr)
    {
        con = (Contact)stdCtr.getRecord();
        con = [select id, email from contact limit 1];
       
    }
    
    public List<Credit_Card__c> getRecords()
    {
         ccard = new List<Credit_Card__c> ();
        List<Credit_Card__c> results= [select Card_Holder_Email__c, Name, Credit_Card_Number__c from Credit_Card__c where  Card_Holder_Email__c=: con.Email]; //where Card_Holder_Email__c=: con.Email
        return results;
    }
    

}

VF page:
<apex:page standardController="Contact" extensions="ContactCreditDetailsPage" >
  <apex:form >
      <apex:pageBlock >
         <apex:pageBlockTable value="{!Records}" var="cc">
             <apex:column value="{!cc.Card_Holder_Email__c}"/>
              <apex:column value="{!cc.Credit_Card_Number__c }"/>
              <apex:column value="{!cc.Name}"/>
              
         </apex:pageBlockTable>
      </apex:pageBlock>
  </apex:form>
</apex:page>

Thanks
 
When I was trying to get the ObjectList from lightning component in Apex. I deserialize the String and I am getting the error below:
FATAL_ERROR System.JSONException: QueryResult must start with '{' in salesforce
#For Creation of the community user from contact.
getting error:
Error: Allow Forecasting is not allowed for this License Type.
#For Community user creation
On contact record layout Manage external user button is not visible:
 
How chart tip rendererFn function works:
This is the post for every one who want to work with charttip.
Here is the simple code which give Idea:
function renderChartTip(klass, item) { 
        
        
        var m = item.storeItem;
        console.log('m.data' + JSON.stringify(m.data));
        var lyd = JSON.stringify(m.data);
        
        //$j.each(m.data, function(key, value) {
            //console.log(key+"  "+value);
        // });
        
        var xAxisName = item.storeItem.get('xAxisName');
        var yAxisName = item.storeItem.get('yAxisName');
        var xAxisValue = m.get('name');
        
        var Total = item.storeItem.get('twoYearsPriorInvoiced') + item.storeItem.get('lastYearInvoiced') + item.storeItem.get('thisYearInvoiced');
        var percentageValue = m.get(item.yField);
        var colorCode,yearName;
        if(item.yField == 'twoYearsPriorInvoiced'){
            colorCode = '#349DE2';
            yearName = 'Two Year Prior Invoiced';
        }else if(item.yField == 'lastYearInvoiced'){
        	colorCode = '#1B2F5D';
            yearName = 'Last Year Invoiced';
        }else if(item.yField == 'thisYearInvoiced'){
        	colorCode ='#82DFD9';
            yearName = 'This Year Invoiced';
        }
		percentageValue = percentageValue/Total;
        percentageValue = (percentageValue *100).toFixed(2);
        Total = Total *1000;
        //this.setTitle(m.get('name'));
        this.setTitle(xAxisName);
        this.update(''
          + '<table>'
          + '<tr><td><b></b>&nbsp;</td><td>' + xAxisValue + '</td></tr>'
          + '</table>'
          + '<table>'
                    + '<tr>&nbsp;<div style="border-left:5px solid '+colorCode+';height:28px;margin-left:4px"><b>&nbsp;&nbsp;'+yearName+'</b></div></tr>'
                    //+ '<tr class = \'sumOfSTAR_Text\'><td><b></b>&nbsp;</td><td>' + item.yField +'&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>'        
          + '<hr>'
          + '<tr class = \'sumOfSTAR_Text\'><td><b></b>&nbsp;</td><td>' + yAxisName +'&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>'
          + '<tr><td><b></b>&nbsp;</td><td>( ' + percentageValue + '% of '+ Total +' for '+ xAxisValue +' )</td></tr>'
          + '</table>'
        );
      }
Visualforce page :
<apex:chart data="{!data}" height="400" width="745" resizable="true" id="Myid">
        <apex:legend position="bottom" font="14px Helvetica"/>
        <apex:axis id="YaxisId" type="Numeric" position="left" grid="true" fields="twoYearsPriorInvoiced,lastYearInvoiced,thisYearInvoiced" title="Sum of STAR Total Invoiced" steps="4" minimum="0" dashSize="3" >     
            <!--<apex:chartLabel />-->
        </apex:axis>
        <apex:axis type="Category" position="bottom" fields="name" title="STAR Job Date" dashSize="0"/>
        <apex:barSeries orientation="vertical" axis="left" stacked="true" showInLegend="true" groupGutter="10" highlight="false"
            xField="name" yField="twoYearsPriorInvoiced,lastYearInvoiced,thisYearInvoiced" xPadding="{!xPadding}" title="TwoYearPriorInvoiced,LastYearInvoiced,ThisYearInvoiced" colorSet="#349DE2,#1B2F5D,#82DFD9">
            <apex:chartTips height="160" width="415" id="tip"  rendererFn="renderChartTip" trackMouse="true"  />
        </apex:barSeries>
    </apex:chart>


 
Hello Experts,
I have big object, and I am inserting data from the batch class into big object. When I run test it give me error :
"Internal Salesforce Error: 1347441463-30 (-83575418) (-83575418)"
When I insert data from anonymous console than it inserted successfully, but test is failed.
So, how to deal with this problem.
 
Hello Experts,
I have awritten apex class in which is i have used SOQL on Big Object. 
For that I want to write test class but I am not able write the test data for big object.
getting error : unsupported external object operations
List<BigObjectTaskData__b> BigObjectTaskData_ListObject = new List<BigObjectTaskData__b>();
        try{
            
            
            
            BigObjectTaskData__b bObject = new BigObjectTaskData__b();
           // bObject.Id = '0015D000006AsuNQAS';
            bObject.Task_Created_Date__c = System.today();
            bObject.whatId__c = '0015D000006AsuNQAS';
            bObject.Task_Created_By__c =  'Test';
            bObject.whoId__c = '';
            bObject.RecordType__c = 'tests havsc';
            
            bObject.Task_OwnerId__c = '0015D000006AsuNQAS';
            bObject.Task_Status__c = 'test data';
            bObject.Task_Priority__c = 'test data';
            bObject.Task_Due_Date__c = System.today();
            bObject.Task_Subject__c = 'Test Data';
            bObject.Task_Comments__c = 'Test Data';
            
            bObject.Task_Call_Duration__c = 15;
            bObject.Task_Related_Record__c = 'Test Data';
            bObject.Task_Call_Regarding__c = 'Test Data';
            bObject.Task_Result__c = 'Test Data';
            bObject.Task_Reason__c = 'Test Data';
            
            bObject.Task_Last_Modified_date__c = System.today();
            bObject.Task_Last_Modified_by__c = 'test data';
            
            bObject.Task_Owner_name__c = 'Test';
            bObject.Task_parent_Name__c = 'tname';
            bObject.Task_related_to__c = 'leObj';
            
            BigObjectTaskData_ListObject.add(bObject);
//            insert BigObjectTaskData_ListObject;
            database.insertImmediate(BigObjectTaskData_ListObject);
//            Obj1.bigObjectDataList.addAll(BigObjectTaskData_ListObject);
        }
        catch(Exception e)
        {
            System.debug('Exvception : '+e);
        }

Thanks in advance.
Hello experts,
I am trying to hit data using SOQL on bigobject,
Where accId:
public String accId;
List<BigObjectTaskData__b> tempList =  [select id from BigObjectTaskData__b where whoId__c =: accId];

So, I am getting error in where clause(where whoId__c =: accId)
If I do not use (where whoId__c =: accId) it works
And if use where clause like (where whoId__c ='0035D000006FdfWQAS'), So it works well.

help me, how to pass "accId" variable value in where clause??
Hello Experts,
I want to perform integration between Salesforce and the MongoDB without purchasing any tools.
there are several tools in the markets are available which is paid per use concept.
So I want to know how they tools build.
I want to work in that direction.
Please provide the valuable information.
Thanks & Regards,
Satish Kr. Prajapat
I have 2 objects may be a standard or custom objects, I want to know which the parent or which is child object??

 
Hello All,
I have a list of Column Name. {f1, f2, f3 ,f4.......fn}
When I display the list then in front of every field value there are two picklist (List Of Object  &  List of fields of Selected Object)
///VF Page
f1          List Of Object         List of fields of selected Object
f2          List Of Object         List of fields of selected Object
f3          List Of Object         List of fields of selected Object
f4          List Of Object         List of fields of selected Object
.
.
.
fn          List Of Object         List of fields of selected Object

I want to implement that logic how can I do this.
I want Map<String,  Sobject>
where Key = 'ColumnName-SelectFieldName_from_picklist'    & Value = 'Select Object from Picklist'
example: key = 'f1 - LastName'      &     Value = 'Object'
How to update individual list of fields and getting Map.??
 
I have Map<String, String> m1 = ........;/(Map Contain only one record information)
And I want to update the record into account How can I do this?
 
I want to add custom new custom button on the home page(when I click on the lead tab) on lead.User-added image
If click on the back button on Browser then the previous page is loaded which shoul not be happen. So, what should I do hence i can manage sesion.
Hello Experts,
we are 5 people working on same project and all 5 have different task. All are working in single developer org. So, how can I identify the which developer change what in the org.
Please help.
Thanks and Regards.
Hello Experts,
I want to learn new in salesforce like Custom setting, Field Set or the thing which is dynamically and frequently used in salesforce project.
Actuclly my team manager is on busy in some work, and i have one week time so please suggest me some topics which will be useful in my project.
Thanks.
Hello Expert,
I am trying to display 2 graphs (bar and Pie) on radio button selection, but on change of radio button value the graph is not rendered or say not display.
// VF Page

<apex:page sidebar="false" showHeader="false"  controller="QuizSummaryGraphClass" >
    
    <apex:form id="formId">
        
        <apex:outputPanel>
            <apex:selectRadio value="{!graphType}">
                <apex:selectOptions value="{!items}" />
                <apex:actionSupport event="onchange" action="{!m2}" reRender="formId"  />
            </apex:selectRadio>
        </apex:outputPanel>
        
        <apex:outputPanel id="graph" >
            <c:barComponent  barVisibility ="{!block1}" />
            <c:pieComponent  pieVisibility ="{!block2}"/>    
        </apex:outputPanel>
        
    </apex:form>
</apex:page>

**************************************************
//Bar component

<apex:component controller="QuizSummaryGraphClass" >
    <apex:attribute name="barVisibility" description="This value used for bar visibility." type="Boolean" required="true">
    </apex:attribute >
    <apex:outputPanel id="bar" >
       
            <apex:pageBlock title="Bar Graphs"   rendered="{!barVisibility}"> 
                <apex:chart height="400" width="250" data="{!queryData}" >      
                    <apex:axis type="Numeric" position="left" minimum="0" maximum="{!total}" steps="1" fields="response" title="Total Number Of Questions" />
                    <apex:axis type="Category" position="bottom" fields="name" title="Candidate Response" >
                        <apex:chartLabel rotate="315"/>
                    </apex:axis>
                    <apex:barSeries orientation="vertical" axis="left" xField="name" yField="response"/>
                </apex:chart>
            </apex:pageBlock>
        </apex:outputPanel>
    
</apex:component>

********************************************
//Pie Component

<apex:component controller="QuizSummaryGraphClass"  >
    <apex:attribute name="pieVisibility" description="This value used for pie visibility."  type="Boolean" required="true">
    </apex:attribute>
     <apex:outputPanel id="Pie">
      
            <apex:pageBlock title="Pie Graphs" rendered="{!pieVisibility}"  > 
                <apex:chart height="410" width="350" data="{!queryData}" >      
                    <apex:pieSeries labelField="name" dataField="response"/>
                </apex:chart>
            </apex:pageBlock>
        </apex:outputPanel>
    
</apex:component>

************************************************
// Apex Class QuizSummaryGraphClass

public class QuizSummaryGraphClass 
{
    public String candidateName {get; set;}
    public List<Summary__c> summaryList {get; set;}
    public String summaryId {get; set;}
    public Integer total {get; set;}
    public String graphType {get; set;}
    public Boolean block1 {get;set;}
    public Boolean block2 {get;set;}
    public void QuizSummaryGraphClass ()
    {
        summaryList = new List<Summary__c>();
        summaryId = null;
        total = 0;
        graphType = 'bar';
        block1 = false;
        block2 = false;
    }
    public List<data> getqueryData()
    {
        summaryId = apexpages.currentpage().getparameters().get('summaryId');
        summaryList = [Select name,Corrected_Answer__c,Incorrect_Answer__c,	Total_Number_of_questions__c from  summary__c where id=:summaryId limit 1]; 
        List<Data> graphData = new List<Data>();
        graphData.clear();
        for(Summary__c sl : summaryList)
        {
            graphData.add(new Data('Correct Answer',sl.Corrected_Answer__c));
        	graphData.add(new Data('Incorrect Answer',sl.Incorrect_Answer__c));
            total = (Integer)sl.Total_Number_of_questions__c;
        }
        return graphData;
    }
    public List<SelectOption> getItems() 
    {
        List<SelectOption> options = new List<SelectOption>(); 
        options.add(new SelectOption('bar','bar')); 
        options.add(new SelectOption('pie','pie')); 
        return options;
    }
    public void m2()
    {
        if(graphType == 'bar')
        {
            block1 = true;
            block2 = false;
        }
        if(graphType == 'pie')
        {
            block1 = false;
            block2 = true;
        }
    }
    public with sharing class Data
    {
        public Decimal response {get; set;}
        public String name {get; set;}
        public Data(String name, Decimal response)
        {
            this.name = name;
            this.response = response;
        }
    }
}

 

When I was writting code in apex and related VF page, then automatically the API Version is changed from current(39) to 15.

If want to change then i can't so how its is changed ?

Is there any bug in salesforce Developer console.
 

public class QuizExcelFile 
{
    public List<QOA> listQOA {get;set;}
    public Integer count {get;set;}          // used for append the question number in question.
    public Integer correctAnswer {get;set;}  //number of correct answer.
    public Integer incorrectAnswer {get;set;}//number of incorrect answer.
    public Integer total {get;set;}          //total number of questions.
    public String firstname {get;set;}       // Firstname of candidate.
    public String lastname {get;set;}        // Lastname of candidate.
    public String contact {get;set;}         //Contact number of candidate.
    public String email {get;set;}           //Email address of candidate.
    public Boolean block1 {get;set;}         // Registration block rendered value.
    public Boolean block2 {get;set;}         // Quiz block rendered value.
    public Boolean block3 {get;set;}         //Result block rendered value.
    public Id quizId {get;set;}              //store id of quiz save from url.
    public Contact conObj { get; set; }      //contact Object for retrieving the value of field Set at the time of user registration.
    
    public QuizExcelFile()                   //Controller
    {
        block1 = true;              //deault value is true for registration block.
        block2 = false;             //deault value is false for Quiz block.
        block3 = false;             //deault value is false for result block.
        firstname = null;           //Candidate firstname is null by default.
        lastname = null;            //Candidate lastname is null by default.
        contact = null;             //Candidate cotatact is null by default.
        email = null;               //Candidate Email Address is null by default.
        correctAnswer = 0;          //Initialized zero to the correct answer.
        incorrectAnswer = 0;        //Initialized zero to the incorrect answer.
        total = 0;                  //Initialized zero to the total number of question.
        count = 0;                  //Initialized zero to the count value.
        listQOA = new List<QOA>();//Initialized the list of QOA wrapper class type.
        conObj = new Contact();   // Initialize the contact object.
    }   
    public List<Schema.FieldSetMember> getFields() 
    {
    	return SObjectType.Contact.FieldSets.Quiz_Field_Set.getFields();
    }
    
   
public void initializedLogic()
    {
        //Retriving the quid Id named "quizId" from Url used in the formula field.
        quizId = apexpages.currentpage().getparameters().get('quizId');
        //Checking the Quiz is active or not by API name of Field "Active__c".
        List<Quiz__c>  quizList = [select Active__c, name from Quiz__c where id=:quizId ];
        String str = quizList.get(0).Active__c +'';
        if(str.equals('false')) //If Checkbox is not active, the generate Error Message on VF page.
        {
            //Error Message
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Quiz is not Activated please contact your administrator..!!!'));
            block1 = false;//Set all block Hide.
            block2 = false;
            block3 = false;
        }
        else
        {
            //Getting the record from the Latest file placed in atttachment of corresponding Quiz.
            List<Attachment> attachmentList = [Select Id,body From Attachment where ParentId=:quizId order by LastModifiedDate desc limit 1];
            if(attachmentList.size() == 0) // If no Attachment is found then generate error.
            {
                //Error Message
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Quiz is not Activated please contact your administrator..!!!'));
                block1 = false;//Set all block Hide.
                block2 = false;
                block3 = false;
            }
            else
            {
                String contents = attachmentList.get(0).body.toString();// Convert body into single String.
                
                for(String lines : contents.split('\n')) //Split the whole string based on the nextLine or newLine.
                {
                    String question = null;//Temporary question is stored here.
                    List<SelectOption> option_List = new list<SelectOption>();//Temporary all Option are stored in this List.
                    String answer = null;//Temporary answer is stored into the this variable.
                    count++;//increase count number, for next question number.
                    String[] qOptionArray= lines.split(',');//Split the line based on the value, which are saved in Excel file.
                  
                    question = Integer.valueOf(count) +'. '+ qOptionArray[0];
                    for(Integer i = 1; i<(qOptionArray.size() - 1); i++) 
                    {
                        if(qOptionArray[i].length() > 0)
                        {
                            option_List.add(new SelectOption(qOptionArray[i],qOptionArray[i]));
                        }
                    }
                    
                    answer  = qOptionArray[qOptionArray.size()-1];
                    
                    listQOA.add(new QOA(question,option_List,answer));
                }
            } 
        }
    }
    
    
    public void startTest()
    {
        
        block1 = false;
        block2 = true;
        block3 = false;
       
        firstname = conObj.FirstName;
        lastname = conObj.LastName;
        contact = conObj.Phone;
        email = conObj.Email;
        List<contact> conList1 = new List<Contact>();//List is used to insert the record.
        
        List<contact> conList2 = [Select Id, name from contact where Email=:conObj.email];
        conList2.add(conObj);
        if(conList1.size() > 0 && conList2.size() == 0)
        {
            if(conList2.size() == 0)
            {
                //Insert record
                insert conList1;
            }
            else
            {
                //Update Record
                update conList2;
            }
        }
        
    }
   
    public void check()
    {
        //validate the answer with user response.
        for(QOA tempList1:listQOA)
        {
            if(tempList1.Answer.equals(tempList1.response))
            {
                correctAnswer++;//Icnrease counting when correct answer.
            }
            else
            {
                incorrectAnswer++;//Increase counting when incorrect answer
            }
        }
        total = listQOA.size();//Total number of Question is equal to the list size.
        
        block1 = false;
        block2 = false;
        block3 = true;
        
        List<contact> conList3 = [Select Id, name from contact where Email=:conObj.email];
        // Creating temporary List Object of "Summary__c" Object.
        List<Summary__c> SummaryListObj1 = new List<Summary__c>();
        // Getting total number of Summary__c record whose contact is created or updated recently.
        List<Summary__c> SummaryListObj2 = [Select Id, name from Summary__c where Contact__c=:conList3.get(0).Id];
        Summary__c SummaryObj1 = new Summary__c();
        SummaryObj1.Name = SummaryListObj2.size()+1+'';
        SummaryObj1.Contact__c = conList3.get(0).Id;
        SummaryObj1.Corrected_Answer__c = correctAnswer;
        SummaryObj1.Incorrect_Answer__c = incorrectAnswer;
        SummaryObj1.Total_Number_of_questions__c = total;
        SummaryListObj1.add(SummaryObj1);
        if(SummaryListObj1.size() > 0)
        {
            insert SummaryObj1;
        }        
        List<Question__c> Q_list = new List<Question__c>();
        for(QOA tempList2:listQOA)
        {	
            Question__c queObj = new Question__c();
            Id id1 = SummaryObj1.id;
            queObj.Name = tempList2.Question.split('\\.')[0];
            queObj.Question__c = tempList2.Question.split('\\.')[1];
            queObj.Response__c = tempList2.response;
            queObj.Answer__c = tempList2.Answer;
            queObj.Summary__c = id1;
            String str = '';
            for(SelectOption tempList3: tempList2.Options)
            {
            	str = str + tempList3.getLabel() + '; ' ; 
            }
            queObj.Options__c = str;
            Q_list.add(queObj);
        }
        insert Q_list;
    }
    public with sharing class QOA
    {
        public String question {get;set;}
        public List<SelectOption> Options {get;set;}
        public String answer {get;set;}
        public String response {get;set;}
        public QOA(String que, List<SelectOption> list_Options, String ans)
        {
            Question = que;
            Options = list_Options;
            Answer = ans;
        }
    }
}

 
Hello Experts,
  • I have one apex class and I displaying the list of fileds from FieldSet on VF page.
  • There are some input fields, which i want in my apex code.
    <!-- VF Page Snippet-->
    *******
    *******
    <apex:repeat value="{!fields}" var="f">
          <apex:outputText value="{!f.Label}"/>
          <apex:inputText WHAT_LOGIC_I_SHOULD_USE_HERE />  <br/>
    </apex:repeat>
    *******
    *******
    
    /* Apex Code Snippet  */
    
    public List<Schema.FieldSetMember> getFields() 
    {
          return SObjectType.Contact.FieldSets.Quiz_Field_Set.getFields();
    }
  • Whatever values I put into Input Text Box, that all value I want into my Apex Code.
  • I have class A and I want to display List<A> on VF Page.
  • // Class A
    public with sharing class A
    {
        public String p;
        public String q;
        public String r;
        public String s;
        public String t;
    }
    
    // My Apex Code
    public class MyApexClass
    {
        public void m1()
        {
            StaticResource sr = [select id,body from StaticResource Where Name = 'MyFile'];
            String contents = sr.body.toString();
            List<A> list_obj = new List<A>();
            for(String line : contents.split('\n')) 
            {
                String[] myArray= line.split('#');
                A a = new A();
                a.p = myArray[0];
                a.q  = myArray[1];
                a.r  = myArray[2];
                a.s  = myArray[3];
                a.t  = myArray[4];
                list_obj.add(a) ;
            }
        }
    }

     

 
When I was trying to get the ObjectList from lightning component in Apex. I deserialize the String and I am getting the error below:
FATAL_ERROR System.JSONException: QueryResult must start with '{' in salesforce
public with sharing class APTS_UOMConversionTriggerHandler implements ITriggerHandler {
  public static Boolean isTriggerDisabled = true;
  public class ApplicationException extends Exception {}
  
  public Boolean isDisabled(){
     try{
         Boolean disabled=false;
         if (TriggerSettings__c.getInstance().UOMConversionTrigger__c) {
           disabled=false;
         } 
         else {
           disabled=isTriggerDisabled;
         }
       return disabled;
     }catch(Exception e) {throw new ApplicationException(e);}
    }
  
    public void beforeInsert(List<SObject> newUOMConversionList){
      /
    } 
 
    public void beforeUpdate(List<SObject> newUOMConversionList, Map<Id, SObject> newUOMConversionMap, List<SObject> oldUOMConversionList, Map<Id, SObject> oldUOMConversionMap){
      
    }
    
    public void beforeDelete(List<SObject> oldUOMConversionList, Map<Id, SObject> oldUOMConversionMap){
      
    }
 
    public void afterInsert(List<SObject> newUOMConversionList, Map<Id, SObject> newUOMConversionMap){
      //Logic to check if the product is active and it is newly inserted.If so will trigger digital pricing
      try{
        onAfterInsertUOMConversion((List<APTS_UOM_Conversion__c>)newUOMConversionList);  
      }catch(DmlException e) {throw new ApplicationException(e);}

    }
  
    public void afterUpdate(List<SObject> newUOMConversionList , Map<Id, SObject> newUOMConversionMap, List<SObject> oldUOMConversionList, Map<Id, SObject> oldUOMConversionMap){
       //Logic to check if the product's isactive field has changed.If so will trigger digital pricing
      try{
        onAfterUpdateUOMConversion((Map<Id, APTS_UOM_Conversion__c>)newUOMConversionMap,(Map<Id, APTS_UOM_Conversion__c>)oldUOMConversionMap);
      }catch(DmlException e) {throw new ApplicationException(e);}
    }
    
    public void afterDelete(List<SObject> oldUOMConversionList, Map<Id, SObject> oldUOMConversionMap){
     
    }
  
    public void afterUndelete(List<SObject> newUOMConversionList, Map<Id, SObject> newUOMConversionMap){
      
    }
    
     public static void onAfterInsertUOMConversion(List<APTS_UOM_Conversion__c> newUOMConversionList){
        try{
         Set<Id> uOMConversionIdsToBeSentToSAPPO=  new Set<Id>();
           for(APTS_UOM_Conversion__c prodTrans:newUOMConversionList){
               if(prodTrans.APTS_Product_Active__c){
                  uOMConversionIdsToBeSentToSAPPO.add(prodTrans.APTS_Product__c);   
               }    
           }
           
           if(!uOMConversionIdsToBeSentToSAPPO.isEmpty()){
             APTS_IntegrationLogHandlerUtility.createIntegrationLogs(uOMConversionIdsToBeSentToSAPPO);      
           }
         }catch(Exception e) {throw new ApplicationException(e);}
     }
   
    public static void onAfterUpdateUOMConversion(Map<Id, APTS_UOM_Conversion__c> newUOMConversionMap,Map<Id, APTS_UOM_Conversion__c> oldUOMConversionMap){
        try{
    Set<Id> uOMConversionIdsToBeSentToSAPPO=new Set<Id>();
        List<Schema.FieldSetMember> relatedFieldSet=new List<Schema.FieldSetMember>();
        relatedFieldSet=APTS_IntegrationLogHandlerUtility.readFieldSet('APTS_UOMFieldsForDigitalProdIntegration','APTS_UOM_Conversion__c');    
        //List<Product2> productsToBeSentToSAPPO=  new List<Product2>();
           for(Id prodId:newUOMConversionMap.keySet()){
               if(newUOMConversionMap.get(prodId).APTS_Product_Active__c && 
                   APTS_IntegrationLogHandlerUtility.checkIfValidToSend(newUOMConversionMap.get(prodId),oldUOMConversionMap.get(prodId),relatedFieldSet)){
                      uOMConversionIdsToBeSentToSAPPO.add(newUOMConversionMap.get(prodId).APTS_Product__c);   
               }    
           }
           
           if(!uOMConversionIdsToBeSentToSAPPO.isEmpty()){
             APTS_IntegrationLogHandlerUtility.checkAndCreateIntegrationLogs(uOMConversionIdsToBeSentToSAPPO);      
           }
        }catch(Exception e) {throw new ApplicationException(e);}
     }
}
Thanks
 

Hi..,
I have a apex class in that i'm getting session form visualforce page, for that class i should have to write a test class

I'm using the pagereference  ad it's covering the my class 61%..

So could you please how to create a dummy test data for a visualforce page in Test class..

 

Thanks..,

Sri Hari

Hi All

I have a custom requirement.I have created a PDF uisng vf page.in PDF it is fecthing data with table format.customer want to reorder the row and print the PDF with customized reoder format.I have tried ,but it is not updating the PDF..Can anyone help me.
<apex:page standardController="Quotation_Line_Item__c" extensions="RelatedListController" sidebar="true" showHeader="false" lightningStylesheets="true" docType="html">     

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../demo.css" type="text/css" rel="stylesheet" />

<!-- Bootstrap CSS -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />

<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

<!-- jQuery UI CSS -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {
    //Helper function to keep table row from collapsing when being sorted
    var fixHelperModified = function(e, tr) {
        var $originals = tr.children();
        var $helper = tr.clone();
        $helper.children().each(function(index)
        {
          $(this).width($originals.eq(index).width())
        });
        return $helper;
    };

    //Make diagnosis table sortable
    $("#diagnosis_list tbody").sortable({
        helper: fixHelperModified,
        stop: function(event,ui) {renumber_table('#diagnosis_list')}
    }).disableSelection();


    //Delete button in table rows
    $('table').on('click','.btn-delete',function() {
        tableID = '#' + $(this).closest('table').attr('id');
        r = confirm('Delete this item?');
        if(r) {
            $(this).closest('tr').remove();
            renumber_table(tableID);
            }
    });

});


//Renumber table rows
function renumber_table(tableID) {
    $(tableID + " tr").each(function() {
        count = $(this).parent().children().index($(this)) + 1;
        $(this).find('.priority').html(count);
    });
}



</script>

<style type="text/css">
.ui-sortable tr {
    cursor:pointer;
}
        
.ui-sortable tr:hover {
    background:rgba(244,251,17,0.45);
}

</style>

</head>

<body>

<div id="content" class="container">

            <table class="table" id="diagnosis_list" >
                <thead>
                    <tr><th>Action</th><th>Quote Product Line Item Name</th><th>Basic Unit Price</th><th>Quantity </th><th>Size </th></tr>
                </thead>
                
                <tbody>
                 <apex:repeat value="{!contacts}" var="c" >
                    <tr><td class='priority'>1</td><td>{!c.Name}</td><td>{!c.Basic_Unit_Price__c}</td><td>{!c.Quantity__C}</td><td>{!c.Size__c}</td><td><a class='btn btn-delete btn-danger'>Delete</a></td></tr>
                   </apex:repeat>
                </tbody>
                 
            </table>

</div>

</body>
</html>



    <apex:form >                 

        
        
    </apex:form>  

</apex:page>
Hi All,
I have written code for check box select all functionality. It is working, but is having one issue please help me. I am sharing my code.
public class Mainclass{
 public WrapperClass viewWrapper {get;set;}
public void SelectAll(){

    
        if(viewwrapper.check){
            for(WrapperClass.SearchItem s : viewWrapper.resultList)
            {
                s.checked = true;
            }
        }
        else
        {
            for(WrapperClass.SearchItem s : viewWrapper.resultList)
            {
                s.checked = false;
            }
            
        }        
       
    }
}
 
public class WrapperClass 
{
 public Boolean check{get;set;}
  public List<SearchItem> resultList{ get; set; }
  public class SearchItem {
    public Boolean checked{ get; set; }
	\\ some other fields are also there
	
	}
	}
 
<apex:page>
<apex:form>
<apex:coloumn>
<apex:facet>
<apex:inputCheckbox style="margin:2px;" value="{!viewWrapper.check}">
                            <apex:actionSupport action="{!selectAll}" event="onclick" reRender="resultsBlock"/></apex:inputCheckbox>
                        </apex:facet>
</apex:coloumn>
</apex:form>
</apex:page>

Here if I check main check box, it is selecting all checkboxes under it. If I am unselecting all, it is unselecting all.
But issue is, If I unselect any check box from result check box main checkbox is not getting unselected. the below image is reference. 1st check is main check box. when I deselect 3rd checkbox the 1st one should uncheck. right now it is not happening. Please help me

User-added image
Thanks in Advance
#For Creation of the community user from contact.
getting error:
Error: Allow Forecasting is not allowed for this License Type.
#For Community user creation
On contact record layout Manage external user button is not visible:
 
HI All 

Looking for a good "allrounder"  for Project support in Global Roll out, 8-9 month contract experienced Business Analyst prefered . Supporting live users, writing requirments, testing, project planning and follow up etc.

Thanks
 
Hello Experts,
I have big object, and I am inserting data from the batch class into big object. When I run test it give me error :
"Internal Salesforce Error: 1347441463-30 (-83575418) (-83575418)"
When I insert data from anonymous console than it inserted successfully, but test is failed.
So, how to deal with this problem.
 
I have used Database.insertImmediate(objOppSplitHistories); method to insert/update records into OppSplitHistories (my custom big object).
Here I have used the above method in apex class and called that method from oppsplit trigger to pass the old map/new map info for saving opp splits changes. But that is throwing the below error. I have observed if I run the same piece of code in ‘Execute Anonymous Window’ then data is  being inserted in to custom big object but despite using insertImmediate method it is not working through trigger.

Error: Update failed. First exception on row 0 with id 049c0000002JaopAAC; first error: UNKNOWN_EXCEPTION, EXTERNAL_OBJECT_UNSUPPORTED_EXCEPTION: Apex triggers can't reference the Big Object BigObjectCounter: []

It seems we cannot populate any bigobject through trigger . Can you please confirm whether my understanding is correct or not.
If it is correct then what should be our approach to populate this big object? Any help will be much appreciated. 
  • November 21, 2017
  • Like
  • 0
Hi all,

I have an apex callouts class taht invokes an external webservice.We have been using the SOAP API.
So i have imported the wsdl in salesforce and trying to invoke the autogenerated apex class.
However i get an error as:Read timeout Exception

Then i try to set the timeout as under and then invoke the webservice as below:
public class OrderCallOuts
{

    @future(callout=true)
    public static void sendOrders(String orderId)
    {
      try
      {
          
          //creating stub
          SfdcDirectordersinbound.MIOS_SFDC_DIRECT_ORDERPort  createOrder=new  SfdcDirectordersinbound.MIOS_SFDC_DIRECT_ORDERPort();
        
          //declaring the response element
          String callOutResponse='';
       
           // providing the credentials and setting the header
           createOrder.inputHttpHeaders_x=new Map<String,String>();
           String username = 'salerep1';
           String password = 'Pass_1235';  
           Blob headerValue = Blob.valueOf(username+':'+password);
           String authorizationHeader = 'Basic ' +EncodingUtil.base64Encode(headerValue);
           createOrder.inputHttpHeaders_x.put('Authorization',authorizationHeader);

          //setting the timeout           
          createOrder.timeout_x=120000;
           
          //Invoking the webservice to send orders from Salesforce  
          callOutResponse=createOrder.MIOS_SFDC_DIRECT_ORDER(myOrder.CreatedBy.name,myOrder.LastModifiedBy.name);
                                                
          System.debug('Response from SAP system:'+callOutResponse);
     }
     catch(Exception ex)
     {
         System.debug('*** Error'+ex);
     }     
    }
    
}


After executing the above code i get the below error:
*** ErrorSystem.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Server Error faultcode=SOAP:Server faultactor=

Can anyone please help?

Thanks
We have a Salesforce connector for API version 26 as well as 28 for extracting the data using corresponding WSDL from a Salesforce Org. We are able to get objects and extract data for customer which does not use branded Cloudforce URL.

But We are facing issue when we try to extract the data from a Salesforce Org which has branded cloudforce URL.

We get Transport error: 411 Error: Length Required when trying get objects for user and when we try to extract the data.

Following is code snippet where we are getting this error(It gives above error when we call stub.describeGlobal(..)) :

stub = createStub();  
DescribeGlobal describeGlobal = new DescribeGlobal();
PackageVersionHeader packageVersionHeader = new PackageVersionHeader();
DescribeGlobalResponse dgrs = stub.describeGlobal(describeGlobal, sessionHeader, co, packageVersionHeader);

It fails with following Error from salesforce side:

Transport error: 411 Error: Length Required
...
at com.sforce.soap.partner.SforceServiceStub.describeGlobal(SforceServiceStub.java:10059)

Note: we are passing sessionHeader,CallOptions correctly.
Code Snippet for same:
Options options = stub._getServiceClient().getOptions();
String SFDCClientID = getBirstParameter(SFDC_CLIENT_ID);
if (SFDCClientID != null && SFDCClientID.trim().length() > 0)
{
co = new CallOptions();
co.setClient(SFDCClientID);           
}

SforceServiceStub stub = new SforceServiceStub(stubServerUrl);
Options options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
options.setTimeOutInMilliSeconds(timeoutInMilliseconds);
options.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Constants.VALUE_TRUE);


Also Note that we use SOAP API and use WSDL to provide us the default login URL for to connect and upon connect, we use the URL return by the Salesforce for data extraction.

Can someone suggest us on how we can fix this issue.
Hi Guys,

Am posting json text data from google advanced rest api client,but it throws error like :503 Service Unavailable

It is the Data am giving : {"rewardamnt"="15000","active_or_inactive": "true"}

Content-Type :application/json

MY URL :https://quinnoxspm-developer-edition.na15.force.com/WebMethods/services/apexrest/RewardCreation

https://quinnoxspm-developer-edition.na15.force.com -->Force.com site URL

WebMethods-->Site Name

services/apexrest-->Common for apex rest resource

RewardCreation--->My controller having urlmapping.

i have four tabs developed on my visualforce page with two buttons on each page i.e previous and next button . i want to have a functionality on click of previous and next button to show the user that the page is loading until the page is fully loaded . how can this be done ?

Thanks in advance

I spend one day and could not fix this problem. when I run these code below in it throw the error: Status=Length Required, StatusCode=411, Please help me to take a look at it. Thanks very very much.

 

the code is:

String endpoint = 'http://www.websequencediagrams.com/index.php?';
String httpMethod = 'POST';
String paramStyle = 'style=earth';
String paramMessage = '&message=test';
HttpRequest request = new HttpRequest();
request.setEndpoint(endpoint + paramStyle + paramMessage);
request.setMethod(httpMethod);
request.setTimeOut(6000);
request.setHeader('Charset', 'UTF-8');
request.setHeader('Content-Length', '-1');
request.setHeader('Content-Type', 'text/plain');
HttpResponse response = new Http().send(request);
if(response.getStatusCode() >= 200 && response.getStatusCode() < 400)
{
system.debug(response.getBody());
}
else
{
system.debug(response.getBody());
} 

the bug is:

<P>
Some aspect of the HTTP Request is invalid.  Possible problems:
<UL>
<LI>Missing or unknown request method
<LI>Missing URL
<LI>Missing HTTP Identifier (HTTP/1.0)
<LI>Request is too large
<LI>Content-Length missing for POST or PUT requests
<LI>Illegal character in hostname; underscores are not allowed
</UL>
  • June 20, 2012
  • Like
  • 0
Hi All,
I am working with the Create Object-Specific Quick Actions Challenge.

Challenge:
Your brokers want to capture the feedback of their potential buyers after they look at a property. Create a quick action on the event object so brokers can update an event with their notes immediately after a showing. Add the action to the publisher for the Showing layout.
Create a quick action for the event object
Action type: Update a Record
Label: Enter Feedback
Remove all the fields on the page layout except for Name
Put the Feedback field on the page layout
Add the Enter Feedback quick action to the publisher for the Showing Layout. You might have to override the predefined actions in the Salesforce1 section of the publisher.

Error:
Error:The 'Name' and 'Feedback' fields either do not appear on the new action page layout or they are not the only fields present.

I tried to put the Feedback field on the page layout but couldn't find it and couldn't create one. But I added the Enter Feedback quick action(with Name Field) to the publisher for the Showing Layout.

Can somebody help me complete the challenge?

Thanks,
Venkata