• Richa Upadhyay
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Miss
  • HCL Technologies

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 10
    Questions
  • 25
    Replies
Hi Everyone,

Here is my code:
 
public with sharing class GStartedController{

    public GStartedController(ApexPages.StandardController controller) {

    }


    public Survey__c testSurvey {get;set;}
    public Boolean testSurveyAvailable {get;set;}
    public List<String> questionIds {get;set;}
    
    
    public GStartedController(){
    try{
        
            testSurvey = [select Id, Name from Survey__c where Name='Salesforce Sample Survey' LIMIT 1];
            testSurveyAvailable= true;
        }
        catch (Exception e){
            testSurveyAvailable = false;
      }      

        //Check getting started survey doesn't already exist
    
        questionIds = new List<String>();
        List<String> questionIds = new List<String>();
        try{
        
            testSurvey = [select Id, Name from Survey__c where Name='Salesforce Sample Survey' LIMIT 1];
            testSurveyAvailable= true;
        }
        catch (Exception e){
            testSurveyAvailable = false;
      }
    }
    
    public void makeTestSurvey(){
    
        testSurvey = new Survey__c();
        testSurvey.Name = 'Salesforce Sample Survey';
        testSurvey.Submit_Response__c = 'empty';
        testSurvey.CSS_Container__c ='#survey_container{ margin: 0 auto; width: 600px; box-shadow: 0 0 14px #CCCCCC; -moz-box-shadow: 0 0 14px #CCCCCC; -webkit-box-shadow: 0 0 14px #CCCCCC; }';
        insert testSurvey;
        
        questionIds.add(createQuestion(0));
        questionIds.add(createQuestion(1));
        questionIds.add(createQuestion(2));
        questionIds.add(createQuestion(3));
        
        createResponse();
        
        
        testSurveyAvailable= true;
    }
    
    public PageReference viewSurvey(){
    
        return new PageReference('/Apex/?id=' +testSurvey.Id);
    }
    
    public PageReference takeSurvey(){
    
        return new PageReference('/Apex/TakeSurvey?id=' +testSurvey.Id+ '&cId=none&caId=none');
    }
    
    public PageReference viewResults(){
    
        ReportFinderUtil rfu = new ReportFinderUtil();
        String reportId = rfu.findReportId('Survey with Questions and Responses');
        
        String surveyId = testSurvey.Id;
        surveyId = surveyId.substring(0,15);
        
        return new PageReference('/Apex/ManageSurveys?id=' +testSurvey.Id);
    }
    
    private String createQuestion(Integer i){
    
        Question_For_Survey__c q =new Question_For_Survey__c();
        q.Name = 'Testing Question';
        q.Survey__c = testSurvey.Id;
        q.Type__c = getType(i);
        q.Choices__c = getChoices(i);
        q.Question__c = 'Testing Question question' + i;
        q.Required__c = true;
        insert q;
        return q.Id;
    }
    
    private String getType(Integer i){
    
        if(i==1)
        return 'Multi-select--Vertical';
        else if(i==2)
        return 'Single-select--Vertical';
        else if(i==3)
        return 'Single-select--Horizontal';
        else         
        return 'Free Text';
    }
    
    private String getChoices(Integer i){
    
        if (i==0)
            return 'one\ntwo\nthree\n';
        if (i==0)
            return 'four\nfive\nsix\n';
        if (i==0)
            return 'seven\neight\nnine\n';
            
        return '';
    }
    
    private void createResponse(){
    
        Contact c = new Contact();
        try{
        c = [Select id From Contact where Email=:'surveyForceAppUser@survey.force'];
        }          
        catch (Exception e){
       
        c.LastName = 'Doe';
        c.FirstName = 'John';
        c.Email = 'surveyForceAppUser@survey.force';
        insert c;
     
        }
        Survey_Taken__c st = new Survey_Taken__c();
        st.Contact__c = c.Id;
        st.Survey__c = testSurvey.Id;
        st.Taken__c = 'false';
        insert st;
        
        for(Integer i=0; i<4; i++){
        
            Response_For_Questions__c r = new Response_For_Questions__c();
            if (i == 0){
                r.Response__c = 'two';
            } else if (1 ==1) {
              r.Response__c = 'four';
            } else if (1 ==2) {
              r.Response__c = 'nine';
            } else if (1 ==4) {
              r.Response__c = 'This is a response';
            } 
            Question_For_Survey__c sq = [Select id from Question_For_Survey__c where id=: questionIds[i] limit 1];
                r.Question_For_Survey__c = sq.id;
                r.Survey_Taken__c = st.Id;
            insert r; 
        }
    }
}

I am getting issues on : 
 
public void makeTestSurvey(){
    
        testSurvey = new Survey__c();
        testSurvey.Name = 'Salesforce Sample Survey';
        testSurvey.Submit_Response__c = 'empty';
        testSurvey.CSS_Container__c ='#survey_container{ margin: 0 auto; width: 600px; box-shadow: 0 0 14px #CCCCCC; -moz-box-shadow: 0 0 14px #CCCCCC; -webkit-box-shadow: 0 0 14px #CCCCCC; }';
        insert testSurvey;
        
        questionIds.add(createQuestion(0));
        questionIds.add(createQuestion(1));
        questionIds.add(createQuestion(2));
        questionIds.add(createQuestion(3));
        
        createResponse();
        
        
        testSurveyAvailable= true;
    }

