• sweetz
  • NEWBIE
  • 152 Points
  • Member since 2012

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 7
    Questions
  • 63
    Replies
Hi,
I want to apply validation rules which get checked upon creating an account. But after testing them and trying very basic rules which should always fire, my rules don't fire at all and the Account-Object gets created. They are set active, are syntactically correct. I created them in Customize > Accounts > Validation Rules. The formular basically looks like this:

AND(
OR( BillingCountry = "Canada", BillingCountry = "France" ),
OR( ShippingCountry = "Canada", ShippingCountry = "France" )
)

I know it's supposed to be easy but somehow I can't get it done. Any hint is appreciated, thank you!

This seems like a dumb question. So dumb, in fact that I'm having trouble finding the answer to it. To preface. I am not an Apex Developer(I'm a C# guy). I've just been helping out a friend get some stuff done. I've pretty much taken care of all the hardest parts of the code, but this last one is baffling me.

I need to update a field on the Lead record from the results of a SOQL query to a custom entity.

The problem is, I have no idea how to retrieve anything from the query. For most of my coding to now, I've used the List<> to get things to match up right for the rest of the code. But I can't seem to get that field value out of it. Here is the list. Any help... from anyone. (even if it is just to point me in the right direction) would be very helpful. Thanks.
(I need the value in the TFA_Salesforce_ID__c field on the Member_Verification__c Entity as a string value)

   list<String> leadEmails= new list<String>();
    for (Lead lead:Trigger.new) {
        leadEmails.add(lead.Email);
    }
    
    list<Member_Verification__c> emails = [
        Select  id, Primary_Email__c,TFA_Salesforce_ID__c
        from Member_Verification__c
        where (Primary_Email__c != null and Primary_Email__c in :leadEmails)
    ];

 

Hi All,

I have a two objects like doctor(parent) and patient(child), my scenario is i have to count a child records on parent object by using trigger.

(using rollup summary we can achieve this but i have to achieve with trigger)

please any one help me with code for this scenario.

Thanks in advance!!!
  • September 17, 2014
  • Like
  • 0
Hi All,

  I have created custom application like Education.In  this app contains 3 objects i.e Students(fields like Name,Age,Class),Teachers(fields like Name,Age,Subject,Experience),Classrooms(Room no).

I want to deploy objects ,fields and Whatever Classes,Visualforce pages,Validations,Triggers related to app only but not all are present in instance of developer edition.

Can anyone help me.

Kindly support and suggest.

I've created a bunch of apex classes and triggers and placed them into a package which was then uploaded (via Salesforce -> Create -> Packages).

It produced a url for the package.

I've logged onto another Salesforce account and installed this package - and it seems what it did was just unpackage all the classes/triggers -- the functionality was working fine, but I could view all the code..

Is this all the package feature does? Provides a convenient way to pass classes from one place to another? Is there a way to conceal the classes from the user?

If I was to deploy this package to AppExchange, would people be able to view the code upon installing the app?

Or are the classes/triggers only viewable in developer accounts?
have a webservice written in .net which gets the request from the outbound message and sends the response. But salesforce keeps hitting my application and it still waits in outbound queue. How do I stop salesforce to hit the application once the response is received? Following is my code sample

notificationsResponse INotificationBinding.Pur(PTrans.notifications PurP)
    {
        string id,session = null;
        PTrans.notifications test = PurP;
        session = test.SessionId;
        string url = test.EnterpriseUrl;
        PTrans.Transaction__cNotification[] request = PurP.Notification;
        PTrans.notificationsResponse response = new notificationsResponse();
        response.Ack = true;
        return response;
    }
When I tested with soapui, I get the following response,

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">
         <Ack>true</Ack>
      </notificationsResponse>
   </soap:Body>
</soap:Envelope>
  • January 22, 2014
  • Like
  • 0

I have written a webservice in .net that receive the outbound message from salesforce. With the Id received from the Salesforce outbound message, I want to query the related objects and its fields. Can I achieve this without salesforce authentication? With the session id I get from outbound message can I query the objects? I am confused. Please help me out. 

  • November 06, 2013
  • Like
  • 0

