• prady-cm
  • NEWBIE
  • 240 Points
  • Member since 2012

  • Chatter
    Feed
  • 9
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 65
    Questions
  • 100
    Replies

I need a solution for this requirment..could u please help me in this context.

 

I have two conditions where in the first one I have to display the value of Formula field by calculating its value in the controller itself.

In the second case i need to display its value from the page(formula given during the field creation) into the same controller..

 

It is something like

 if(true)

{

display field value by calculating it in the controller

}
else

{

  display the value of the formula field directly

}

 

The testr class below is not covering the class at all. Why and what do I need to change for the test class to cover the apex class?

 

Test code

@IsTest public class TestAddCustomerProductStage1create {

    /* This is a basic test which simulates the primary positive case for the 
       save method in the AddCustomerProduct class. */

public static testMethod void myUnitTest() {

    PageReference pageRef = Page.CustomerProductStage1create;
    
    Test.setCurrentPageReference(pageRef);
    
    Customer_Product_Line_Item__c c = new Customer_Product_Line_Item__c(name='Apple');
    insert c;
    
    System.assert (true, [select name from Customer_Product_Line_Item__c where name = 'Apple']);
    
    Account acc=new Account(Name='test', BillingStreet='test', BillingCity='NY', BillingState='test',
                BillingCountry='US', BillingPostalCode='test', ShippingStreet='test', ShippingCity='test',
                ShippingState='NY', ShippingCountry='US', ShippingPostalCode='test');
insert acc;                


Opportunity testOpp = new Opportunity(Name='TestOppty',closedate=date.parse('1/1/2222'),
                    stagename = 'prospecting',AccountID=acc.id,Equip_Services_Options_to_be_quoted__c='test', 
                    Opportunity_Region__c='test');
insert testOpp;   

Customer_Product_Line_Item__c testcp = new Customer_Product_Line_Item__c(Name='Apple',Opportunity__c = testOpp.id);
insert testcp;

               ApexPages.StandardController sc = new ApexPages.StandardController(testCP);     
    
     String cpUrl = '/apex/customerproductstage1create?oppid=' + testOpp.id;
     
        System.Debug('++++++++++++'+cpUrl);
    
     PageReference ref = new PageReference(cpUrl);
     
     Test.setCurrentPage(ref); 
     
     Test.startTest();
     
     Customer_Product_Line_Item__c cl = new Customer_Product_Line_Item__c(name='Apple');
    insert cl;

     
     test.stopTest();
     
     /* Construct the standard controller for Customer Product. */

    Account ac=new Account(Name='test', BillingStreet='test', BillingCity='NY', BillingState='test',
                    BillingCountry='US', BillingPostalCode='test', ShippingStreet='test', ShippingCity='test',
                    ShippingState='NY', ShippingCountry='US', ShippingPostalCode='test');
    insert ac;
 
     Opportunity testpp = new Opportunity(Name='TestOppty',closedate=date.parse('1/1/2222'),
                        stagename = 'prospecting',AccountID=acc.id,Equip_Services_Options_to_be_quoted__c='test', 
                        Opportunity_Region__c='test');
    insert testpp;
    
    Customer_Product__c cp = new Customer_Product__c(Name='apple');
    insert cp;
    
    Customer_Product_Line_Item__c cpli = new Customer_Product_Line_Item__c (Name= cp.name, Opportunity__c=testpp.id);
    insert cpli;
    
          ApexPages.StandardController con = new ApexPages.StandardController(new Customer_Product_Line_Item__c());
          
    //  Customer_Product_Line_Item__c cplitem = Testaddcustomerproductstage1create.setupTest();
       PageReference p = new PageReference('/apex/CustomerProductStage1create');
       p.getParameters().put('oppid', testpp.id);
       
       Test.setCurrentPage(p);
       ApexPages.currentPage().getParameters().put('oppid', testpp.id);
       }

