• Kavya
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi,

 

I have Workflow setup in place which sends out Emails via Email Alerts.

Now the requirement is to track these Emails on a weekly basis either in the form of a report or using APEX Triggers.

Does anyone have any idea? 

Please provide your insights on this one.

 

 

Thanks

Kavya

  • September 05, 2013
  • Like
  • 0

I have written a piece of code using standardSetController. And also i am writting a test class for it.But the coverage is 0%.Could someone help me.

 

***********************************Test Class****************************************

@isTest(seeAllData=true)
private class AsssignLead_Test {
    static ApexPages.StandardController stdController = null;
    static AssignLeadController AssignLeadInstance = null;
    static Lead leadObj = new Lead();
    static Account customerAccount;

    static testMethod void AsssignLead_Test_Platinum() {
        User runAsPortalUser = createPortalUser();
        system.runAs(runAsPortalUser){
            //Create Leads
                Lead testLead1;
                List<Lead> assignLeadList = new List<Lead>();
                User partnerUser = [select Id,ContactId from User where Id=:runAsPortalUser.Id];
                Contact partnerCon = [select Id,AccountId from Contact where Id=:partnerUser.ContactId];
                Account partnerAcc = [select Id,SFDC_Account_ID__c,name from Account where Id=:partnerCon.AccountId];
                String groupName = partnerAcc.Name+':'+partnerAcc.SFDC_Account_ID__c;
                Group partnerGroup = [select Id,Name from Group where Type='Queue' and Name=:groupName LIMIT 1];
                
                
                ALL_NASP_IDs__c  naspNew = new ALL_NASP_IDs__c(Name = 'test77',NASP1__c = 'test77',
                Branch_Name__c = 'Test Branch AL',GARM_APP_Level__c = 'A16',DUNS_Number__c = '12340007');
                Database.insert(naspNew);
                
                //Customer Account Record type
                RecordType custaccountRecordType = [select Id,Name from Recordtype where Name = 'Master Account'];
                //Create Customer Account
                Account customerAccountNew = new Account(Name = 'Test Customer Account 007');
                customerAccountNew.Account_NASP_ID__c = naspNew.Id;
                customerAccountNew.Organization__c = 'US';
                customerAccountNew.billingstreet = 'test Billing Street1';
                customerAccountNew.billingcity = 'test Billing City1';
                customerAccountNew.billingstate = 'test Billing State1';
                customerAccountNew.billingpostalcode = '600080';
                customerAccountNew.billingcountry = 'US';
                customerAccountNew.Type = 'Customer';
                Database.insert(customerAccountNew);
                
                
                RecordType custLeadRecordType = [select Id,Name from Recordtype where Name = 'PRM Partner Customer Lead'];
                testLead1 = new Lead(FirstName = 'Test');
                testLead1.LastName = 'Lead1';
                testLead1.RecordTypeId = custLeadRecordType.Id;
                testLead1.Company = 'Test Company1';
                testLead1.Status = 'New';
                testLead1.Permission_to_Contact__c = 'Yes';
                testLead1.Phone = '9999999976';
                testLead1.Street = 'Test street';
                testLead1.City = 'Test City';    
                testLead1.Country = 'Test Country';
                testLead1.PostalCode = '123456';
                testLead1.Email = 'test@lead1.com';
                testLead1.PRM_Routing_Tier__c = 'Platinum';
                testLead1.Decision_Maker__c = true;
                testLead1.Close_Date__c = system.today();
                testLead1.Product_Solution__c = 'Test Pillar';
                testLead1.Account__c = customerAccountNew.Id;
                 
                assignLeadList.add(testLead1);
                Database.insert(assignLeadList);    
    
                
                PageReference pg = Page.AssignLeadPage;
                Test.setCurrentPageReference(pg);
                for(Lead leadObjNew : assignLeadList){
                    ApexPages.currentPage().getParameters().put('id',leadObjNew.Id);
                    stdController = new ApexPages.StandardController(leadObjNew);
                    AssignLeadInstance = new AssignLeadController(stdController);
                }
                
                
                ApexPages.StandardSetController setController = AssignLeadInstance.setCon;
                AssignLeadInstance.first();
                AssignLeadInstance.last();
                Boolean testVariable;
                testVariable = AssignLeadInstance.hasNext;
                testVariable = AssignLeadInstance.hasPrevious;
                AssignLeadInstance.doUpdateLeadOwner();    
        } 
    }
/********************* ***********************/
    public static User createPortalUser(){
        User portalUser = null;
        UserRole portalRole = [Select Id From UserRole Where PortalType = 'None' Limit 1];
        //Interface Profile
        Profile profile = [select id from profile where name='Vz Interface Profile'];  
        //Portal Profile
        Profile portalProfile = [select id from profile where name='Vz PRM Super User'];
        //Create Interface User     
        User user = new User(alias = 'testUser',email='test123@noemail.com', emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US', localesidkey='en_US', profileid =profile.Id, country='United States',
        timezonesidkey='America/Los_Angeles',Total_Chatter_posts__c='123', username='test123@noemail.com',Enterprise_Id__c='222',GARM_APP_level__c='A168',One_World_ID__c='3333',VZ_ID__c='33333',One_World_Number__c='22222',UserRoleId = portalRole.Id);     
        Database.insert(user);       
        //Run as Interface user
        System.runAs(user){
            //Create NASP for partner Account
            ALL_NASP_IDs__c  nasp2 = new ALL_NASP_IDs__c(Name = 'test22',NASP1__c = 'test22',
            Branch_Name__c = 'testbranch2',GARM_APP_Level__c = 'A168',DUNS_Number__c = '12351235');
            Database.insert(nasp2);
            //Partner Account Record Type
            RecordType accountRecordType = [select Id,Name from Recordtype where Name = 'PRM Partner Account'];
            //Create Partner Account
            Account account = new Account(name = 'Partner Account Test 007');
            account.RecordTypeId = accountRecordType.Id;
            account.phone  = '9999999999';
            account.Organization__c='Partner';
            account.ova_id__c = 'test OVAID';
            account.ovi_id__c = 'test OVIID';
            account.d_u_n_s__c = '100100100';
            account.guduns__c = 'test GUDUNS';
            account.billingstreet = 'test Billing Street';
            account.billingcity = 'test Billing City';
            account.billingstate = 'test Billing State';
            account.billingpostalcode = '600000';
            account.billingcountry = 'US';
            account.Module_ID_AEDW__c = 'MMM';
            account.Type = 'Partner';
            account.Partner_Tier__c = 'Platinum';
            account.Partner_Approval_Status__c = 'Approved';
            Database.insert(account);
            //Partner Checks for the Partner Account
            RecordType partnerChecksRecTypeOFAC = [select Id,Name from Recordtype where Name = 'OFAC'];
            RecordType partnerChecksRecTypeFinancial = [select Id,Name from Recordtype where Name = 'Financial'];
            RecordType partnerChecksRecTypeLegal = [select Id,Name from Recordtype where Name = 'Legal'];
            
            Checks__c partnerChecksOFAC = new Checks__c(Status__c = 'Approved',Check_Type__c = 'OFAC',Account__c = account.Id,Completion_Date__c = system.today());
            Checks__c partnerChecksLegal = new Checks__c(Status__c = 'Approved',Check_Type__c = 'Legal',Account__c = account.Id,Completion_Date__c = system.today());
            Checks__c partnerChecksFinancial = new Checks__c(Status__c = 'Approved',Check_Type__c = 'Financial',Account__c = account.Id,Completion_Date__c = system.today());
            List<Checks__c> partnerChecks = new List<Checks__c>();
            partnerChecks.add(partnerChecksOFAC);
            partnerChecks.add(partnerChecksLegal);
            partnerChecks.add(partnerChecksFinancial);
            Database.insert(partnerChecks);
            //Partner Contact
            RecordType partnerContactRecType = [select Id,Name from Recordtype where Name = 'PRM Partner User'];
            //Partner Contact
            Contact contact = new Contact(
            FirstName = 'Test Partner',
              Lastname = 'Contact',
            accountId = account.Id,
             Email = 'test@partnercontact.com',
              RecordTypeId = partnerContactRecType.Id,
            Title = 'Programmer'
            //Date_of_Birth__c = '06/06/1984',
            //Account_Type__c = 'Partner'
            );
            Database.insert(contact);
            //Create Portal User
            portalUser = new User(
              Username = 'test500077@test.com',
            ContactId = contact.Id,
            ProfileId = portalProfile.Id,
            Alias = 'test123',
            Email = 'test12345@test.com',
            EmailEncodingKey = 'UTF-8',
            LastName = 'Partner Contact',
            CommunityNickname = 'test12345',
            TimeZoneSidKey = 'America/Los_Angeles',
            LocaleSidKey = 'en_US',
            LanguageLocaleKey = 'en_US',
            Enterprise_ID__c= '0021374513',
            VZ_ID__c= '0029333',
            One_World_Number__c = '046171256',
            GARM_APP_level__c = 'A168',
            One_World_ID__c='002335',
            IsActive=true,
            Sales_Team_Role__c = 'Partner');
            Database.insert(portalUser);
            system.runAS(portalUser){
                portalUser.IsPortalEnabled = true;}
            Group objgroup = new Group();
            objgroup.Name = account.name +':'+account.SFDC_Account_ID__c;
            objgroup.Type = 'Regular';
            Database.insert(objgroup);
            Group objgroupnew = new Group();
            objgroupnew.Name = account.name +':'+account.SFDC_Account_ID__c;
            objgroupnew.Type = 'Queue';
            Database.insert(objgroupnew);
            QueueSObject objQue = new QueueSObject();
             objQue.SobjectType='Lead';
             objQue.QueueId=objgroupnew.Id;
             Database.insert(objQue);
             //Partner Authorization Recordtype
            RecordType paMSA = [select Id,Name from RecordType where Name = 'MSA'];
            Partner_Contract__c contract1 = new Partner_Contract__c(RecordTypeId = paMSA.Id,Partner_Account__c = account.Id,Contract_Start_Date__c = system.today(),Contract_End_Date__c = system.today()+100,
            Type_of_Contract__c = 'MSA',
            VzB_Signer__c=user.id,
            VzW_Signer__c=user.id,
            Terremark_Signer__c=user.id);
            Database.insert(contract1);
              // create a Partner Branch in branch Geo Region
            Branch_Geo_Region__c BranchGeo = new Branch_Geo_Region__c(
            Name = 'Test Branch AL',
            Branch_Name_Unique__c = 'Test Branch AL',
            Geo_Region__c = 'US',
            Segment__c = 'All');
            Database.insert(BranchGeo);
            system.debug('BranchGeoRegion***'+BranchGeo);
            // Select the above created branch in partner branch object        
            Partner_Branch__c PartnerBranch = new Partner_Branch__c(
            Associated_Partner_Contract__c = contract1.Id,
            Partner_Account__c = account.Id,
            Branch_Geo_Region__c = BranchGeo.Id);
            Database.insert(PartnerBranch);
            system.debug('PartnerBranch***'+PartnerBranch);
            Partner_Branch__c objPartnerbranch = [Select Id, Branch_Geo_Region__c, Branch_Name__c, Branch_Name_Text__c, Partner_Account__c from Partner_Branch__c where Id =:PartnerBranch.Id];
            system.debug('PartnerBranchObject***'+objPartnerbranch);
             Partner_Pillar__c partnerPillar = new Partner_Pillar__c(Name = 'Test Pillar');
             Database.insert(partnerPillar);
             Partner_Product_Pillar__c partnerProductPillar = new Partner_Product_Pillar__c(
             Partner_Contract__c = contract1.Id,
             Partner_Pillar__c = partnerPillar.Id);
             Database.insert(partnerProductPillar);}
            return portalUser;  } 
    public static Account createCustomerAccount(){
        User portaluser = createPortalUser();
        Profile profile = [select id from profile where name='Vz Interface Profile'];
        User user = new User(alias = 'testUser',email='test123@noemail.com', emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US', localesidkey='en_US', profileid =profile.Id, country='United States',
        timezonesidkey='America/Los_Angeles',Total_Chatter_posts__c='123', username='test123@noemail.com',Enterprise_Id__c='222',GARM_APP_level__c='A168',One_World_ID__c='3333',VZ_ID__c='33333',One_World_Number__c='22222');   
        Database.insert(user);      
        system.runAs(user){
            //Create NASP for Customer Account
            ALL_NASP_IDs__c  nasp1 = new ALL_NASP_IDs__c(Name = 'test11',NASP1__c = 'test11',
            Branch_Name__c = 'testbranch1',GARM_APP_Level__c = 'A16',DUNS_Number__c = '12341234');
            Database.insert(nasp1);
            //Customer Account Record type
            RecordType custaccountRecordType = [select Id,Name from Recordtype where Name = 'Master Account'];
            //Create Customer Account
            customerAccount = new Account(Name = 'Test Customer Account');
            customerAccount.Account_NASP_ID__c = nasp1.Id;
            customerAccount.Organization__c = 'US';
            customerAccount.billingstreet = 'test Billing Street';
            customerAccount.billingcity = 'test Billing City';
            customerAccount.billingstate = 'test Billing State';
            customerAccount.billingpostalcode = '600000';
            customerAccount.billingcountry = 'US';
            customerAccount.Type = 'Customer';
            Database.insert(customerAccount);}   
        return customerAccount;}}

  • January 18, 2013
  • Like
  • 0