Hi,

 I have webservice wriiten in .net which contains four methods. I want to call particular method so my url will be For eg., http://localhost/salesforce/MyNotificationListener.asmx.?q=abc . If i give this as an endpoint url in salesforce outbound message, will it work properly?. Am I doing it right?. Or should I give http://localhost/salesforce/MyNotificationListener.asmx. It may be simple but I m bit confused.

 

  • September 13, 2013
  • Like
  • 0

Hi ,

   I configured outbound message for a custom object. I have written webservice in .net WCF. In salesforce, Outbound delivery status throws an error , The message with Action  cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. When I checked with SOAP UI, It works fine. I am clueless, what is missing and why I get this error. Help please

 

  • September 12, 2013
  • Like
  • 0

Hi all,

 When I merge account, I want to get the deleted record id and update a field value for the newly merged record.

 

 

trigger accountMerge on Account (after delete) {
public ID MasterRecordIdfield = null;
Account[] acc= Trigger.old; 
MasterRecordIdfield = acc[0].MasterRecordId;
if(MasterRecordIdfield != null && String.valueOf(MasteRecordIdfield).length() >0)
{
Account[] acct = [select Id, name from account where id =:MasterRecordIdField];
for(Account acct:acc)
{
acct.Field_to_update__c = acct.name;
update acct;
}
}
}

 

 

When I execute this, I m getting the following error, I dont know where I am going wrong. Help Please.

 

Apex trigger then.accountMerge caused an unexpected exception, contact your administrator: then.accountMerge: execution of AfterDelete caused by: System.DmlException: Update failed. First exception on row 0 with id 0019000000K7lxGAAR; first error: SELF_REFERENCE_FROM_TRIGGER, Object 0019000000K7lxGAAR is currently in a merge operation, therefore a trigger can not update it.: []: Trigger.then.accountMerge: line 12, column 1

Hi all,

  When i merge account i want to trigger an outbound message. What are the criteria I need to take care of?  

Hi,

 I wanted to add a custom button in a standard list view page. That is when we click an object immediately we get a list view. How do i do that? Help pls. 

 

Hi All,

I have one visualforce page and controller. Visualforce page have some fields in which user enters a value and save the records. Now when a user click on save button the records is save to the object and the pdf is also generated for the same and attached to notes and attachment for the same object. Please help me i am stuck.

Thanks
Anjali
Hi I'm having some issue trying to generate a class from WSDL document.
I'm getting Error: Failed to parse wsdl: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema

Here is part of my WSDL document. 

<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/StandardCallAPI/SCAPI" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/StandardCallAPI/SCAPI">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/StandardCallAPI/SCAPI">
<s:import namespace="http://www.w3.org/2001/XMLSchema"/>
<s:element name="CreateUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AdvertiserExternalID" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="NewUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewEmail" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="phone" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="fax" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ExpirationDate" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="CreateUserResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CreateUserResult" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="UpdateUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AdvertiserExternalID" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="NewUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="NewEmail" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="phone" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="fax" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ExpirationDate" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="UpdateUserResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="UpdateUserResult" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="DeleteUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="DeleteUserResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="DeleteUserResult" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RetrievePermissionByUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AdvertiserExternalIDs" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RetrievePermissionByUserResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RetrievePermissionByUserResult" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="AdvertiserExternalIDs" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RetrieveUserByPermission">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginUsername" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="AdvertiserExternalID" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalIDs" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RetrieveUserByPermissionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RetrieveUserByPermissionResult" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="UserExternalIDs" type="tns:ArrayOfString"/>
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<wsdl:service name="APIWebService">
<wsdl:port name="APIWebServiceSoap" binding="tns:APIWebServiceSoap">
<soap:address location="http://api.standardcall.com/scportal.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Thanks.
I have tried

// comment
/* comment */
<!-- comment -->

Any other ideas what the syntax might be? Or is it not possible at all?
REST api enabled?
 
Hi 

I have a picklist with value Tea,coffee,Icecream

another picklist with value Yes or No Option

if i am selecting cofee and yes option it should update the 3 filed at a time 
like
Price
salestax
vat

how it is possible using workflow
Hi,
I want to apply validation rules which get checked upon creating an account. But after testing them and trying very basic rules which should always fire, my rules don't fire at all and the Account-Object gets created. They are set active, are syntactically correct. I created them in Customize > Accounts > Validation Rules. The formular basically looks like this:

AND(
OR( BillingCountry = "Canada", BillingCountry = "France" ),
OR( ShippingCountry = "Canada", ShippingCountry = "France" )
)

