• Naznin Vhora
  • NEWBIE
  • 15 Points
  • Member since 2017
  • Developer
  • Tata Consultancy Services

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
When I run the test class form Apex Test Execution page , many time I encountered one common error  "code coverage from running this test class was not applied due to a conflicting".  I did not found and Root cause or solution regarding this error.
Can any one please help here.
Hi All,
I have a requirement in my code where I need to convert uploaded Excel file into CSV.
Can anyone tell me how to do this ?

Thanks and Regards,
Naznin
Hi Everyone,
I have a requirement in my code,where I need to read an excel file using apex class and visual force page.
I have searched my query,but no where I found the solution for it,everyone posted solution for reading csv file.
Can anyone please tell me that, Is this possible to read excel file using apex?
Hello everyone,
As I am newbie to salesforce, I am trying to explore and learn various concept of it. Today I am trying to learn dynamic SOQL Concept, but I am facing one error in it.
Here, I take input (Object Name) from the end user, and fetch the information from that specific object. Since the user is going to enter the object name, I don’t want to hardcode the Object name in the apex class. That is why I have used generic sobject type named “sObject” for creating a List variable but on Visual force page I got the following error:
Error: Unknown property 'SObject.Name__c'  
I understand the error which says that Name__c is the property of my custom object(Student__c),and I have created the object type as generic that’s why it throws the error message.
I have tried various solution such as casting generic sObject to specific custom object,but still my problem is unsolved.
Can anyone please help me to tackle this problem,It will help me to understand this new concept very well.

Please check my code snippet.

Apex Class : 

public class Dynamic_SOQL
{
    public String name {get;set;}    
    public List<sObject> sobj=new List<sObject>(); 
         
    public void searchresult()
    {
        
        String qry='select id,Name__c from '+name;
        sobj=Database.query(qry);           
        
        ApexPages.Message msg=New ApexPages.Message(ApexPages.Severity.INFO,name);
        ApexPages.addMessage(msg);       
       
    }
    public List<sObject> getresult()
    {       
        return sobj;
    }
}

Visual force Page : 

<apex:page docType="html-5.0" controller="Dynamic_SOQL">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockSection >
        
        <apex:inputText label="Object Name" value="{!name}"/>
        <apex:commandButton value="Search" onclick="searchresult()" reRender="mymsg"/>
        <apex:pageMessages id="mymsg"></apex:pageMessages>
        
        <apex:pageBlockTable value="{!result}" var="r">
            <apex:column value="{!r.id}"/>
            <apex:column value="{!r.Name__c}"/>
        </apex:pageBlockTable>
        
        <apex:actionFunction action="{!searchresult}" name="searchresult"/>
        
        
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi All,
I am facing one error while executing the following code.
Please give your suggestion to combat this error and improve my code.
Note : Error is mentioned in Title.
public class Apex_DML 
{
     public void upsertData() // Insert and Update in One Call
        {
                Demo__c[] dl=[select name from Demo__c where Number__c=3]; //Existing Record Fetched
        
                for(Demo__c t:dl)
                {
                        t.Name='Lion'; // Existing Record Updated
                 }        
     
               Demo__c nd=new Demo__c(Name='TrailHead',Number__c=10); // New record Created        
                 dl.add(nd);
        
                try
                {
                         upsert dl Number__c;
                }
                catch(DmlException e)
                {
                        System.debug(e.getMessage());
                }
       
                System.debug('Record Upserted..');        
        
        }
}

 
Hi All,
I have a requirement in my code where I need to convert uploaded Excel file into CSV.
Can anyone tell me how to do this ?

Thanks and Regards,
Naznin
Hi All,
I have a requirement in my code where I need to convert uploaded Excel file into CSV.
Can anyone tell me how to do this ?

Thanks and Regards,
Naznin
Hi Everyone,
I have a requirement in my code,where I need to read an excel file using apex class and visual force page.
I have searched my query,but no where I found the solution for it,everyone posted solution for reading csv file.
Can anyone please tell me that, Is this possible to read excel file using apex?
Hello everyone,
As I am newbie to salesforce, I am trying to explore and learn various concept of it. Today I am trying to learn dynamic SOQL Concept, but I am facing one error in it.
Here, I take input (Object Name) from the end user, and fetch the information from that specific object. Since the user is going to enter the object name, I don’t want to hardcode the Object name in the apex class. That is why I have used generic sobject type named “sObject” for creating a List variable but on Visual force page I got the following error:
Error: Unknown property 'SObject.Name__c'  
I understand the error which says that Name__c is the property of my custom object(Student__c),and I have created the object type as generic that’s why it throws the error message.
I have tried various solution such as casting generic sObject to specific custom object,but still my problem is unsolved.
Can anyone please help me to tackle this problem,It will help me to understand this new concept very well.

Please check my code snippet.

Apex Class : 

public class Dynamic_SOQL
{
    public String name {get;set;}    
    public List<sObject> sobj=new List<sObject>(); 
         
    public void searchresult()
    {
        
        String qry='select id,Name__c from '+name;
        sobj=Database.query(qry);           
        
        ApexPages.Message msg=New ApexPages.Message(ApexPages.Severity.INFO,name);
        ApexPages.addMessage(msg);       
       
    }
    public List<sObject> getresult()
    {       
        return sobj;
    }
}

Visual force Page : 

<apex:page docType="html-5.0" controller="Dynamic_SOQL">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockSection >
        
        <apex:inputText label="Object Name" value="{!name}"/>
        <apex:commandButton value="Search" onclick="searchresult()" reRender="mymsg"/>
        <apex:pageMessages id="mymsg"></apex:pageMessages>
        
        <apex:pageBlockTable value="{!result}" var="r">
            <apex:column value="{!r.id}"/>
            <apex:column value="{!r.Name__c}"/>
        </apex:pageBlockTable>
        
        <apex:actionFunction action="{!searchresult}" name="searchresult"/>
        
        
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>