HI ,

Please help me out.. I encountered this error while trying to installing Force.com IDE....

 



 

"

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found 1967adb9098b0054385a2dd45fe0f5e3.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.core,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 44db36699ca7fdd38917fced4e63c3b3 and found 22fabfa35567ee6997134eb703785961.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found 0eac517f8486c20194a93df06663f3f9.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.ui,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 72451be89c0b7d5ca06b55c8ad657db6 and found 97c8723487e415b1d2e4f998a3496c94.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.ui.editors,24.0.0.201202291629.
MD5 hash is not as expected. Expected: ff45a840737d9bef14347ce6f5b5daa4 and found 066475a759d26eb6818d08caf76f74fb.

"

 

 

Thanks 

Kavya

  • May 19, 2012
  • Like
  • 0

Hi ,

 

I have requirement which is as follows....

 

A form which has 2 picklists and many more fields like text fields , lookups etc , picklist B values will be populated based on Picklist A values (a query runs in the controller to populate picklist B values).. now , as per the requirement I want all the fields to be disabled until a values in Picklist A has been selected...

 

<apex:actionFunction name="update" action="{!populateItems}" rerender="Panel">
    <apex:param name="Status" value="" />
       </apex:actionFunction>
      <apex:outputLabel for="pick1">CMR ID:</apex:outputLabel>
   <apex:selectList value="{!status}" multiselect="false" size="1" id="pick1" onchange="update(this.value)">
   <apex:selectOptions value="{!items}" />
   </apex:selectList>

 