I know it's supposed to be easy but somehow I can't get it done. Any hint is appreciated, thank you!
Hi ,

Can anyone please provide some docs on Data Migration/Management Approach adopted typically in SFDC.

Regards
 
I would like to know the best way to query a hierarchical database to find parent, grandparent, great-grandparent... I think I need to use a combination of Apex and SOQL.  Once I'm at the top I need to find out who the Manager is for all the children.  I am trying everything I can think of to not have query governor issues. Any help would be greatly appreciated.

This seems like a dumb question. So dumb, in fact that I'm having trouble finding the answer to it. To preface. I am not an Apex Developer(I'm a C# guy). I've just been helping out a friend get some stuff done. I've pretty much taken care of all the hardest parts of the code, but this last one is baffling me.

I need to update a field on the Lead record from the results of a SOQL query to a custom entity.

The problem is, I have no idea how to retrieve anything from the query. For most of my coding to now, I've used the List<> to get things to match up right for the rest of the code. But I can't seem to get that field value out of it. Here is the list. Any help... from anyone. (even if it is just to point me in the right direction) would be very helpful. Thanks.
(I need the value in the TFA_Salesforce_ID__c field on the Member_Verification__c Entity as a string value)

   list<String> leadEmails= new list<String>();
    for (Lead lead:Trigger.new) {
        leadEmails.add(lead.Email);
    }
    
    list<Member_Verification__c> emails = [
        Select  id, Primary_Email__c,TFA_Salesforce_ID__c
        from Member_Verification__c
        where (Primary_Email__c != null and Primary_Email__c in :leadEmails)
    ];

 