     public static void setupTest() {

        /* Create an account */
        Account a = new Account();
        a.name    = 'TEST';
        Database.insert(a);

        /* Get the standard pricebook. There must be a standard pricebook already 
           in the target org.  */
        Pricebook2 pb = [select name, isactive from Pricebook2 where IsStandard = true limit 1];

        if(!pb.isactive) {
            pb.isactive = true;
            Database.update(pb);
        }

        /* Get a valid stage name */
        OpportunityStage stage = [select MasterLabel from OpportunityStage limit 1];

        /* Setup a basic opportunity */
        Opportunity o  = new Opportunity();
        o.Name         = 'TEST';
        o.AccountId    = a.id;
        o.CloseDate    = Date.today();
        o.StageName    = stage.masterlabel;
        o.Pricebook2Id = pb.id;

        /* Create the opportunity */
        Database.insert(o);
        
        Customer_Product_Line_Item__c cpli = new Customer_Product_Line_Item__c();
        cpli.name = 'Apple';
        cpli.Opportunity__c = o.id;
        
        Database.insert(cpli);

        PageReference pref = Page.CustomerProductStage1create;
        pref.getParameters().put('cpli.id',cpli.id);
        Test.setCurrentPage(pref);

   //     return null;
               
    }

}

 Apex class

public class AddCustomerProductStage1create{

/* Constructor Function. The CustomerProduct id is captured in this function */

public Customer_Product_Line_Item__c cpl {get;set;}
public Opportunity o;
public AddCustomerProductStage1create(ApexPages.StandardController c)
{
            o = [select id from Opportunity where id =
                       :ApexPages.currentPage().getParameters().get('oppid')];
}

      public Opportunity getOpportunity() {
            return o;
      }

/* Variable declarations */

public List<cCustomer> cpList {get; set;}                              // Wrapper class which stores customer product data and a boolean flag.
public List<cCustomer> cpsel{get; set;}
public ID oid {get; set;}

String userinput;                                                               // cp Name
String userinp;  



Public List<Customer_Product__c> results = new List<Customer_Product__c>();                 // Customer_Product__c search results.

Public List<Customer_Product__c> selproduct = new List<Customer_Product__c>();                 // Customer_Product__c selectedproduct.

/* End of Variable declarations */

/* Getter and setter methods for getting the user input ie. Customer_Product__c name from the UI */

public String getuserinput(){return userinput;}
public void setuserinput(String userinp)
{

this.userinput=userinp;
system.debug('*****SFDC-TEST-1**********'+userinput+'='+userinp);

}
public String getselproduct(){return null;}

/*End of Getter and Setter methods */

/* Method to Search the Customer_Product__c database to return the query results */
public List<Customer_Product__c> cpsearch()
{
     cpList = new List<cCustomer>();
     for(Customer_Product__c c : [select id, name from Customer_Product__c where Name like :userinput+'%'order by Name asc])
     {
         cpList.add(new cCustomer(c));
        
     }
system.debug('*****SFDC-TEST-2**********'+cpList);
 return null;
}
/* End of method */


/* Method for returning the Customer Product search results to the UI */
public List<cCustomer> getresults(){
    
 return cpList;

}
    public PageReference processSelected() {

                //We create a new list of Customer Products that we be populated only with Customer Products if they are selected
        List<Customer_Product__c> selectedProduct = new List<Customer_Product__c>();

        //We will cycle through our list of cCustomer and will check to see if the selected property is set to true, 
        //if it is we add the Customer Product to the selectedProduct list
        for(cCustomer cCon : getresults()) {
            if(cCon.selected == true) {
                selectedProduct.add(cCon.con);
                
                
            }
        }
system.debug('*****SFDC-TEST-3**********'+selectedProduct);
        // Now we have our list of selected products and can perform any type of logic we want
        System.debug('These are the selected Products...');
        for(Customer_Product__c cCon : SelectedProduct ) {
            system.debug(cCon);
            
            selproduct.add(cCon);
            
        }
         system.debug('*****SFDC-TEST-4**********'+selproduct.size());

    cpsel = new List<cCustomer>();
     for(Customer_Product__c p : [select name from Customer_Product__c where id =:selproduct])
     {
     system.debug('*****SFDC-TEST-p**********'+p.name);
       cpsel.add(new cCustomer(p));
       
        Customer_Product_Line_Item__c cpli = new Customer_Product_Line_Item__c(Name = cpsel[0].con.name, 
                Opportunity__c = o.id);
      
      insert cpli;
      system.debug('*****test cpli.name**********'+cpli.name);     
     }
         PageReference home = new PageReference('/' + o.id);
        home.setRedirect(true);
        return home;

  system.debug('*****SFDC-TEST-5**********'+cpsel.size());
        return null;
    }


/* Wrapper class to contain contact record and a boolean flag */
public class cCustomer{
 public Customer_Product__c con {get; set;}
 public Boolean selected {get; set;}