Since am already using onchange to populate the picklist , how can I achieve the above mentioned requirement.

 

Please help me.

 

Thanks

Kavya

 

  

  • May 10, 2012
  • Like
  • 0

Hi ,

 

I was using this particular code snippet specified below and it threw me an error (highlighted in red).. and I would also like that this code snippet works fine with other Standard and custom objects but  not for Account......can some please help me out by educating me as to why this kind of an error occurs.

 

 

public with sharing class LookupPopupController
{
 public String query {get; set;}
 public List<Account> accounts {get; set;}
 
 public PageReference runQuery()
 {
  List<List<Account>> searchResults=[FIND :query IN ALL FIELDS RETURNING Account (id, name, billingstreet, billingcity, billingpostalcode)];
  accounts=searchResults[0];
    return null;
 }
}

 

 

Compile Error: Illegal assignment from LIST<LIST<SObject>> to LIST<LIST<Account>>

  • April 25, 2012
  • Like
  • 0

Hi , I have requirement here.. Which requires us  to take user input from a visual force page using <apex:inputText>  rather than <apex:inputField> .. the problem is there is a date field in my custom object and I am not able to display  the custom date picker... Please help me out.

  • April 06, 2012
  • Like
  • 0

I have requirement, which is as follows..

When a user selects a particular Agent Id , all the details of that particular Agent Id should get populated on the visual force page.... I am not able to capture the selected picklist value and pass it to the Apex Controller ... Please help me..

