• Anu Raj.ax1269
  • NEWBIE
  • 77 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 72
    Questions
  • 69
    Replies

Hi,

 I have created a manage package, in which I am displaying chatter feeds for login user. I want this feeds need to be displayed for only community user not for portal user, so i want to hide the component for portal users. So how can I identify is the loged in user is a community user or portal user.

 

Thanks 

Anu

I have created a Pdf in which have a table which have border css. But the table border get display only when it is a VF page the CSS is not working when VF page is renderAs="pdf". I want it to be displayed as VF page. Does there any way to get the solution.

My CSS & VF page:

<style>
    pageBlockCss {
        border-collapse:collapse;
        border-width: 1px;
        border-color: #000000;
    }
    pageBlockCss tr {
        border-width: 1px;
        border-style: solid;
        border-color: #000000;
    }
    pageBlockCss td {
        border-width: 1px;
        border-style: solid;
        border-color: #000000;
    }
</style>
<table width="100%" class="pageBlockCss" >
    <tr>
        <td><b><apex:outputText value="Consultant Name" /></b></td>
        <td><b><apex:outputText value="Project" /></b> </td>
        <td><b><apex:outputText value="Consultant Role" /></b> </td>
        <td><b><apex:outputText value="Quantity" /></b> </td>
        <td><b><apex:outputText value="Charge Rate" /></b> </td>
        <td><b><apex:outputText value="Sub Total" /></b> </td>
        <td><b><apex:outputText value="Taxes" /></b> </td>
        <td><b><apex:outputText value="Total" /></b> </td>
    </tr>
        <apex:repeat value="{!invLI_Con}" var="con" >
            <tr>

 Thanks 

 AnuRaj

Hi,

I have a VF page with controller and in this controller it contain a Wrapper class which is displaying the value apex:pageBlocktable. I have a print button which call a another Vf page where i need to display some values from Wrapper class. I try to use the same controller from both 2 VF pages but it don't work because i call the class and refresh all the values in the class. So i wrote another controller for print VF page but i am not able to pass the values from Wrapper class. Is their any method to do it. Or if their is any other idea, i am open to new idea.

Thanks 

Hi,

 

           I have created a xml file and uploaded into document. I am reading the xml file from my apex code. I am able to add more nodes into the xml file by using addressNode.addChildElement and also tried writer.writeStartElement() also to get the xml file Update. But i am able to see the list get update which i am using to view the node values of xml, when i used addressNode.addChildElement(). But the xml file is not getting update. Does any one do have any idea to update xml file from apex code.

MY code

public class readXmldemo{

    public Document doc {get;set;}
    public XmlStreamReader reader {get; set;}
    public String xmlbody {get;set;}
    public readXmldemo(){

    doc = [select id, Name, body, url from Document WHERE Name = 'XMLFileDemo'];
    system.debug('Document after SOQL ' + doc);

    //system.debug('Get the elemets form XML file ' + reader.getEventType());
    xmlbody = (doc.body).tostring();
    system.debug('XML body contaion '+ xmlbody  );

    Dom.Document dom_doc = new Dom.Document();
    dom_doc.load(xmlbody);
    system.debug('XML body in Dom Doc ' + dom_doc );

    //Retrieve the root element for this document.
    Dom.XMLNode SalesforceObjecet = dom_doc.getRootElement(); 
    Dom.XMLNode ObjectNameSF = SalesforceObjecet.getChildElements()[0];

    string fieldName = ''; 
    string objecetName = '' ;   

    // This is used for insert into XML file but list is only getting 
    ObjectNameSF.addChildElement('field6', null, null).addTextNode('AccountField_FromApex');
    ObjectNameSF.addChildElement('csv6', null, null).addTextNode('csvField_FromApex'); 

    // This is used for writing into XML file but list is only getting 
    XmlStreamWriter writer = new XmlStreamWriter();    
    writer.writeStartDocument('utf-8', '1.0');        

    writer.writeStartElement(null, 'object', null); 
    writer.writeStartElement(null, 'field6', null);
    writer.writeCharacters('AccountField_FromApex');
    writer.writeEndElement();   

    writer.writeStartElement(null, 'csv6', null);
    writer.writeCharacters('csvField_FromApex');
    writer.writeEndElement();  

    writer.writeEndElement();    
    system.debug('Written xml file ' +writer.getXmlString());    
    writer.close(); 

    for(Dom.XMLNode child : SalesforceObjecet.getChildElements()) {           
            objecetName = child.getText();
            system.debug('Object Name in XML field  ' + objecetName );

            for(Dom.XMLNode subchild : child.getChildElements()) {
                fieldName = subchild.getText();
                system.debug('Filed Name in XML field  ' + fieldName );
            }
    } 



    system.debug('Doc to xml string ' + doc.toXmlString());


}
}

 please help if anybody do have any idea.

 

Thanks 

Anu

Hi,

 

 

I have created a test class because i have to use the same set of record repeat, so i created a static method and have same record in it and defined the object in class"
public Account a;". But when i try to access this object in my static method i am getting error that variable not found. Any body here can help me out.

 

thanks

 

Hi,

 

In my Apex class i am converting leads. When i test my code through UI it is working fine but when i run my test class it get failed and shows this error:

22:21:47.413 (413465000)|FATAL_ERROR|leadconvert.BulkLeadConvert.LeadInUseByWorkflowException: 00Qi0000003QfGrEAK

(System Code)

22:21:47.413 (413480000)|FATAL_ERROR|leadconvert.BulkLeadConvert.LeadInUseByWorkflowException: 00Qi0000003QfGrEAK

(System Code) 22:21:47.414 (414323000)|DML_END|[237] 22:21:47.414 (414406000)|EXCEPTION_THROWN|[237]|System.DmlException: ConvertLead failed. First exception on row 0; first error: RECORD_IN_USE_BY_WORKFLOW, Unable to convert lead that is in use by workflow: []

