• Anu Raj.ax1269
  • NEWBIE
  • 76 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 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);
}
}

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??

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 

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.