I am not able to find the problem. Please help me to get this resolved.

Thanks in advance,
Richa
Hi All,

I am trying to sync values on salesforce using PHP toolkit, for all the custom objects and fields both ex:

webkul_es__wk_vm_categories__c CUSTOM OBJECT
webkul_es__vm_product_ID__c CUSTOM FIELD on STANDARD OBJECT (Product)

I have enabled the visibility from Field-level security. Still not able to upsert on custom objects and fields. All permissions given

Error: 
INVALID_TYPE: sObject type 'webkul_es__wk_vm_categories__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Please share your kind suggestions,

Thanks in advance,
Richa
 
Hi All,

I want to create a logic where standard pageblocksection can be hide depending upon the VF picklist value.

I have 3 picklist values for VirtualMart, Cs-Cart and Magento, and have standard pageblocksection in standard Product form. I want to hide CS-Cart and Magento section if VirtualMart is selected in the picklist.

How to achieve this functionality, please share your kind inputs.

Thanks in advance,

Regards,
Richa
 
Hi All,

I am trying upsert values from PHP into salesforce using php toolkit. I am not able to upsert values for OrderStatus which is a picklist.
Please suggest how to do that!!!

Thanks in advance,
Richa 
Hi All,

I want to push data for standard price along with product information using upsert from PHP using toolkit. I do not know how to do that. Kindly suggest!!

$priceBook = new stdClass();
$priceBook->Name ='standard price';
$priceBook->IsActive =$vmProducts->published;
$priceBook->Description ='standard price';
$response=$this->saleforceConnection->create(array($priceBook), 'pricebook2');

Thanks in advance,
Richa
Hi All,

I am trying to create a VF page where I need to fetch City information from records (Lead records) when opened.
There is a way i think this can be achieved, onclick event on Lead records, but still confused, how to do it?

No Triggers since no DML.
Kindly suggest.

Thanks in advance,
Richa
 
<apex:page standardController="Product2" recordSetVar="products" tabStyle="Product2" >
    <apex:form >
        <apex:pageBlock title="Change Status">
            <apex:pageBlockSection >
                
                <apex:commandButton action="{!edit}" value="Edit"/>
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockTable value="{!product2.Name}" var="product">
                 <apex:column value="{!product.Name}"/>
                 <apex:column value="{!product.IsActive}"/>
                 <apex:column value="{!product.Description}"/>
            </apex:pageBlockTable>
       </apex:pageBlock>
    </apex:form>
</apex:page>

Throws errors like: 
Error: Unknown property 'String.IsActive' etc
Hi,

I am a Salesforce developer, want to integrate salesforce with Joomla. Without JoomForce, I am not able to integrate. Please suggest idea, how to write such component and what should be the content/ details required for integration.

Thanks in advance,

Richa
Hi All,

I am trying upsert values from PHP into salesforce using php toolkit. I am not able to upsert values for OrderStatus which is a picklist.
Please suggest how to do that!!!

Thanks in advance,
Richa 
Hi Everyone,

Here is my code:
 