I am just passing list of leads as parameter into convertlead() in Apex class :

 

List<Database.LeadConvertResult> lcr = Database.convertLead(listOfLeadConvert);

 My test class

@isTest(SeeAllData=true) 
public class Test_CVFC_massConvertwithInputs {
public static testmethod void Test_CVFC_massConvertwithInputs(){
    Account a = new Account (); 
    a.Name = 'LeadCompany';
    insert a;

    Opportunity o = new Opportunity();
    o.AccountId = a.Id;
    o.Name = 'LeadCompany';
    O.StageName = 'Prospecting';
    O.CloseDate = date.today();

    insert o;

    Contact c = new Contact();
    c.AccountId = a.id;
    c.FirstName = 'LeadFirstname';
    c.LastName = 'Leadlastname';
    c.MailingStreet = 'LeadStreet';
    c.MailingCity = 'LeadCity';
    c.MailingState = 'LeadState';
    c.MailingPostalCode = '09877';
    insert c;

    Lead l = new Lead();
    //l.Name = 'LeadName';
    l.Company = 'LeadCompany';
    l.IsUnreadByOwner__c = true;
    l.Description = 'leadDescription';
    //l.Status = 'Closed - Converted';
    l.FirstName = 'LeadFirstname';
    l.LastName ='Leadlastname';
    l.Street = 'LeadStreet';
    l.City = 'LeadCity';
    l.State = 'LeadState';
    l.PostalCode = '09877';
    insert l; 

    List<Lead> leadLst = new List<Lead>();
    leadLst = [SELECT  FirstName, LastName, Street, City, State, PostalCode from Lead where id =: l.Id ];

    /*Database.LeadConvert lc = new Database.LeadConvert();
    lc.setLeadId(l.Id);

    LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];
    lc.setConvertedStatus(convertStatus.MasterLabel);*/

    PageReference pageRef = Page.massConvertWithInputs;
    Test.setCurrentPage(pageRef); 
    pageRef.getParameters().put('toconvertLeadIds', l.id); 

    ApexPages.StandardController sc = new ApexPages.standardController(l);  

    CVFC_massConvertwithInputs cmc = new CVFC_massConvertwithInputs(sc);
    system.debug('Wrapper list size '+cmc.wrapperList.size());
    for(Integer i = 0; i < cmc.wrapperList.size(); i++){
        System.debug('Values in Wrapper list ' + cmc.wrapperList[i]);
    }
    //cmc.leadIds = leadLst;
    cmc.convert();

}
}

 is there any thing i am missing out please guide me.

Thanks

Anu

Hi,

 

 

I have created a product which contain a custom setting. In the custom setting it contain a record. I have the product as package and installed it into an new env but after installation the user need to go and create record in custom setting to get the product working. I need to create records in custom setting automatically while installing. Is this possible to do? Is their any way please guide me.

 

Thanks

 

I have created a app and have it as package and have install to an another env i have a custom button in may package. I need to get this button auto generated on the object when the package get installed. Now the button has get generated but the admin need to customize the page layout then need to add button.

My need is to create a auto generate button on the object when package is installed so that admin is not need to customize page layout.

Hi, I am trying to build a VF page which dynamically displays the datatable. The fields to be displayed are not known, they need to taken from a custom setting.

Here is what i am trying to achieve

I have a custom setting which has field names(API names) of columns that need to be displayed in the data table

I also have a list of a quotelineitem which also uses this custom setting to get the records. The issue i am facing is how do we display the columns in datatable as we would only know the field name at run time.

In the code below to display account name i would need to specify <apex:outputText value="{!account.name}"/> in the VF page, but since i really dont know which fields would be displayed is there a way we can dynamically populate the field names.

I am not stuck with datatable, i am open to any other way to dynamically display the fields

            <apex:facet name="header">Name</apex:facet>

        <apex:facet name="footer">column footer</apex:facet>

        <apex:outputText value="{!account.name}"/>

   </apex:column>

Hi,

 

I have wrote a batch class and now i am writing test class for it but i am getting this error. Argument must be an object that implements Database.Batchable

Batch class

global class CBatchCalculateRatingsHistoricalData 
{
// Persistent variables
global Boolean hasErrors {get; private set;}

// Constructor
global CBatchCalculateRatingsHistoricalData()
{  
    this.hasErrors = false;
}

global Database.QueryLocator start(Database.BatchableContext BC)
{
  system.debug('Processing start method'); 
    // Query string for batch Apex
    String query = ''; 
    query += 'SELECT Id,name,Date_of_First_Order__c,Number_of_Orders__c FROM Account ';
    if(system.Test.isRunningTest())
        query += ' LIMIT 200';
    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<sObject> objectBatch)
{

}

global void finish(Database.BatchableContext BC)
{

}
}

test class

@isTest(seeAllData = true)
public class scheduledBatchable
{  
 static testMethod void Test_CBatchRatingsHistory()
  {
      System.Test.startTest();
     CBatchCalculateRatingsHistoricalData b = new CBatchCalculateRatingsHistoricalData();
     Database.executeBatch(b, 200);
     System.Test.stopTest();

 }

 }

please tell me what is the issue with this code. If i am wrong then please help me to get it right. 

 

Thanks

Anu

Hi,

   I have a contact lookup so when i click on the lookup it opens a popup and i search for a particular contact. what i want is to restrict the result to display only contacts related to a account, for example in my case object i have account field i also have contact field when i click on the lookup of contact it should only show the contacts of the account, this is working on standard page but i want it on a VF, is this possible to have it on a VF page without coding. Do any body have any idea to do this. Please help me.

 

Thanks

Anu