@isTest
public with sharing class CP_AccountTabExtTest{

    /*** Instance Variables ***/
    
    /*** Static Variables (Static) ***/
    private static User userCPU;
    private static User userCPM;
    private static List<User> users;
    private static Map<Integer, Account> mapParentAccounts;
    private static Account parentAccount;
    private static Map<Integer, Account> mapChildAccounts;
    private static Map<Integer, Contact> mapContacts;   
    
    /*** Constant Variables (Static Final) ***/
    
    /*** Public Instance Methods ***/   

    /*** Private Instance Methods ***/  
    
    /*** Static Methods ***/        
            
    static void GenerateData()
    {
        Profile objProfile=[Select Id from Profile where Name=: CP_TestDataFactory.profileAdmin];
        UserRole objRole=[select id from UserRole where PortalType='None' limit 1];
        User objUser = new User(alias = 'TestUser', 
                          email='CP_TestDFUser@PhilipsOC.test',
                          emailencodingkey='UTF-8', 
                          lastname='Testing', 
                          languagelocalekey='en_US',
                          localesidkey='en_US', 
                          UserRoleId=objRole.Id, 
                          profileid=objProfile.ID,
                          country='United States',
                          timezonesidkey='America/Los_Angeles', 
                          username='CP_TestDFUser@PhilipsOC.test',
                          isActive = true);
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            insert objUser;
        }
        
        parentAccount = CP_TestDataFactory.GenerateParentAccount(objUser.Id);
        insert parentAccount;

        mapChildAccounts = CP_TestDataFactory.GenerateChildAccounts(250, parentAccount.Id);
        insert mapChildAccounts.values();
        
        mapContacts = CP_TestDataFactory.GenerateContacts(20, parentAccount.Id);
        insert mapContacts.values();
        
        Profile profileCPU = [select id from profile where name=: CP_TestDataFactory.profileCPU ];        
        userCPU = new User(alias = 'TestCPU', 
                          email='CP_TestDFUserCPU@PhilipsOC.test',
                          emailencodingkey='UTF-8', 
                          lastname='Testing', 
                          languagelocalekey='en_US',
                          localesidkey='en_US', 
                          profileid=profileCPU.ID,
                          contactId = mapContacts.get(1).Id,
                          country='United States',
                          timezonesidkey='America/Los_Angeles', 
                          username='CP_TestDFUserCPU@PhilipsOC.test',
                          isActive = true);     
        insert userCPU;     
        
        Profile profileCPM = [select id from profile where name=: CP_TestDataFactory.profileCPM ];        
        userCPM = new User(alias = 'TestCPM', 
                          email='CP_TestDFUserCPM@PhilipsOC.test',
                          emailencodingkey='UTF-8', 
                          lastname='Testing', 
                          languagelocalekey='en_US',
                          localesidkey='en_US', 
                          profileid=profileCPM.ID,
                          contactId = mapContacts.get(2).Id,
                          country='United States',
                          timezonesidkey='America/Los_Angeles', 
                          username='CP_TestDFUserCPM@PhilipsOC.test',
                          isActive = true);                 
        insert userCPM;         
        
        users = new List<User>();
        users.add(userCPU);
        users.add(userCPM);
    }
    static testMethod void testAll() {
           GenerateData();
           system.runAs(userCPU){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
            String q = 'SELECT Name FROM ACCOUNT LIMIT 1';
            ApexPages.StandardSetController ACC = new ApexPages.StandardSetController(Database.getQueryLocator(q));
            List<SelectOption> ListViews = ACC.getListViewOptions();
            System.assertEquals(ListViews , acExtController.getAccountExistingViews());
            List<Account> accounts = [Select Id, Name, AccountNumber, ShippingStreet, ShippingCity, ShippingState, 
                                     ShippingCountry FROM Account ORDER BY Name ASC LIMIT 10000];
            System.assertEquals(accounts , acExtController.getAccounts());
            PageReference expectedPage = Page.CP_AccountDetail;
            String nextPage = acExtController.AccountDetailPage;
            System.assertEquals(expectedPage.getUrl(), nextPage); 
            acExtController.resetFilter();
            acExtController.prev();
            acExtController.next();
            acExtController.lastPage();
            acExtController.firstPage();
            
        }
		   system.runAs(userCPM){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
            String q = 'SELECT Name FROM ACCOUNT LIMIT 1';
            ApexPages.StandardSetController ACC = new ApexPages.StandardSetController(Database.getQueryLocator(q));
            List<SelectOption> ListViews = ACC.getListViewOptions();
            System.assertEquals(ListViews , acExtController.getAccountExistingViews());
            List<Account> accounts = [Select Id, Name, AccountNumber, ShippingStreet, ShippingCity, ShippingState, 
                                     ShippingCountry FROM Account ORDER BY Name ASC LIMIT 10000];
            System.assertEquals(accounts , acExtController.getAccounts());
            PageReference expectedPage = Page.CP_AccountDetail;
            String nextPage = acExtController.AccountDetailPage;
            System.assertEquals(expectedPage.getUrl(), nextPage); 
            acExtController.resetFilter();
            acExtController.prev();
            acExtController.next();
            acExtController.lastPage();
            acExtController.firstPage();
            
        }	
    }
	static testMethod void testNext()}{
		GenerateData();
		system.runAs(userCPU){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
		system.runAs(userCPM){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
	
	}
	static testMethod void testPrev(){
		GenerateData();
		system.runAs(userCPU){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
		system.runAs(userCPM){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}	
	
	}
    static testMethod void testLast(){
		GenerateData();
		system.runAs(userCPU){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
		system.runAs(userCPM){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
	
	}
	static testMethod void testFirst(){
		GenerateData();
		system.runAs(userCPU){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
		system.runAs(userCPM){
            PageReference pageref = Page.CP_AccountTab;
            Test.setCurrentPage(pageRef);
            ApexPages.StandardController controller = new ApexPages.StandardController(parentAccount);
            CP_AccountTabExt acExtController = new CP_AccountTabExt();
		}
	}
    }



public with sharing class CP_AccountTabExt {

  /*** Instance Variables ***/

  public String AccountFilterId { get; set;}
  private String query = 'Select Id, Name, AccountNumber, ShippingStreet, ShippingCity, ShippingState, ShippingCountry FROM Account ORDER BY Name ASC LIMIT 10000';    
    private Integer pageSize = 50;
  
    /*** Static Variables (Static) ***/
    
    /*** Constant Variables (Static Final) ***/    
      
    /*** Public Instance Methods ***/
  public CP_AccountTabExt(){}
  
  public String AccountDetailPage {
    get{
            if(AccountDetailPage == null){
        PageReference accountDetail = Page.CP_AccountDetail;
                return accountDetail.getURL();
      }
      return '';
    }
    Set;
  }  

  public ApexPages.StandardSetController AccountSetController {
        get{
            if(AccountSetController == null){
                AccountSetController = new ApexPages.StandardSetController(Database.getQueryLocator(query));
                AccountSetController.setPageSize(pageSize);

                // We have to set FilterId after Pagesize, else it will not work
                if(AccountFilterId != null)
                {
                  AccountSetController.setFilterId(AccountFilterId);
                }
            }
            return AccountSetController;
        }set;
    }

  public CP_AccountTabExt(ApexPages.StandardSetController ssc) {  }

    //Navigate to first Page
    public void firstPage()
    {
      AccountSetController.first();
    }

    //Navigate to last Page
    public void lastPage()
    {
      AccountSetController.last();
    }

    //Navigate to Next page
    public void next()
    {
      if(AccountSetController.getHasNext())
      {
        AccountSetController.next();
      }
    }

    //Navigate to Prev Page
    public void prev()
    {
      if(AccountSetController.getHasPrevious())
      {
        AccountSetController.previous();
      }
    }

    public List<Account> getAccounts()
    {
      return (List<Account>)AccountSetController.getRecords();
    }

    //Get all available list view for Account
    public SelectOption[] getAccountExistingViews(){
        return AccountSetController.getListViewOptions();
    }

    /**
    * Reset List View
    */
    public PageReference resetFilter()
    {
      AccountSetController = null;
        AccountSetController.setPageNumber(1);
        return null;
    }
   
    
}

This will be a big help as I am new to salesforce test class.
I am trying to write a simple trigger for a custom field update(text to text)

trigger UpdateCompanyOverviewField on Trip_Report__c (before insert) {
    for( Trip_Report__c obj: trigger.new){
        if(Company_Name__c=Name){
            Company_Over__c = Company_Overview__c;
        }
    }
}

error: Variable does not exist: Company_Over__c

I am stumpmed as the API name for Company_Over__c checks out. Any help please
  • September 17, 2014
  • Like
  • 0
Hi All,

Any way to make Product entry compuslory for all opportunities other than just propmpting users to attach products to an opportunity?

Please advise.

Thanks,
  • September 17, 2014
  • Like
  • 0
I am going through the LightningComponents Developer Guide from DF'14 and after getting through the quick start section on setting up the expense app everything looks correct but it will not function correctly. The browser page for the app displays, I can enter the data into the fields, but there is an issue with the button click function. If I click the button with a null Amount__c value in place it does process the error, which is telling me it is calling the createExpense function and the if-else statement inside that function. Still, when I enter correct data, nothing is saved or listed. I'm including the code from the formControlle.js as I have it in the console. 

formController.js....
 
({
	doInit : function(component, event, helper) {
        
        //Update expense counters
        helper.getExpenses(component);
		},
    
    
    createExpense  : function(component, event, helper){
    
    	var amtField = component.find("amount");
    	var amt = amtField.get("v.value");
    		if (isNaN(amt) || amt==''){
    			amtField.setValid("v.value", false);
    			amtField.addErrors("v.value", [{message:"Enter an expense amount."}]);
				}
        	else{
            	amtField.setValid("v.value", true);
            	var newExpense = component.get("v.newExpense");
            	helper.createExpense(component, newExpense);
        		}
		},
    
})

formHelper.js.....
 
({
	getExpenses: function(component) {
        var action = component.get("c.getExpenses");
        var self = this;
        action.setCallback(this, function(a){
            conpoment.set("v.expenses", a.getReturnValue());
        	self.updateTotal(component);
                           });
    		$A.equenceAction(action);
		},
 updateTotal : function(component){
    var expenses = component.get("v.expenses");
    var total = 0;
    for(var i = 0; i<expenses.length; i++){
        var e = expenses[i];
        total += e.ascotest__Amount__c;
    }
    //Update counters
    component.set("v.total", total);
    component.set("v.exp", expenses.length);
  },
    
    
    createExpense : function(component, expense){
    	this.upsertExpense(component, expense, function(a){
    	var expenses = component.get("v.expenses");
    	expenses.push(a.getReturnValue());
    	component.set("v.expenses", expenses);
    	this.updateTotal(component);
		});
	},
        
    upsertExpense : function(component, expense, callback){
    	var action = component.get("c.saveExpense");
		action.setParams({
    		"expense": expense
		});
		if (callback) {    
    		action.setCallback(this, callback);
			}
	$A.equenceAction(action);
},
      
    
      
})

MIDAS.app.....
 
<aura:application>
    <link href='/resource/bootstrap/' rel="stylesheet"/>
    <div class="container">
    	<h1>Add Expense</h1>
        <ascotest:form/>
    </div>
</aura:application>

form.cmp....
 
<aura:component controller="ascotest.ExpenseController">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="expenses" type="ascotest.Expense__c[]"/>
    
    <aura:attribute name="newExpense" type="ascotest.Expense__c"
                     default="{ 'sobjectType': 'ascotest__Expense__c',
                              'Name': '',
                              'ascotest__Amount__c': 0,
                              'ascotest__Client_c': '',
                              'ascotest__Date__c': '',
                              'ascotest__Reimbursed__c': false
                              }"/>
   
    <!-- Attributes for Expense Counters-->
    <aura:attribute name="total" type="Double" default="0.00" />
    <aura:attribute name="exp" type="Double" default="0" />
    
    <!--Input Form using components -->
    <form>
    	<fieldset>
            <ui:inputText aura:id="expname" label="Expense Name" 
                          class="form-control"
                          value="{!v.newExpense.name}"
                          placeholder="My Expense" required="true"/>
            <ui:inputNumber aura:id="amount" label="Amount"
                            class="form-control"
                            value="{!v.newExpense.ascotest__Amount__c}"
                            placeholder="20.80" required="true"/>
            <ui:inputText aura:id="client" label="Client"
                            class="form-control"
                            value="{!v.newExpense.ascotest__Client__c}"
                          placeholder="ABC Co."/>
            <ui:inputDateTime aura:id="expdate" label="Expense Date"
                              class="form-control"
                              value="{!v.newExpense.ascotest__Date__c}"
                              displayDatePicker="true"/>
            <ui:inputCheckbox aura:id="reimbursed" label="Reimbursed"
                              value="{!v.newExpense.ascotest__Reimbursed__c}"/>
            <ui:button label ="Submit" press="{!c.createExpense}"/>         
                    
         </fieldset>
    </form>
    
    <!--Expense Counters-->
	<div class="row">
	
        <!--Change the counter color to red if the total amount is more than 100 -->
        <div class="{!v.total >= 100 ? 'alert alert-danger' : 'alert alert-success'}">
        <h3>Total Expenses</h3>$<ui:outputNumber value="{!v.total}" format=".00"/>
    	</div>
        
    	<div class="alert alert-success">
        <h3>No. of Expenses</h3><ui:outputNumber value="{!v.exp}"/>
        </div>
    </div>
    
    <!-- Display expense records -->
    <div class="row">
    
    	<aura:iteration items="{!v.expenses}" var="expense">
            <ascotest:expenseList expense="{!expense}"/>
        </aura:iteration>   
    </div>        
    
</aura:component>

ExpenseController.apxc...
 
public class ExpenseController {
    
    @AuraEnabled
    public static List<Expense__c> getExpenses(){
        
        return [SELECT id, name, amount__c, client__c, date__c,
               reimbursed__c, createdDate FROM Expense__c];
    }
    
    @AuraEnabled
    public static Expense__c saveExpense(Expense__c expense) {
        	upsert expense;
        	return expense;
    }
    
    

}

Only things I left out of the post are the .css files. 

I created a dev org pre-'15 release so I know the org supports Lightning. I have enabled Lightning components in the org. I have checked the code against the guide about 5 times now. Everything is identical except the namespace I added. 


Has anyone else ran into this yet? 
Several openings for Jaipur location, interested candidate please send your resumes on info@briskminds.com

1) Fresher (3 opening) - Must know Java, JS, HTML

2) Salesforce experienced developer (one opening for 2-3 years of experience) - Must have worked on Apex, Visualforce, Integrations, W/F, Approvals and a little knowledge on communities is needed

3) QA (one opening for 2-3 years of experience) - Must know automated testing (say selenium)

Please do respond ASAP, we need to fill these positions before October. Spread this to your friends who may be interested.

Thanks
Ankit Arora
Briskminds Software Solutions Pvt. Ltd.
http://www.briskminds.com/

As many of you have discovered, our developer community is awesome. The wealth of knowledge here is phenomenal. This is an all volunteer community and people who take the time to help and post answers do so totally on their own initiative. With that said when someone provides the right answer to your question please take the time to mark their answer as the accepted solution. Also give them a kudos if they've really gone the extra mile to help out. Show some love ;)