Please guide as to where am I going wrong...

 

Class

 

public class AgentandOrderController{
Agent__c Agent;
string searchText;
List<Agent__c> result;
Integer selected;
Integer AgentId;

public String getAgent() {
        return null;
    }

 public List<Agent__c> getresult() {
      return result;
   }

public Integer getAgentId() {
return selected;
}

public void  setAgentId(Integer val) {
selected=val;
 }
 
public List<SelectOption> getItems() {
     List<SelectOption> options = new List<SelectOption>();
     options.add(new selectOption('001', '001'));
     options.add(new selectOption('002', '002'));
     options.add(new selectOption('003', '003'));
     options.add(new selectOption('004', '004'));
    
     return options;
}

public PageReference search() {
result=[select Agent_Address__c from Agent__c where Name=: ApexPages.currentPage().getParameters().get('options')];
System.debug('options : '+options);
return null;
}

}

 

 

 

Page

 

<apex:page controller="AgentandOrderController" >
 <apex:form >
<b>Agent Information</b>
  <apex:pageblock >
   <apex:pageBlockSection id="section1">
    <apex:pageBlockSectionItem >
     <apex:panelGrid columns="2">
     <apex:actionRegion >     
     <apex:outputLabel value="Agent Id" for="agentId"/>
      <apex:selectList value="{!agentId}" multiselect="false" size="1" onchange="search()" >
      <apex:selectOptions value="{!items}" />
      </apex:selectList>
     </apex:actionRegion>        
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageblock>