I want to close the task on lead list page without going to task page an close. I just want to close the task by clicking cls link in front of created task. Please guide me, how can i do this.

I am trying to get the latest task created on Lead from task object.

My scenario is that if there are 2 leads - Lead1 and Lead2. And both have 2 task created for it, Lead1 contain taska - (created date = today) taskb - (created date = yesterday). And for Lead2 contain taskc - (created date = today - 2) taskd - (created date = today - 4).

It should give result of all the latest created task in the lead1 and lead2 (Result - lead1 (taska) And Lead2(taskc)).

Please provide me the possible ways to do this scenario.

Is it possible to filter out only contact related to an account in a case object. When a case is created from account, it has the account field in case populated with the account name/Id. I want to select contact and the lookup should only show contacts related to this account. Is this possible?
I have a filter criteria case: Account Name ID Equals Contact Name : Account Name : Account ID. Event then it is not working.

I am trying to get fields from Contact into fieldset. but i am not bale to get the fields properly i am getting error : Attempt to de-reference a null object

my code :

     public class DemoCtrl{

     public contact DemoCtrl { get; set; }

     public List<schema.fieldsetmember> getACTFields(){ 
             // System.debug('getField ' + Fields);     
             return getFields('contact', 'ACT');
     }


       public static List<schema.fieldsetmember> getFields(String objectName, String fieldSetName) 
      {  

        Map<String, Schema.SObjectType> GlobalDescribeMap = Schema.getGlobalDescribe(); 
        Schema.SObjectType SObjectTypeObj = GlobalDescribeMap.get(objectName);
        Schema.DescribeSObjectResult DescribeSObjectResultObj = SObjectTypeObj.getDescribe();            
         Schema.FieldSet fieldSetObj = DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName);
         //DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName);        


          System.debug('GlobalDescribeMap ' + GlobalDescribeMap);
         System.debug(' SObjectTypeObj  ' + SObjectTypeObj );
          System.debug('DescribeSObjectResultObj ' +          DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName)); 
         System.debug('fieldSetObj  ' + fieldSetObj ); 
        return fieldSetObj.getFields();        


     }      

   }

I am getting null into DescribeSObjectResultObj.FieldSets.getMap().get(fieldSetName). Can anybody guide me what is the issue it is not getting filled. Can anybody help me to solve this out.

Hi,

      I like to add a field to a VF page when a field is added to a object by admin with out re coding the VF page. Is their any way to add fields to VF page automatically when a field get created on the object.  Please help me to solve this issue.

 

Thanks

Anu

Hi

I have a VF page with 5 input File attachment. I want 5 different attachment on the each of them. eg: Their are 3 different fields 1. Name, 2. Job, 3. Resume . So like this their are 5 fields. If 1st Name = Anu, Job = SFDC dev , resume = attachment1 2nd Name = ram, job = SFDC dev, resume = attachment2 etc. Their is no field called attachment in object. I need to attach the attachment to the record we create. Is it possible. Please help me to solve this issue.

Thanks

Anu

Hi am trying to run "ant clean debug" command on cmd. But i am getting null returned: 1 error.

 

BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:622: The following error    occurred while executing this line:
 C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:658: null returned: 1



 <aaptexecutable="${aapt}"command="package"verbose="${verbose}"manifest="${out.manifest.abs.file}"androidjar="${project.target.android.jar}"rfolder="${gen.absolute.dir}"nonConstantId="${android.library}"libraryResFolderPathRefid="project.library.res.folder.path"libraryPackagesRefid="project.library.packages"ignoreAssets="${aapt.ignore.assets}"proguardFile="${out.absolute.dir}/proguard.txt"><respath="${out.res.absolute.dir}"/><respath="${resource.absolute.dir}"/></aapt>

the line no 658

 proguardFile="${out.absolute.dir}/proguard.txt">

the line no 622

 elseText="hasCode = false. Skipping aidl/renderscript/R.java">

Is their anybody their who know the solution for this issue.

Thanks 

Anu

Hi I am trying to create a android native app in salesforce touch platform. I am trying to copy lib from sample project to my app. 1st i entered this commend in my cmd

cd $TARGET_DIR
$ANDROID_SDK_DIR/tools/android update project -p . -t 1

 the result was

Updated project.properties Updated local.properties Updated file C:\Anu\SalesforceTouch\build.xml Updated file C:\Anu\SalesforceTouch\proguard-project.txt It seems that there are sub-projects. If you want to update them please use the --subprojects parameter.

 after that i run

ant clean debug

 This time i get the result as