 /*This is the contructor method. When we create a new cContact object we pass a
 Contact that is set to the con property. We also set the selected value to false*/
 public cCustomer (Customer_Product__c c)
 {
     con = c;
     selected = false;
 }
}

/* end of Wrapper class */    

}

 Thank you

I am playing around with the mobile sdk and in the mobile sdk sample contactExplorer, i am adding a functionality of getting the chatter feeds of the logged in user.

In my index.html

i added a href tag to display a new link to fetch the chatter feed

<p><a href="#" id="link_fetch_sfdc_chatter" data-role="button" data-inline="true">Fetch Chatter</a></p>

and in the inline.js i added the following code

$j('#link_fetch_sfdc_chatter').click(function() {
                                     logToConsole("link_fetch_sfdc_chatter clicked");
                                            forcetkClient.chatterFeedsCurrentUser(onSuccessSfdcAccounts, onErrorSfdc);
                                     });

Here i am calling a function to get the feeds and pass the response to callback method onSuccessSfdcAccounts.

here is the chatterFeedsCurrentUser method on my forcetk.mobilesdk.js

  forcetk.Client.prototype.chatterFeedsCurrentUser = function(callback, error) {
alert('calling from forcetk');
    return this.ajax('/' + this.apiVersion + '/chatter/feeds/news/me/feed-items', callback, error);
}

Here is the onSuccessSfdcChatter method

function onSuccessSfdcChatter(response) {
    var $j = jQuery.noConflict();
    alert('Chatter success method!');
    cordova.require("salesforce/util/logger").logToConsole("onSuccessSfdcChatter: received " + response.totalSize + " Feed Items");

    $j("#div_sfdc_contact_list").html("")
    var ul = $j('<ul data-role="listview" data-inset="true" data-theme="a" data-dividertheme="a"></ul>');
    $j("#div_sfdc_contact_list").append(ul);

    ul.append($j('<li data-role="list-divider">Feed Items: ' + response.totalSize + '</li>'));
    $j.each(response.records, function(i, items) {
           var newLi = $j("<li><a href='#'>" + (i+1) + " - " + items.body.messageSegments.text + "</a></li>");
           ul.append(newLi);
           });

    $j("#div_sfdc_contact_list").trigger( "create" )
}

The issue i am facing is that chatterFeedsCurrentUser method is not calling the callback method. The alert 'calling from forcetk' is only displayed after which nothing happens. I am not sure what i am doing wrong here.

I am working on hybrid app on a android.

I have a VF page which does among other things allows resetting of passwords of users. I am using System.resetPassword(usrid,true) to send emails to user whose password is been reset.

 

This functionality works fine in sandbox and i receive the reset emails. But when i move this code over to production and this production system uses a custom domain, this reset doesn't work.

 

Is there a different way the resetpassword needs to set while using custom domains? We are using salesforce communities and the user whose pwd is reset is a community user.

 

Thanks

Which field shows the type or name of the object in the items to approve list.

I could not find anything on the ProcessInstanceWorkitem..

 

Thanks

I am trying to show a group of reports that are accessible by the logged in user in a VF page. Is there are any object where this info is stored ?

Any pointers would be of great help.

Thanks

I have a csv file as a static resource and i am allowing users to download this file using the following.

 

<a href="{!URLFOR($Resource.AccountUploadTemplate)}" target="_blank">Click here </a>

The issue i face is that the download file does not have an extension and file type is File when viewed in windows explorer.

Is there anyway we can force it to save with an extension?

 

 

 

 

Has anyone tried to create a VF page similar to the standard lead conversion screen.  We need to have an event instead of task.

I am stuck at replicating the select account feature with a select box and lookup icon to select an existing account.

 