<b>Order Information</b>
<apex:pageBlock >
<apex:pageBlockSection id="section2">
<apex:pageBlockSectionItem >
<apex:panelGrid columns="2">
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

Thank You

  • April 05, 2012
  • Like
  • 0

I successfully installed force.com IDE on eclipse Ganymede but unable to find the perspective when I go into windows->open perspective->other. Can some one please help me out. :)

  • March 08, 2012
  • Like
  • 0

Hi ,

 

I have requirement which is as follows....

 

A form which has 2 picklists and many more fields like text fields , lookups etc , picklist B values will be populated based on Picklist A values (a query runs in the controller to populate picklist B values).. now , as per the requirement I want all the fields to be disabled until a values in Picklist A has been selected...

 

<apex:actionFunction name="update" action="{!populateItems}" rerender="Panel">
    <apex:param name="Status" value="" />
       </apex:actionFunction>
      <apex:outputLabel for="pick1">CMR ID:</apex:outputLabel>
   <apex:selectList value="{!status}" multiselect="false" size="1" id="pick1" onchange="update(this.value)">
   <apex:selectOptions value="{!items}" />
   </apex:selectList>

 

Since am already using onchange to populate the picklist , how can I achieve the above mentioned requirement.

 

Please help me.

 

Thanks

Kavya

 

  

  • May 10, 2012
  • Like
  • 0

I have requirement, which is as follows..

When a user selects a particular Agent Id , all the details of that particular Agent Id should get populated on the visual force page.... I am not able to capture the selected picklist value and pass it to the Apex Controller ... Please help me..

Please guide as to where am I going wrong...

 

Class

 

public class AgentandOrderController{
Agent__c Agent;
string searchText;
List<Agent__c> result;
Integer selected;
Integer AgentId;

public String getAgent() {
        return null;
    }

 public List<Agent__c> getresult() {
      return result;
   }

public Integer getAgentId() {
return selected;
}

public void  setAgentId(Integer val) {
selected=val;
 }
 
public List<SelectOption> getItems() {
     List<SelectOption> options = new List<SelectOption>();
     options.add(new selectOption('001', '001'));
     options.add(new selectOption('002', '002'));
     options.add(new selectOption('003', '003'));
     options.add(new selectOption('004', '004'));
    
     return options;
}

public PageReference search() {
result=[select Agent_Address__c from Agent__c where Name=: ApexPages.currentPage().getParameters().get('options')];
System.debug('options : '+options);
return null;
}

}

 

 

 

Page

 

<apex:page controller="AgentandOrderController" >
 <apex:form >
<b>Agent Information</b>
  <apex:pageblock >
   <apex:pageBlockSection id="section1">
    <apex:pageBlockSectionItem >
     <apex:panelGrid columns="2">
     <apex:actionRegion >     
     <apex:outputLabel value="Agent Id" for="agentId"/>
      <apex:selectList value="{!agentId}" multiselect="false" size="1" onchange="search()" >
      <apex:selectOptions value="{!items}" />
      </apex:selectList>
     </apex:actionRegion>        
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageblock>

<b>Order Information</b>
<apex:pageBlock >
<apex:pageBlockSection id="section2">
<apex:pageBlockSectionItem >
<apex:panelGrid columns="2">
</apex:panelGrid>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

Thank You

  • April 05, 2012
  • Like
  • 0

 

Hello Board,

 

I want to use two datepicker on visualforce page to specify range and based on their input values execute the query and display the result.

 

Is there any Datepicker available which will look like standard datepicker available in SF?

 

Thanks,

Devendra