l
         [javac] symbol  : variable sf__auth_container
         [javac] location: class android.R.id
         [javac]     public int idAuthContainer() { return R.id.sf__auth_container; }
         [javac]                                               ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:46: cannot  find symbo
     l
         [javac] symbol  : variable sf__menu_clear_cookies
         [javac] location: class android.R.id
         [javac]     public int idItemClearCookies() { return R.id.sf__menu_clear_cookies; }
         [javac]                                                  ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:47:  cannot  find symbol
          [javac] symbol  : variable sf__menu_pick_server
          [javac] location: class android.R.id
          [javac]     public int idItemPickServer() { return R.id.sf__menu_pick_server; }
          [javac]                                                ^
          [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:48: cannot  find symbol
         [javac] symbol  : variable sf__menu_reload
         [javac] location: class android.R.id
         [javac]     public int idItemReload() { return R.id.sf__menu_reload; }
         [javac]                                            ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:49: cannot  find symbo
    l
         [javac] symbol  : variable sf__load_separator
         [javac] location: class android.R.id
         [javac]     public int idLoadSeparator() { return R.id.sf__load_separator; }
         [javac]                                               ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:50: cannot  find symbo
    l
         [javac] symbol  : variable sf__load_spinner
         [javac] location: class android.R.id
         [javac]     public int idLoadSpinner() { return R.id.sf__load_spinner; }
         [javac]                                             ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:51: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_name
         [javac] location: class android.R.id
         [javac]     public int idServerName() { return R.id.sf__server_name; }
         [javac]                                            ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:52: cannot  find symbo
    l
         [javac] symbol  : variable Text_HostName
          [javac] location: class android.R.style
         [javac]     public int styleTextHostName() { return R.style.Text_HostName; }
         [javac]                                                    ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:53: cannot  find symbo
    l 
         [javac] symbol  : variable Text_HostUrl
         [javac] location: class android.R.style
         [javac]     public int styleTextHostUrl() { return R.style.Text_HostUrl; }
         [javac]                                                   ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:55: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode
         [javac] location: class android.R.layout
         [javac]     public int layoutPasscode() {return R.layout.sf__passcode; }
         [javac]                                                 ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:56: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_title
         [javac] location: class android.R.id
         [javac]     public int idPasscodeTitle() {return R.id.sf__passcode_title; }
         [javac]                                              ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:57: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_error
         [javac] location: class android.R.id
         [javac]     public int idPasscodeError() {return R.id.sf__passcode_error; }
         [javac]                                              ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:58: cannot find symbo
    l
         [javac] symbol  : variable sf__passcode_instructions
         [javac] location: class android.R.id
         [javac]     public int idPasscodeInstructions() {return  R.id.sf__passcode_instructions; }
         [javac]                                                     ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:59: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_text
         [javac] location: class android.R.id
         [javac]     public int idPasscodeText() {return R.id.sf__passcode_text; }
         [javac]                                             ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:60: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_create_title
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeCreateTitle() {return  R.string.sf__passcode_create_title; }

         [javac]                                                            ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:61: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_enter_title
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeEnterTitle() {return  R.string.sf__passcode_enter_title; }
         [javac]                                                           ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:62: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_confirm_title
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeConfirmTitle() {return  R.string.sf__passcode_confirm_title;
      }
         [javac]                                                             ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:63: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_enter_instructions
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeEnterInstructions() {return  R.string.sf__passcode_enter_ins
     tructions; }
         [javac]                                                                  ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:64: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_create_instructions
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeCreateInstructions() {return  R.string.sf__passcode_create_i
     nstructions; }
         [javac]                                                                   ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:65: cannot  find symbo
    l 
         [javac] symbol  : variable sf__passcode_confirm_instructions
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeConfirmInstructions() {return  R.string.sf__passcode_confirm
     _instructions; }
         [javac]                                                                    ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:66: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_min_length
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeMinLength() {return  R.string.sf__passcode_min_length; }
         [javac]                                                          ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:67: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcode_try_again
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeTryAgain() {return  R.string.sf__passcode_try_again; }
         [javac]                                                         ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:68: cannot find symbo
    l
         [javac] symbol  : variable sf__passcode_final
         [javac] location: class android.R.string
         [javac]     public int stringPasscodeFinal() {return R.string.sf__passcode_final; }
         [javac]                                                      ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:69: cannot  find symbo
    l
         [javac] symbol  : variable sf__passcodes_dont_match
         [javac] location: class android.R.string
         [javac]     public int stringPasscodesDontMatch() {return  R.string.sf__passcodes_dont_match; }
         [javac]                                                           ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:71: cannot find symbo
    l
         [javac] symbol  : variable sf__picker_custom_label
         [javac] location: class android.R.id
         [javac]     public int idPickerCustomLabel() {return R.id.sf__picker_custom_label; }
         [javac]                                                  ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:72: cannot find symbo
    l
         [javac] symbol  : variable sf__picker_custom_url
         [javac] location: class android.R.id
         [javac]     public int idPickerCustomUrl() {return R.id.sf__picker_custom_url; }
         [javac]                                                ^
        [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:73: cannot  find symbo
    l 
         [javac] symbol  : variable sf__server_url_default_custom_label
         [javac] location: class android.R.string
         [javac]     public int stringServerUrlDefaultCustomLabel() {return  R.string.sf__server_url_defau
     lt_custom_label;}
         [javac]                                                                    ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:74: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_url_default_custom_url
         [javac] location: class android.R.string
         [javac]     public int stringServerUrlDefaultCustomUrl() {return  R.string.sf__server_url_default
    _ custom_url;}
         [javac]                                                                  ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:75: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_url_add_title
         [javac] location: class android.R.string
         [javac]     public int stringServerUrlAddTitle() {return  R.string.sf__server_url_add_title;}
         [javac]                                                          ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:76: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_url_edit_title
         [javac] location: class android.R.string
         [javac]     public int stringServerUrlEditTitle() {return  R.string.sf__server_url_edit_title;}
         [javac]                                                           ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:77: cannot  find symbo
    l 
         [javac] symbol  : variable sf__custom_server_url
         [javac] location: class android.R.layout
         [javac]     public int layoutCustomServerUrl() {return  R.layout.sf__custom_server_url;  }
         [javac]                                                        ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:78: cannot  find symbo
    l
         [javac] symbol  : variable sf__apply_button
         [javac] location: class android.R.id
         [javac]     public int idApplyButton() {return R.id.sf__apply_button;}
         [javac]                                            ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:79: cannot  find symbo
    l
         [javac] symbol  : variable sf__cancel_button
         [javac] location: class android.R.id
         [javac]     public int idCancelButton() {return R.id.sf__cancel_button;}
         [javac]                                             ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:80: cannot  find symbo
    l
         [javac] symbol  : variable sf__invalid_server_url
         [javac] location: class android.R.string
         [javac]     public int stringInvalidServerUrl() {return  R.string.sf__invalid_server_url;}
          [javac]                                                         ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:81: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_list_group
         [javac] location: class android.R.id
         [javac]     public int idServerListGroup() {return R.id.sf__server_list_group; }
         [javac]                                                ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:82: cannot  find symbo
    l
         [javac] symbol  : variable sf__server_picker
         [javac] location: class android.R.layout
         [javac]     public int layoutServerPicker() {return R.layout.sf__server_picker; }
         [javac]                                                     ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:83: cannot  find symbo
    l
         [javac] symbol  : variable sf__auth_login_production
         [javac] location: class android.R.string
         [javac]     public int stringAuthLoginProduction() {return  R.string.sf__auth_login_production;}
         [javac]                                                            ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:84: cannot  find symbo
    l 
         [javac] symbol  : variable sf__auth_login_sandbox
         [javac] location: class android.R.string
         [javac]     public int stringAuthLoginSandbox() {return  R.string.sf__auth_login_sandbox;}
         [javac]                                                         ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:85: cannot  find symbo
    l
         [javac] symbol  : variable sf__clear_custom_url
         [javac] location: class android.R.menu
         [javac]     public int menuClearCustomUrl() {return R.menu.sf__clear_custom_url; }
         [javac]                                                   ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:86: cannot  find symbo
    l
         [javac] symbol  : variable sf__menu_clear_custom_url
         [javac] location: class android.R.id
         [javac]     public int idMenuClearCustomUrl() {return R.id.sf__menu_clear_custom_url;}
         [javac]                                                   ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:87: cannot  find symbo
    l
         [javac] symbol  : variable sf__edit_icon
         [javac] location: class android.R.drawable
         [javac]     public int drawableEditIcon() {return R.drawable.sf__edit_icon; }
         [javac]                                                     ^
        [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\SalesforceRImpl.java:88: cannot  find symbo
    l
         [javac] symbol  : variable sf__show_custom_url_edit
         [javac] location: class android.R.id
         [javac]     public int idShowCustomUrlEdit() {return R.id.sf__show_custom_url_edit;}
         [javac]                                                  ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\myappApp.java:39: method does  not override
      or implement a method from a supertype
         [javac]     @Override
         [javac]     ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\myappApp.java:46: cannot find  symbol
         [javac] symbol  : variable Encryptor
         [javac] location: class com.acme.mobileapp.myappApp
         [javac]             return Encryptor.hash(name + "x;lksalk1jsadihh23lia;lsdhasd2",  name + "112;k
     aslkxs0-12;skcxn1203ph");
         [javac]                    ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\myappApp.java:44: method does  not override
      or implement a method from a supertype
         [javac]     @Override
         [javac]     ^
         [javac] c:\Anu\SalesforceTouch\src\com\acme\mobileapp\myappApp.java:49: method does  not override
      or implement a method from a supertype
         [javac]     @Override
         [javac]     ^
         [javac] 78 errors

     BUILD FAILED
      C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:680: The following error  occurred whi
     le executing this line:
     C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:693: Compile failed; see     the compiler

   error output for details.

 does anybody know what might be the reason and please provide me the solution for this issue.

Thnaks

Anu

Hi

I am working on salesforce touch platform creating a hybrid app for android. I have import a SFDC touch app in eclipse but getting some package issue. I imported some needed packages to the project but the imported packages contain some other packages. When i import those the same thing happens it contain some other packages. So somebody please guide is their any way to get all the related packages into eclipse.

 

Thanks

Anu

Hi,

 I have created a manage package, in which I am displaying chatter feeds for login user. I want this feeds need to be displayed for only community user not for portal user, so i want to hide the component for portal users. So how can I identify is the loged in user is a community user or portal user.

 

Thanks 

Anu

I have created a Pdf in which have a table which have border css. But the table border get display only when it is a VF page the CSS is not working when VF page is renderAs="pdf". I want it to be displayed as VF page. Does there any way to get the solution.

My CSS & VF page:

<style>
    pageBlockCss {
        border-collapse:collapse;
        border-width: 1px;
        border-color: #000000;
    }
    pageBlockCss tr {
        border-width: 1px;
        border-style: solid;
        border-color: #000000;
    }
    pageBlockCss td {
        border-width: 1px;
        border-style: solid;
        border-color: #000000;
    }
</style>
<table width="100%" class="pageBlockCss" >
    <tr>
        <td><b><apex:outputText value="Consultant Name" /></b></td>
        <td><b><apex:outputText value="Project" /></b> </td>
        <td><b><apex:outputText value="Consultant Role" /></b> </td>
        <td><b><apex:outputText value="Quantity" /></b> </td>
        <td><b><apex:outputText value="Charge Rate" /></b> </td>
        <td><b><apex:outputText value="Sub Total" /></b> </td>
        <td><b><apex:outputText value="Taxes" /></b> </td>
        <td><b><apex:outputText value="Total" /></b> </td>
    </tr>
        <apex:repeat value="{!invLI_Con}" var="con" >
            <tr>

 Thanks 

 AnuRaj

Hi

I am working on salesforce touch platform creating a hybrid app for android. I have import a SFDC touch app in eclipse but getting some package issue. I imported some needed packages to the project but the imported packages contain some other packages. When i import those the same thing happens it contain some other packages. So somebody please guide is their any way to get all the related packages into eclipse.

 

Thanks

Anu

Hi,

I want update cost  field in raw custom obj.All records need to be update when i update one record.

 

I wrote some code its not working properly


trigger:

=========================

trigger costincr on Raw__c (before update) {

list<raw__c> raw= new list<raw__c>();
raw=[select id,name,cost__c,Exp_Date__c from Raw__c ];
cost_incr w=new cost_incr();
w.incr_method(raw);
}

class:

===================

public class cost_incr{


    public void incr_method(raw__c[] raw){
    raw=[select id,name,cost__c,Exp_Date__c from Raw__c ];
        for(raw__c rec:raw)
        {
        if(rec.cost__c!=null)
        {
        rec.cost__c=rec.cost__c+55;            
         }
        }
        update raw;
    }


}

 

Thanks

Hi,

 i have a error here  like===   AscDescOrderCls Compile Error: Illegal assignment from String to LIST<String> at line 33 column 16====

 

Please slove this error ..

 

plz help me 

 

public class AscDescOrderCls
{
public Integer i;
public List<String> lastValue{get;set;}
public List<String> fstName{get;set;}
public List<String> Descending{get;set;}
public AscDescOrderCls()
{
fstName=new List<String>();
Descending= new List<String>();
lastValue=new List<string>();

fstName.add('Rama');
fstName.add('Kumar');
fstName.add('Prasad');
fstName.add('Devaraju');
fstName.add('Murali');
fstName.add('Balu');
fstName.add('Chaitu');
fstName.add('Tanuja');
fstName.add('Easu');
fstName.add('Hari');
fstName.sort();

for(i =fstName.size()-1; i>=0;i--)
{
lastValue=fstName.get(fstName.size()-1);
}
system.debug('Descending order'+lastValue);
}
}

  • October 10, 2012
  • Like
  • 0

I have a sobject TestStoring__c with one custom field Body__c.In after insert trigger on FeedItem ,  when i insert a record in 

TestStoring__c sobject,it is not getting inserted.I am also attaching the code below.

 

Trigger:

 

trigger Test on FeedItem (after insert) 
{
FeedItem[] f=Trigger.New;
TestTriggerClass.addFeedError(f);

System.debug(TestTriggerClass.flag);
if(TestTriggerClass.flag!='done')
{
TestStoring__c vv=new TestStoring__c();
vv.Body__c=f[0].body;
insert vv;
}
}

 

 

Class:

 

public class TestTriggerClass
{
public static string flag;
public static void addFeedError(list<FeedItem> fi)
{
if(fi[0].body.contains('blocked'))
{
flag='not';
fi[0].adderror('Not Allowed');
return;
}
else
{
flag='done';
return;
}
}
}

 

 

If you have any solution please help me?Its urgent.please

 

Thanks

Anil Meghnathi

Hi

   I am learning salesforce touch but I need to develop app in it. How can i develop a app in it ? 

Thanks 

Anu

Hi 

   Can anybody tell me how to  migrate the custom objects fields etc into a dev env from sandbox.

Thanks 

Anu

Hi

I want to replace the value of a string. This is a integer but saved in string. Eg: i am getting the value as 123.345 the i need to get the value as 123 only. I want to replace value after . with '' but the issue is i don't know how many decimal place is coming after point. Please help me to solve this issue.

Thanks

Anu

Hi,

 

Im trying to create a class and VF page.Here i need to show some reports in google chart.Below mentioned is the class .

public class GoogleChartsController
{
@RemoteAction
public list<AggregateResult> lstAR = new list<AggregateResult>();

public GoogleChartsController()
{
lstAR = [SELECT  SUM(Almost_Overdue__c) AO ,SUM(Balance_Overdue__c) BO ,SUM(Total_Balance__c) TB ,Account_NameLookup__c from Invoice__c GROUP BY Account_NameLookup__c];
}
public list<OppClass> getResults()
{
list<OppClass> lstResult = new list<OppClass>();
for (AggregateResult ar: lstAR)
{
oppClass objOppClass = new oppClass(ar);
lstResult.add(objOppClass);
}
return lstResult;
}

class oppClass
{
public Double AO
{ get;set; }
public Double BO
{ get;set; }
public Double TB
{ get;set; }



public oppClass(AggregateResult ar)
{
//Note that ar returns objects as results, so you need type conversion here
AO = (Double)ar.get('AO');
BO = (Double)ar.get('BO');
TB = (Double)ar.get('TB');


}
}
}

 

<apex:page controller="GoogleChartsController" sidebar="false"> 
    <!-- Google API inclusion -->
    <apex:includeScript id="a" value="https://www.google.com/jsapi" />
     
    <apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demoing - Opportunities by Exepected Revenue"/>
 
    <!-- Google Charts will be drawn in this DIV -->
    <div id="chartBlock" />
     
    <script type="text/javascript">
        // Load the Visualization API and the piechart package.
        google.load('visualization', '1.0', {'packages':['corechart']});
       
        // Set a callback to run when the Google Visualization API is loaded.
        google.setOnLoadCallback(initCharts);
   
        function initCharts() {         
          // Following the usual Remoting syntax
          // [<namespace>.]<controller>.<method>([params...,] <callbackFunction>(result, event) {...}
          // controller : GoogleChartsController
          // method : loadOpps
          GoogleChartsController.Results( 
                 function(result, event){  
                     // load Column chart
                     var visualization = new google.visualization.ColumnChart(document.getElementById('chartBlock'));
                     // Prepare table model for chart with columns
                     var data = new google.visualization.DataTable();
                     data.addColumn('number', 'AO');
                     data.addColumn('number', 'BO');
                     data.addColumn('number', 'TB');    
                     // add rows from the remoting results
                     for(var i =0; i<result.length;i++){
                        var r = result[i];
                        data.addRow([r.AO, r.BO, r.TB]); 
                      }
                    // all done, lets draw the chart with some options to make it look nice.
                    visualization.draw(data)
          } 
    </script>
</apex:page>

 I used @remote action also.But values are not displaying in VF page.Do we need to used global in class?If yes where i need to give the global variable.Can anyone help me on this??

  • September 06, 2012
  • Like
  • 0

Hi 

   I have custom object and account is lookup to my custom object field. I am able to retrieve account record value from the lookup field but I am getting the id of the record . I need to get the name of the record.

How can I achieve it?

for eg: The record name is Ac_record and is 123456609xya i am only getting id not the name of the record.

 

my code:

obj = select id, name, Location__c from customObj__c where id in: setId;
srting location = obj.Location__c;
location__c is lookup to Account

 

 

Please help me to solve this issue.

Thanks

Anu

 

 

Hi All 

 

 Even i am remving soql statements from for loop it is giveing error 

 

 

        

Visualforce Error
 


System.LimitException: FConnect:Too many script statements: 200001

Error is in expression '{!Add}' in component <apex:page> in page fconnect:selected_products_underservice

 

 

External entry point

 

public with sharing class SelectedProductsunderservice
{
public String AgreementLineId;
public String Customer;
public String customerName;
Public List<Products__c> Products;
Public List<Product__c> customProducts;
public List<ProductsUnderService> ProductsUnderServiceList{get;set;}
List<Id> proIds = new List<Id>();
List<Id> iprodIds = new List<Id>();

public SelectedProductsunderservice ()
{
customProducts = new List<Product__c>();
AgreementLineId=apexpages.currentpage().getparameters().get('Agreement_Line');
Agreement_Line__c al=[select id,Agreement__r.Customer__r.name from Agreement_Line__c where id=:AgreementLineId LIMIT 10 ];
Customer=al.Agreement__r.Customer__c;
customerName=al.Agreement__r.Customer__r.name;

Products = [SELECT id,name ,Agreement_Line__c,Products_ID__c FROM Products__c WHERE Agreement_Line__c=:al.id LIMIT 10];

for(Products__c pro : Products)
{
proIds.add(pro.Products_Id__c);
}

customProducts = [SELECT Id, Name FROM Product__c WHERE Id IN :proIds];
}

public List<ProductsUnderService> getProductsUnderService()
{
ProductsUnderServiceList=new List<ProductsUnderService> ();
List<Installed_Products__c> iproducts = [select Name,
Description__c,
Serial_ID__c,
Asset_Tag__c,
Quantity__c,
Agreement_Line__c,
Products__c,
Site__c,
Customer__c from Installed_Products__c where Customer__c=:customer AND Products__c IN:proIds limit 4];

For(Installed_Products__c ip :iproducts )
{
iprodIds.add(ip.Id);
}
List<Products_Under_Service__c> Productserrvice =[select id,name,Installed_Productss__c from Products_Under_Service__c
where Agreement_Line__c=:AgreementLineId AND Installed_Productss__c IN:iprodIds LIMIT 10 ];

For(Installed_Products__c ip :iproducts )
{
integer i=0;
For(integer temp=0;temp<Productserrvice .size();temp++ )
{
if(Productserrvice[temp].Installed_Productss__c == ip.id)
i++;
}
if(i==0)
ProductsUnderServiceList.add(new ProductsUnderService(ip));
}
if(ProductsUnderServiceList.isEmpty())
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,+ 'There are no Installed Products for '+customerName+' Account'));
return ProductsUnderServiceList;
}

public PageReference Add()
{
//List<Products_Under_Service__c> listPus;
List<Products_Under_Service__c> listPus = new list<Products_Under_Service__c> ();
Products_Under_Service__c pus;
for(ProductsUnderService ip:ProductsUnderServiceList)
{
if(ip.selected==true)
{
pus= new Products_Under_Service__c(Installed_Productss__c=ip.id,
Agreement_Line__c =AgreementLineId);
//insert Pus;
listPus.add(pus);
}

}
insert listPus;
PageReference p=new PageReference('/'+AgreementLineId);
return p;
}
public PageReference cancel()
{
PageReference p=new PageReference('/'+AgreementLineId);
return p;
}

public class ProductsUnderService
{
public Installed_Products__c con {get; set;}
public String id{get;set;}
public Boolean selected {get; set;}
//public String aggreementLine{get;set;}

public ProductsUnderService(Installed_Products__c ip)
{
id=ip.id;
con = ip;
selected = false;
}
}
}

 

 

 

<apex:page controller="SelectedProductsunderservice">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons id="id">
<apex:commandButton value=" Add " action="{!Add}" reRender="id"/>
<apex:commandButton value="Cancel" action="{!cancel}" reRender="id"/>
</apex:pageBlockButtons>
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockTable value="{!ProductsUnderService}" var="ip" id="table">
<apex:column headerValue="Action">
<apex:inputCheckbox value="{!ip.selected}"/>
</apex:column>

<apex:column value="{!ip.con.Name}"/>
<apex:column value="{!ip.con.Products__c}"/>
<apex:column value="{!ip.con.Description__c}"/>
<apex:column value="{!ip.con.Serial_ID__c}"/>
<apex:column value="{!ip.con.Asset_Tag__c}"/>
<apex:column value="{!ip.con.Quantity__c}"/>
<apex:column value="{!ip.con.Customer__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>

</apex:form>
</apex:page>

 

Any help is Appriciated 

  • August 28, 2012
  • Like
  • 0

hello, 

it's been some days now I havent been able to deploy a very simple trigger to server. Now it says that there is no coverage to deploy it (42% so far) whenever I try to deploy to server both my trigger and test class.

I am using Enterprise Edition for nonprofits and Force.com IDE version 25.

Before this problem, I was stuck by this problem described down here: (http://boards.developerforce.com/t5/General-Development/Unable-to-refresh-resource/td-p/205678/page/2
I managed this first problem reinstalling eclipse and force.com IDE, and switching workspaces to the same workspace, and the message error described above disapeared. 

Now I am stuck by this coverage problem: 
************** 
*** Deployment Log *** 
Result: FAILED 
Date: August 21, 2012 2:44:43 PM BRT 

# Deployed From: 
Project name: IDS 
Username: cjmarchi1@uol.com.br 
Endpoint: www.salesforce.com 

# Deployed To: 
Username: cjmarchi1@uol.com.br 
Endpoint: www.salesforce.com 

# Deploy Results: 
File Name: classes/PreencheNomeContaEmContatoClass.cls 
Full Name: PreencheNomeContaEmContatoClass 
Action: UPDATED 
Result: SUCCESS 
Problem: n/a 

File Name: package.xml 
Full Name: package.xml 
Action: UPDATED 
Result: SUCCESS 
Problem: n/a 

File Name: triggers/PreencheNomeContaEmContato.trigger 
Full Name: PreencheNomeContaEmContato 
Action: UPDATED 
Result: SUCCESS 
Problem: n/a 

# Test Results: 

Run Failures: 
CMSConsoleActionsController.t1 System.QueryException: List has no rows for assignment to SObject 
CMSFoldersController.t1 System.QueryException: List has no rows for assignment to SObject 
CMSForceConsoleController.t1 System.QueryException: List has no rows for assignment to SObject 
CMSForceSetupController.t1 System.AssertException: Assertion Failed 
CMSSiteDetailController.t1 System.QueryException: List has no rows for assignment to SObject 
contentblockcomponentController.t1 System.QueryException: List has no rows for assignment to SObject 
FormItemIncludeController.t1 System.QueryException: List has no rows for assignment to SObject 
FriendlyURLs.t1 System.QueryException: List has no rows for assignment to SObject 
HomePageController.t1 System.QueryException: List has no rows for assignment to SObject 
PageBrowserController.t1 System.QueryException: List has no rows for assignment to SObject 
pageController.t1 System.QueryException: List has no rows for assignment to SObject 
PageItemEditExtension.t1 System.QueryException: List has no rows for assignment to SObject 
PageItemIncludeController.t1 System.QueryException: List has no rows for assignment to SObject 
PreviewPageController.t1 System.QueryException: List has no rows for assignment to SObject 
TestCMSForceTriggers.t2 System.QueryException: List has no rows for assignment to SObject 
TestCMSForceTriggers.t3 System.QueryException: List has no rows for assignment to SObject 
TestCMSForceTriggers.t4 System.QueryException: List has no rows for assignment to SObject 
TestCMSForceTriggers.t5 System.QueryException: List has no rows for assignment to SObject 
CleanupUnusedContentBlockItems A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
PreventFolderOrphans A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
PreventTemplateOrphans A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
SetAsHomePage A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
SetHomePageSiteId A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
PreventActiveWebFormDelete A cobertura do teste do Apex selecionado Trigger é de 0%. São necessários pelo menos 1% de cobertura do teste 
A cobertura média do teste em todas as classes e acionadores do Apex é de 42%, pelo menos 75% de cobertura de teste são necessários. 
**************



The code for my trigger:
trigger PreencheNomeContaEmContato on Contact (before insert) { 
for(Contact a : Trigger.New) 
a.AccountId = '001E000000JKUmr'; 
}


The code for my test class:


@isTest 
private class PreencheNomeContaEmContatoClass { 

static TestMethod void PreencheNomeContaEmContatoMethod(){ 
string test0Value = 'testeeeeeeee12345'; 
insereContato(test0Value); 
Contact testObj = [Select Name, AccountId from Contact where Name = :test0Value]; 
System.assertNotEquals(testObj, null); 


private static void insereContato(String field2Value) 

Contact obj = new Contact(); 
obj.LastName = field2Value; 
insert obj; 


}

 

Hi All,

 

Could you help me with the following piece of code :

 

----------------------------------------------------------------------------------------------------------

 

if(acclst.size()>0) {

for(Account acc:acclst) {

//Check if Account have contact/Opportunity associated with it
opplst = [select Id,AccountId from Opportunity where AccountId =:acc.Id];
conlst = [select Id from Contact where AccountId in:acc.Id];

if(opplst.size()==0&&conlst.size()==0) {
/*
* If Account do not have the contacts and opportunities associated to it
* then add those account Ids in the set
*/

sAccId.add(acc.Id);
}
else {
sAccId_CO.add(acc.Id);
}

}

-----------------------------------------------------------------------------------------------------

 

The problem : I am running this through a trigger, and since a query should not be in loops i am hitting TOO MANY SQL QUERY exception. Could you please have a look at the code and modify it to make it work for me ?

 

Your help will be really appreciated,

Rajat

Hi,

 

I need to write test class for wrapper class coverage.

 

CLASS
----------
public without sharing class OppController {
    
    public OppController() {

    }
private class wrapOpp {
        public Integer index { get; set; }
        public Opportunity opp {get; set;}
        public String error {get; set; } 
        public List<SelectOption> allEquipments {
            get {
                List<SelectOption> Equipments = new List<SelectOption>();
                Equipments = OppUtil.allEquipmentOptions;
                return Equipments;
            }
        }
        
        public List<SelectOption> allNotifyDates {
            get {
                List<SelectOption> NotifyDates = new List<SelectOption>();
                if(opp.Property__c != null) {
                    NotifyDates = OppUtil.allNotifyDateOptions.get(opp.Equipment__c);
                }
                return NotifyDates;
            }
        }

    private wrapOpp(Integer ndx, Opportunity o, String err) {
            index = ndx;
            opp = o;
            error = err;           
        }
    }
  }
 

 

  TEST CLASS (wrapper line)
  -------------------------------------
 
 public class testOppclass{

 

 public static testmethod void TestOppMethod(){


  OppController.wrapperOpp Wrapvar = new OppController.wrapperOpp();

}

}

 

 

When I declare a variable I am getting error message as

" Type not visible ; OppController.wrapperOpp" on the line "OppController.wrapperOpp Wrapvar = new OppController.wrapperOpp();"

 

Please help me in identifying the issue.

 

Thanks,

JBabu.

  • May 08, 2012
  • Like
  • 0