public with sharing class GStartedController{

    public GStartedController(ApexPages.StandardController controller) {

    }


    public Survey__c testSurvey {get;set;}
    public Boolean testSurveyAvailable {get;set;}
    public List<String> questionIds {get;set;}
    
    
    public GStartedController(){
    try{
        
            testSurvey = [select Id, Name from Survey__c where Name='Salesforce Sample Survey' LIMIT 1];
            testSurveyAvailable= true;
        }
        catch (Exception e){
            testSurveyAvailable = false;
      }      

        //Check getting started survey doesn't already exist
    
        questionIds = new List<String>();
        List<String> questionIds = new List<String>();
        try{
        
            testSurvey = [select Id, Name from Survey__c where Name='Salesforce Sample Survey' LIMIT 1];
            testSurveyAvailable= true;
        }
        catch (Exception e){
            testSurveyAvailable = false;
      }
    }
    
    public void makeTestSurvey(){
    
        testSurvey = new Survey__c();
        testSurvey.Name = 'Salesforce Sample Survey';
        testSurvey.Submit_Response__c = 'empty';
        testSurvey.CSS_Container__c ='#survey_container{ margin: 0 auto; width: 600px; box-shadow: 0 0 14px #CCCCCC; -moz-box-shadow: 0 0 14px #CCCCCC; -webkit-box-shadow: 0 0 14px #CCCCCC; }';
        insert testSurvey;
        
        questionIds.add(createQuestion(0));
        questionIds.add(createQuestion(1));
        questionIds.add(createQuestion(2));
        questionIds.add(createQuestion(3));
        
        createResponse();
        
        
        testSurveyAvailable= true;
    }
    
    public PageReference viewSurvey(){
    
        return new PageReference('/Apex/?id=' +testSurvey.Id);
    }
    
    public PageReference takeSurvey(){
    
        return new PageReference('/Apex/TakeSurvey?id=' +testSurvey.Id+ '&cId=none&caId=none');
    }
    
    public PageReference viewResults(){
    
        ReportFinderUtil rfu = new ReportFinderUtil();
        String reportId = rfu.findReportId('Survey with Questions and Responses');
        
        String surveyId = testSurvey.Id;
        surveyId = surveyId.substring(0,15);
        
        return new PageReference('/Apex/ManageSurveys?id=' +testSurvey.Id);
    }
    
    private String createQuestion(Integer i){
    
        Question_For_Survey__c q =new Question_For_Survey__c();
        q.Name = 'Testing Question';
        q.Survey__c = testSurvey.Id;
        q.Type__c = getType(i);
        q.Choices__c = getChoices(i);
        q.Question__c = 'Testing Question question' + i;
        q.Required__c = true;
        insert q;
        return q.Id;
    }
    
    private String getType(Integer i){
    
        if(i==1)
        return 'Multi-select--Vertical';
        else if(i==2)
        return 'Single-select--Vertical';
        else if(i==3)
        return 'Single-select--Horizontal';
        else         
        return 'Free Text';
    }
    
    private String getChoices(Integer i){
    
        if (i==0)
            return 'one\ntwo\nthree\n';
        if (i==0)
            return 'four\nfive\nsix\n';
        if (i==0)
            return 'seven\neight\nnine\n';
            
        return '';
    }
    
    private void createResponse(){
    
        Contact c = new Contact();
        try{
        c = [Select id From Contact where Email=:'surveyForceAppUser@survey.force'];
        }          
        catch (Exception e){
       
        c.LastName = 'Doe';
        c.FirstName = 'John';
        c.Email = 'surveyForceAppUser@survey.force';
        insert c;
     
        }
        Survey_Taken__c st = new Survey_Taken__c();
        st.Contact__c = c.Id;
        st.Survey__c = testSurvey.Id;
        st.Taken__c = 'false';
        insert st;
        
        for(Integer i=0; i<4; i++){
        
            Response_For_Questions__c r = new Response_For_Questions__c();
            if (i == 0){
                r.Response__c = 'two';
            } else if (1 ==1) {
              r.Response__c = 'four';
            } else if (1 ==2) {
              r.Response__c = 'nine';
            } else if (1 ==4) {
              r.Response__c = 'This is a response';
            } 
            Question_For_Survey__c sq = [Select id from Question_For_Survey__c where id=: questionIds[i] limit 1];
                r.Question_For_Survey__c = sq.id;
                r.Survey_Taken__c = st.Id;
            insert r; 
        }
    }
}

I am getting issues on : 
 
public void makeTestSurvey(){
    
        testSurvey = new Survey__c();
        testSurvey.Name = 'Salesforce Sample Survey';
        testSurvey.Submit_Response__c = 'empty';
        testSurvey.CSS_Container__c ='#survey_container{ margin: 0 auto; width: 600px; box-shadow: 0 0 14px #CCCCCC; -moz-box-shadow: 0 0 14px #CCCCCC; -webkit-box-shadow: 0 0 14px #CCCCCC; }';
        insert testSurvey;
        
        questionIds.add(createQuestion(0));
        questionIds.add(createQuestion(1));
        questionIds.add(createQuestion(2));
        questionIds.add(createQuestion(3));
        
        createResponse();
        
        
        testSurveyAvailable= true;
    }

I am not able to find the problem. Please help me to get this resolved.

Thanks in advance,
Richa
Hi All,

I am trying to sync values on salesforce using PHP toolkit, for all the custom objects and fields both ex:

webkul_es__wk_vm_categories__c CUSTOM OBJECT
webkul_es__vm_product_ID__c CUSTOM FIELD on STANDARD OBJECT (Product)

I have enabled the visibility from Field-level security. Still not able to upsert on custom objects and fields. All permissions given

Error: 
INVALID_TYPE: sObject type 'webkul_es__wk_vm_categories__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Please share your kind suggestions,

Thanks in advance,
Richa
 
Hi All,

I want to create a logic where standard pageblocksection can be hide depending upon the VF picklist value.

I have 3 picklist values for VirtualMart, Cs-Cart and Magento, and have standard pageblocksection in standard Product form. I want to hide CS-Cart and Magento section if VirtualMart is selected in the picklist.

How to achieve this functionality, please share your kind inputs.

Thanks in advance,

Regards,
Richa
 
Hi All,

I am trying upsert values from PHP into salesforce using php toolkit. I am not able to upsert values for OrderStatus which is a picklist.
Please suggest how to do that!!!

Thanks in advance,
Richa 
Hi All,

I am trying to create a VF page where I need to fetch City information from records (Lead records) when opened.
There is a way i think this can be achieved, onclick event on Lead records, but still confused, how to do it?

No Triggers since no DML.
Kindly suggest.

Thanks in advance,
Richa
 
Is it possible to load data into a tab panel only for the active tab?

I have multiple tabs on one of my pages, embedded with the <apex:tabpanel>

As these are quite large and loading times are slow, is it possible to only load the data from the methods on the current tab panel as oppose to all of them?

Thanks in advance