Does anyone have a code base on this which i can refer to

 

Thanks in advance

I am trying to get the native lookup window to open up and when the value is selected needs to populate a hidden field.

I am able to call the lookup function, but when i select the value nothing happens, the lookup window doesnt close and value is not posted into the hidden field.

 

function showLookup(ctrlID,objKeyPrefix) 
    { 
        openLookup("/_ui/common/data/LookupPage?lkfm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput&lknm="+ ctrlID +"&lktp="+objKeyPrefix,500);           
     }

<apex:inputText id="vField_AccountName_lkid" value="{!s.selectedAccount}"/>           
<apex:image url="/s.gif" alt="Lookup (New Window)" styleClass="lookupIcon" onmouseout="this.className = 'lookupIcon';this.className = 'lookupIcon';" onmouseover="this.className = 'lookupIconOn';this.className = 'lookupIconOn';" onclick="javascript&colon;showLookup('ConvertwithInputs:pbmconvertInput:pbformmconvertInput:pbsmconvertInput:pbspbtable:' + jQuery(this).closest('tr').prevAll('tr').length + ':vField_AccountName','001')" title="Lookup (New Window)"/>

 

The url generated in the lookup used by the above window is

https://c.na15.visual.force.com/_ui/common/data/LookupPage?lkfm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput&lknm=ConvertwithInputs:pbmconvertInput:pbformmconvertInput:pbsmconvertInput:pbspbtable:0:vField_AccountName&lktp=001

The url when you click on search result is

https://c.na15.visual.force.com/_ui/common/data/LookupResultsFrame?lktp=001&lknm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3AvField_AccountName&lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput#

To test the urls i also had a standard lookup and the url generated is

https://c.na15.visual.force.com/_ui/common/data/LookupPage?lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput&lknm=massConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3Aj_id7&lktp=001&lksrch=

The link on the search result for standard lookup is

https://c.na15.visual.force.com/_ui/common/data/LookupResultsFrame?lktp=001&lknm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput%3ApbsmconvertInput%3Apbspbtable%3A0%3Aj_id7&lksrch=&lkfm=ConvertwithInputs%3ApbmconvertInput%3ApbformmconvertInput#

The standard lookup for standard lookup field works fine

Where does the closing of lookup window happen?

Any pointers on what is happening while clicking of search result, where does the closing and assigning of value happen?

Thanks

i have a list of sub family names which i am sorting using list.sort()

The subfamily names are like

familyname - 1 - parts
familyname - 2 - parts1
familyname - 3 - parts2
familyname - 11 - parts2

So when i sort, the result is like this

familyname - 1 - parts
familyname - 11 - parts2
familyname - 2 - parts1
familyname - 3 - parts2

We have familyname - 11 - parts2 coming after familyname - 1 - parts which is understandable as its sorting as a string.

Is there workaround over this? One way i am thinking is to split the string, store the number into a map with number and the family name. But this approach would fail, when i have another like familyname2 - 1 - parts

Any thoughts?

What does it cost to host an app in appexchange?

I am trying to see if i can get a 7 day of view of the calendar of the assigned user. We currently have it a one day view.

Is this possible?

 

I couldnt find any way of configuring that in the event layouts.

If this is not possible through configurations, is it possible through VF page? Any pointers would be great help.

 

 

 

 

 

Thanks

I have 2 custom objects(sales and service) which are related to accounts as a lookup and related to opportunities in a master detail.

i need to generate a report which shows under each account the list of sales and service records.

Not sure how i can build this relationship in report types

I have an PageBlockTable which has a wrapper class as its value.

 

Every time a command button is clicked to add a product, a new row is added to the wrapper class and the PageblockTable is rerendered to display the new row.

 

All these work but when the rerender happens the selectedValue in the selectList is reset to the first item on the selectList.

How can i have the selectList to maintain state?

 

 <apex:commandButton action="{!addNewProduct}" value="Add New Product" rerender="pbtExistingInstItems,PBCopyProdToInstItems"/>
    <apex:selectList id="slprodname" value="{!itw.installedItem.Product__c}" size="1" rendered="{!itw.isManuallyCreated ==  true}" >
                <apex:selectOptions value="{!prodList}"/>
                <apex:actionSupport event="onchange" action="{!updateDefaultProductValues}"  rerender="colInstallationName">
                </apex:actionSupport>
    </apex:selectList>

 

Hi,

 

I am assiging a task to an account. When i query the account i cant see the assigned task in openactivities or Activityhistories. Any idea this doesnt come in

static testMethod void AccountWithOpenTask() 
    {
    	Account a = new Account(name ='Test Account');
        insert a;
        
        Task t = new task();        
        t.Whatid = a.id;
        t.Subject = 'Call';
        t.Status = 'In Progress';
        t.Priority = 'Normal';
        
        insert t;
        
        Task tk = [SELECT Id, LastModifiedDate,whatID,What.name FROM Task WHERE Id = : t.Id];
        system.debug('Task is '+ tk);
        
        
        List<Account>	acc=	[SELECT Id, Name, 
                                (SELECT Id, Subject,CreatedDate,LastModifiedDate FROM OpenActivities WHERE (NOT Subject LIKE '%Mass Email%') ORDER BY LastModifiedDate DESC LIMIT 1 ),
                                (SELECT Id, Subject,CreatedDate,LastModifiedDate FROM ActivityHistories WHERE (NOT Subject LIKE '%Mass Email%') ORDER BY LastModifiedDate DESC LIMIT 1  )
                         FROM Account ];
        System.debug('acc in Test class ' + acc);//returns name and ID
        System.debug('OpenActivities in Test class ' + acc[0].OpenActivities);// these return nothing
	System.debug('ActivityHistories in Test class ' + acc[0].ActivityHistories);// these return nothing

 

Can we get the Select Invitees widget(related list not sure what to call it) on a VF page? We can find this on the bottom of the events standard page.

I am trying to create a Vf page to enter event details

 

I have a lookup field called account__c in my object. I am using this on my VF page using apex:inputField. I do get the inputbox as well as the magnifying class icon for me to select the accounts.

I want to hide the inputbox and only show the magnifying glass icon. User should be allowed to click on the icon and choose the account and value should be avialble on account__c .

I thought of hiding the inputbox using css. The id of the inputbox is

 Page1:Form:Pblock:pbSection:pbsiAccountName:ifAccountName_lkid

and the id for the icon is

Page1:Form:Pblock:pbSection:pbsiAccountName:ifAccountName_lkwgt

Note : the Id of account is ifAccountName in Vf page, the '_lkid' and _lkwgt are generated when i view the pagesource. I also have a style tag defined in my Vf page just below the tag

<style> 
#leadConversionPage:leadConversionForm:pBConvertLead:pbSectionLeadSection:pbsiAccountName:ifAccountName_lkid
{
display:none;
}
</style>

This still doesnt hide the inputbox. Cant seem to figure out what is causing the input box to visible. does any one have a better way of hiding the input box

Hi,

 

I am doing a lead conversion thorugh apex. When the lead is converted it should only create account and contact and should not create opportunity.

 

I am having a new VF page to override the standard conversion page. But how can i make sure that opportunity doesnt get created. We have a checkbox to prevent opportunities to created from the UI, how can i incorporate it in my VF page?

 

Thanks

Hi,

 

I am salesforce developer with over 3 yrs experience in developing salesforce apps.


I am currently accepting small and large projects. I have over 12 years experience developing enterprise solutions in multiple technologies and i am available to take up new projects. I do money back guarantee.

 

You can reach me at pradykris@gmail.com

 

Thanks

Prady

i had built up a wrapper class to display in the format below.

 

 Area            Allocated   Currently available
 - New York       20              15
    Vendor1       10              10
    Vendor2       10              5

 - Philadelphia   10              8
    Vendor1       5               5
    Vendor2       5               3

where values in Newyork are a sum of values of vendors under it

 

The Wrapper class is like this

 

public class HDDevicesbyArea
    {
        public string HD_Area{get;set;}
        public double HD_Current {get;set;}
        public string HD_Allocated {get; set;}
        List<HDDevicesbyVendor> ListHDDevicesbyVendor {get; set;}
        public HDDevicesbyArea ( string HD_Area_v, string allocated_v, List<HDDevicesbyVendor> ListHDDevicesbyVendor_v )
        {
         // constructor code
        }

 I am having another wrapper to hold the data of vendors and which is part of the main wrapper HDDEvicesByArea. One issue i am facing is to display the HDDevicesByVendor in the same columns of HDDEvicesByArea.

 

Is there a way we can do it?

I am trying to add user to a chatter group from apex. I am getting an error

    "Error [statusCode=INVALID_CROSS_REFERENCE_KEY, code=[xmlrpc=1202, statusCode=INVALID_CROSS_REFERENCE_KEY, exceptionCode=INVALID_CROSS_REFERENCE_KEY, scope=PublicApi, http=400], message=This user can't be added to the group., fields=null]"

 




Here is the code i am using

 

    lstCGM.add(new CollaborationGroupMember(CollaborationGroupId = lCGA[k].Chatter_Group_ID__c ,
                                                            // CollaborationRole = 'Member',
                                                            MemberId = u[i].Id    ));

    //Debugging
        for(CollaborationGroupMember cgmr : lstCGM)
        {
            system.debug('Processing the CGM record ' + cgmr);
        }
        
        if (lstCGM.size() > 0)
           {
               // Insert the CGM Records
            Database.SaveResult[] lsr = Database.insert(lstCGM, false);
                
            // Loop through the save results writing errors to the debug log
            for (Database.SaveResult sr : lsr)
              {
                if(!sr.IsSuccess())
                {
                     Database.Error err = sr.getErrors()[0];
                      System.debug(err.getMessage());
                  }
             }  // END LOOP through the save results writing errors to the debug log
         }// END IF there are records to insert, insert them.

 


The debug logs return the correct ids

 

  Processing the CGM record CollaborationGroupMember:{CollaborationGroupId=0F9E00000008cpwKAA, MemberId=005c0000000R2kQAAS}
    USER_DEBUG|[275]|DEBUG|This user can't be added to the group.

 



Checked the ids on the browser and they were valid.
Any idea what should be causing this?

I have a formula field on Opportunity Product which i need to show on the Opportunity product Mulitline Edit page. I cant seem to get the formulafield on the available Fields List.

I understand that we cant see a formula field on edit or new records and hence maybe these fields are not visible. Am i correct ?

Is there any other way we could get it displayed?

 

I would think VF page is the only option and override the standard page.

If this is the only way then i want to understand how do we capture the selected products from previous seach product screen.?

 

Any pointers would be of great help

 

Thanks

 

I am playing around with the mobile sdk and in the mobile sdk sample contactExplorer, i am adding a functionality of getting the chatter feeds of the logged in user.

In my index.html

i added a href tag to display a new link to fetch the chatter feed

<p><a href="#" id="link_fetch_sfdc_chatter" data-role="button" data-inline="true">Fetch Chatter</a></p>

and in the inline.js i added the following code

$j('#link_fetch_sfdc_chatter').click(function() {
                                     logToConsole("link_fetch_sfdc_chatter clicked");
                                            forcetkClient.chatterFeedsCurrentUser(onSuccessSfdcAccounts, onErrorSfdc);
                                     });

Here i am calling a function to get the feeds and pass the response to callback method onSuccessSfdcAccounts.

here is the chatterFeedsCurrentUser method on my forcetk.mobilesdk.js

  forcetk.Client.prototype.chatterFeedsCurrentUser = function(callback, error) {
alert('calling from forcetk');
    return this.ajax('/' + this.apiVersion + '/chatter/feeds/news/me/feed-items', callback, error);
}

Here is the onSuccessSfdcChatter method

function onSuccessSfdcChatter(response) {
    var $j = jQuery.noConflict();
    alert('Chatter success method!');
    cordova.require("salesforce/util/logger").logToConsole("onSuccessSfdcChatter: received " + response.totalSize + " Feed Items");

    $j("#div_sfdc_contact_list").html("")
    var ul = $j('<ul data-role="listview" data-inset="true" data-theme="a" data-dividertheme="a"></ul>');
    $j("#div_sfdc_contact_list").append(ul);

    ul.append($j('<li data-role="list-divider">Feed Items: ' + response.totalSize + '</li>'));
    $j.each(response.records, function(i, items) {
           var newLi = $j("<li><a href='#'>" + (i+1) + " - " + items.body.messageSegments.text + "</a></li>");
           ul.append(newLi);
           });

    $j("#div_sfdc_contact_list").trigger( "create" )
}

The issue i am facing is that chatterFeedsCurrentUser method is not calling the callback method. The alert 'calling from forcetk' is only displayed after which nothing happens. I am not sure what i am doing wrong here.

I am working on hybrid app on a android.
Hi,

I've List button attached VF page on 'Sys' Object .This Vf page has input fields of 'Comp' Object and I need to populated

selected 'Sys' obj records tot amt into one of 'Comp' obj input field while loading...

In controller I got the tot amt of selected 'Sys' obj record..

So How to populate one obj amt value from apex controller to  VF page input field???

   public Comp__c comp{get;set;}

   public SYS__c sys{get;set;}
    List<FTS__c> arrySys=new List<FTS__c>();

 public Sysextn(ApexPages.StandardSetController controller) {
    arrySys= (List<Sys__c>) controller.getSelected();
      
        -----
         ----} some code 
   
    TotAmt=TotAmt+SYS__c.Total__Amt__c;
 System.debug('TotAmt******'+TotAmt); --> getting Amt of selected SYS record.
     comp.amt__c=TotAmt; --> Getting null pointer exception..
                     
}

<apex:page standardcontroller="Sys__c" extensions="Sysextn" recordsetvar="ft">

<apex:pageBlockSection columns="2" >
<apex:inputField value="{!comp.name}" /> 
<apex:inputField value="{!comp.amt__c}" /> -> how to assign Totamt into this...

 

  • March 20, 2013
  • Like
  • 0

trigger MyCaseFirstFile on Case (Before insert)
{
for(Case ca:Trigger.new)
{
Contact con=[Select Phone,Name from Contact where (Account acc=[Select id, AnnualRevenue,Rating from Account where id=:con.Accountid)]];
Phone=9999999999;
update con;
}
}

 

  • While we are trying to run a test class from the UI by clicking the ‘Run Test’, I am getting the following error:

  Unable to process the request

Concurrent requests limit exceeded.

 

  • If  we are  trying to run a test class from developer console then I am getting the error: “AsyncApexTests Limit exceeded”.

 

 Any help is much appreciated.

I was trying to Create a Quote for an Opportunity using an Custom Object "Order".we have enabled  Quote for Opportunity  and taken a Custom Object.


We have a  Master Relation ship from Order to Quote .After Creating a Quote it will be generating a Quote Record in Quote we have to Create a createOrder Button so  when we click on the createOrder in Quote it should generate a Record automatically in the Order Object. here is the Code we have Tried with the PageReference but we cannot able to create the Record automatically.


can you please help me out from this,it would be very helpfull................

Class:

Public class CreateOrder
{
//Quote variable q2

public quote q2;

//Create a constructor

public CreateOrder(ApexPages.StandardController cont)

 {
          this.q2 = (Quote)cont.getRecord();
 }

 //Method for creating a order record.


Public pagereference  createorder1()
{
Quote q1=[Select name,quotenumber,email from quote where id=:q2.id];

//creating an order


Order__c  o1= new Order__c();
 o1.name='ParkerOrder';
o1.QuoteNumber__C= q1.QuoteNumber;
insert  o1;

//to navigate currently created order record


Order__C o2=[select id from  Order__c  where id=:o1.id];

PageReference orderhome = new ApexPages.StandardController (o2).edit();
 //PageReference  orderhome = new PageReference('/' +'2F0Q090000000ATox');


orderhome.setRedirect(true);
return orderhome;

}
}



VisualForcePage:

<apex:page standardController="Quote" extensions="CreateOrder" showHeader="false" action="{!createorder1}"> </apex:page>

I need a solution for this requirment..could u please help me in this context.

 

I have two conditions where in the first one I have to display the value of Formula field by calculating its value in the controller itself.

In the second case i need to display its value from the page(formula given during the field creation) into the same controller..

 

It is something like

 if(true)

{

display field value by calculating it in the controller

}
else

{

  display the value of the formula field directly

}

 

hi community,

 

how can i update a pageblock table selected row(record) . there is a button or checkbox on each row.

 

I tried wrapper class, but not succeded.

 

the difference i noticed when i work on the online available wrapper class and my vfPage with wrapper class is , when is select a check box and click on button to process the check box going unchecked.  so ultimately there will no selected records to process.

 

Any help is appricaited.

Thanks.

 

 

Hi All,

 

I have the following trigger to get a sum of all the opportunity amount under an account(as we have advanced multi currency enabled so trying to create a custom roll up summary field).

 

How to bulkify this trigger?Plz help.

 

trigger tgr_change_in_amount on Opportunity (after insert,after update,before delete) {

 for (Opportunity opp: Trigger.new) {
                    if(opp.accountid != null){
                                                       
                            Integer amt;
                            AggregateResult[] groupedResults  = [SELECT SUM(Amount)aver FROM Opportunity where accountid =:opp.accountid];
                            for (AggregateResult ar : groupedResults) { 
                               amt =  Integer.valueOf(ar.get('aver'));
                            }
                           
                            List<Account>lstAccount = new List<Account>();
                            lstAccount = [select Total_Amt_of_Open_Opportunities__c from Account where id=:opp.accountid];
                            lstAccount[0].Total_Amt_of_Open_Opportunities__c = amt;
                           
                            update lstAccount;
                    }
            }

}

  • February 15, 2013
  • Like
  • 0

Hi All,

 

I need help with my trigger.  I have an Account with a lookup relationship to a custom object (Practice_Location__c).  I want to auto populate the lookup field (Practice_Location__c) on the Account after creating a Practice Location record.  Account and Practice_Location__c objects have NPI_Number__c (short text data type) field in common, which I am using to map.  My trigger below is not updating the Practice_Location__c field on the Account.  Please advice. 

 

 

 

trigger SoloPractice on Practice_Location__c (after insert, after update) {


if (Trigger.isInsert){
map<String, ID> mapnpi = new map<String, ID>();

// loop through trigger and add NPI and Practice Location ID to map
for (Practice_Location__c p : trigger.new){
if (p.Type_of_Location__c == 'Solo Practice'&& p.Status__c == 'Active'){
mapnpi.put(p.NPI_Number__c,p.Id);

}
}
// create a map of Doctors (Account)
map<String, Account> accts = new map<String, Account>([
Select Id, Practice_Location__c, NPI_Number__c from Account Where RecordTypeId = '01I700000001xE2' AND NPI_Number__c in :mapnpi.keyset()
]);

// iterate over the list of Doctors (Account) and assign the Practice_Location__c
for (Account acct : accts.values()) {
acct.Practice_Location__c = mapnpi.get(acct.NPI_Number__c);
}
update(accts.values());

}
}

  • February 12, 2013
  • Like
  • 0

HI,

 

There is possibility to have blank values for a column in one of the object.

I am want to write a query to eliminate blank records.

 

I tried with distinct, but it doest work.  I know distinct is for eliminating duplicate records.

select dintinct(comments__c) from CsoObject__c where Product = 'Card';

 

Thanks

Arjun.

Hi,

 

How can we set the value of checkbox?

 

i have setup the value of checkbox to true in my page but it is not getting save as i m redirecting page to other URL.

 

URL.getSalesforceBaseUrl().toExternalForm() and checkbox value is not getting set.

 

Can anyone please guide?

 

Hi,

 

Can we replace the standard salesforce home page with our own custom Visualforce page? can anybody answer for me please..

 

Regards,

Sujan

Hi,

 

Can we hide home tab in force.com environment, if not can we rename this tab name?

Thanks

 

 

Sq

  • June 21, 2010
  • Like
  • 0

hi all,

        This is my first post here. So first hi to everyone.

           I want to remove or override the home tab which salesforce provides by default in customer portal and in partner portal. I am just not finding any way to do that. Can anyone guide me on the correct path??

 

Thanking you

Regards

Sarthak

Hello,
 
I was wondering if there's a quick and easy way to throw a stock ticker on the left side of your home tab.
 
Thanks,
Brian
  • February 14, 2008
  • Like
  • 0