• Abdelhakim
  • NEWBIE
  • 160 Points
  • Member since 2015
  • Salesforce Developer
  • SuitSupply


  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 0
    Questions
  • 46
    Replies
Hello,

In the contact page layput i have below related lists.
User-added image

I have duplicated the contact object and called it customX, I have created a lookup on activites, because of which i get a related list on my customX with name "Activities", 

I am wonderting how can i add the other related lists, like
Open activities,
activities history

thank you for suggestiion
Dear Community

I have struggles with a certain part of my visualforce controller. As far as I know there is no reason why after a loop execution should cause the data to be nilled or made inaccessible. But that's exactly what happens as far as I can see. below is the code snippet which iterates over a custom date format (yyyyMM) as Integer and within over a list of Opportunities to compare the dates.
opps = [ SELECT Close_Date_Month__c, CloseDateYear__c, Account.Name, CloseDate, RenewalDate__c, Name FROM Opportunity
              WHERE RenewalDate__c >= :dateFrom AND CloseDate <= :dateTo AND (StageName LIKE '%yes%' OR StageName LIKE '%Closed%') AND Account.Type LIKE '%Manufacturer%' ];
map<String, map<Integer, set<String>>> aMap = new map<String, map<Integer, set<String>>>();

for ( Integer i = getMonthYear(dateFrom); i <= getMonthYear(dateTo); i = getNextMonthYear(i) )
{
   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, 'YearMonth processed: ' + i));
   for ( Opportunity o : opps )
   {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, 'Opp processed: ' + o.Name));
      if ( getMonthYear(o.CloseDate) <= i && getMonthYear(o.RenewalDate__c) >= i )
      {
         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, 'Close Date: ' + getMonthYear(o.CloseDate)));
         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.WARNING, 'Renewal Date: ' + getMonthYear(o.RenewalDate__c)));
         String s = getStringDate(i);
// Logic
       }
    }
}
I filled the code with ApexPage Message Warnings so as to see what happens. Here is the result:
User-added image
User-added image
The "Opp processed" message appears only once even though it should appear once per Opportunity (there are 4) per date (i). Close Date & Renewal Date outputs are correct where they appear, but they should appear much more often.

Here are my functions used to get the formats:
// Extracts the year out of the integer of format yyyyMM
private static Integer getYear(Integer i)
{
    return (Integer)i/100;
}

// Transforms a date into an integer representation of yyyyMM
private static Integer getMonthYear(Date d)
{
    return d.Year()*100 + d.Month();
}

// Returns the next month of the Integer representation yyyyMM
private static Integer getNextMonthYear(Integer i)
{
    return Math.mod(i, 100) == 12 ? i + 89 : i + 1;
}

// Returns a 3-character representation of a date Integer yyyyMM
private static String getStringDate(Integer i)
{
    map<Integer, String> mapping = new map<Integer, String>
    {
        1 => 'JAN',
        2 => 'FEB',
        3 => 'MAR',
        4 => 'APR',
        5 => 'MAY',
        6 => 'JUN',
        7 => 'JUL',
        8 => 'AUG',
        9 => 'SEP',
       10 => 'OCT',
       11 => 'NOV',
       12 => 'DEC'
    };
    System.assert(Math.mod(i, 100) >= 1 && Math.mod(i, 100) <= 12);
    return mapping.get(Math.mod(i, 100));
}

Do you have any insights on that strange behaviour?

Best
Hi 

Please see the below Trigger

trigger CountFemales1 on Contact (after insert,after update,after delete) {

  List<Contact> contacts = Trigger.isdelete ? trigger.old : trigger.new;
  Set<Id> accountIds = new Set<Id>();

  for (Contact c : contacts) {
     if (c.lastname!= null) {
       accountIds.add(c.id);
    } 
  }

list<Contact> FemaleList = [select id from contact where  id In :accountIds AND Customer_status__c ='buyer broker'];

 for(Contact a :FemaleList)  {
   a.No_of_Converted_Contacts__c= FemaleList .size();
 
 }
 update FemaleList ;
}

when I try edit and save the record iam getting below error

Error: Invalid Data. 
Hi.
I have a custome object called Rival_c which is having  a lookup relation with account on the field Rival_c.  While writing a test class for a trigger , SOQL Query (mensioned below)has been written following with assertEquals method. But i am not sure, how to reference the lookup fields value in the assertEquals method.

@isTest
public class TestGetRivalValue {
    static testMethod void TestGetRivalValuemthd(){
        Rival__c  riv = new Rival__c();
        riv.Name = 'Best';
        insert riv;
        
        Account acc1 = new Account();
        acc1.Name= 'test rivalss';
        acc1.Rival_Picklist__c ='Best';
        insert acc1;
        
        List<Account> accs =  new List<Account>();
        for (Integer i=0;i<200;i++){
        Account acc= new Account();
        acc.Name= 'test rivalss';
        acc.Rival_Picklist__c ='Best';
        accs.add(acc);
        }
        insert accs;
        List <Account> newaccs = new List<Account>();
        newaccs = [SELECT Id, Rival_Picklist__c, Rival__r.Name FROM Account]; ******** Hope this line is correct.
        for (Account a:newaccs){
        System.assertEquals(a.Rival__r.Name,a.Rival__c); ******* This is i am not sure, how to incoporate the lookup value.
            }
    }
}
Expected value should be the Name (System field) in the Rival_c Object.
Actual value should be the Rival_c Lookup field in the Account Object.

Pls let me know.
Thanks  In Advance
Reshmi
 
I created a trigger easily enough using the new Process Builder that creates a child custom object record from the original Opportunity.  

Great...

Now, how do we make this custom object record (which has a master-detail to the Opportunity) visible to a Force.com user who doesn't see Opportunities at all?

Is this even possible?

Thanks!
Hi,

We've managed to get the trigger working fine in our production system although our processes have recently changed which means that we only want the trigger to fire when certain conditions are met. Please see below the working trigger with the IF statement placed where we believe it should be however it still fires even when these conditions are met. We've tried a couple times to place the IF statement in other areas and either hit errors and we are a little lost.
 
trigger UpdateAccountLookup on Opportunity (before insert,before update){

Set<id> setSiteids=new set<id>();
map<Id, String> mapsiteIdToopptId = new map<Id, String>();
Map<Id, String> mapOpptIdToAccId = new Map<Id, String>();

list<account> acclst = new list<account>();

    For(Opportunity o : trigger.new){  
       
        setSiteids.add(o.Site_Location__c);
        mapsiteIdToopptId.put(o.Site_Location__c, o.Id);
    }
    
    for(Site__c objSite : [Select Id , Parent_Account__c from Site__c where Id IN :setSiteids ])
    {
        mapOpptIdToAccId.put(mapsiteIdToopptId.get(objSite.Id), objSite.Parent_Account__c);
    }
    
    for(Opportunity o : trigger.new){
    
        if(o.New_Site__c == false  || o.Takeover__c == false){
        
        o.AccountId = mapOpptIdToAccId.get(o.Id);
    }
}
}

Any help would be greatfully appreciated.

Thanks,

Snita

 
Hello,

In the contact page layput i have below related lists.
User-added image

I have duplicated the contact object and called it customX, I have created a lookup on activites, because of which i get a related list on my customX with name "Activities", 

I am wonderting how can i add the other related lists, like
Open activities,
activities history

thank you for suggestiion
I cannot get the videos in trailhead to play in IE10.  The videos play in Firefox but there is no sound.  What is the best browser to access Trsilhead and have all the videos play as expected?
IF(LastActivityDate <= 90 Day, checked = true, checked = false)
Can someone please help me with this formula? I am getting a syntax error and I think it might have to do with the day, but not 100% sure.
Hi,

Is there a development or a trial environment for the SalesForce? I'm new to the SalesForce product, so wondering whether there is a trial environment on the cloud where I can try my hands on SalesForce?
I am trying to create login for multiple managers for a company. Ther managers will have differnet clients and opportunities. How t create the manager login? 

Dear all, 

We're currently looking for a Salesforce developer with visualforce and data visualisation experience, experience with web technologies in general such as CSS, HTML, Javascript and Javascript libraries. Please contact me at jhendriks@suitsupply.com if you are interested.

Working remote may be topic of discussion, just as terms of the contract. 

Recruitment agencies will be ingored. 

Regards, 

I created a custom object which is linked to the User table. within this custom object, I have multiple record for each user.

Is it possible that each user can pull the record associated with his/her ID?

This is my very first report, so please give as much details as possible.

Thank You

Hi guys , 
currently i am working on a performance improvement of salesforce Application.In that process one of my colleagus found an a post that said inline queries are much slower than the tradional queries https://www.youtube.com/watch?t=317&v=-edHmVGMkU0 (https://www.youtube.com/watch?t=317&v=-edHmVGMkU0) and we checked out and it seems to be true .some times to the extent of 5 times slower than tradional way. Since Salesforce recommend inline queries as a best practice this is really baffling.

only difference is inline quereis seems to consume much less heap 
eg:
 
for(Contact con :[Select Id,Name From Contact])
{

   system.debug('1111111111');

}

is much slower than 
List<Contact> con = [Select Id,Name From Contact];
for(integer i =0 ;i< con.size();i++)
{
    
    system.debug('1111111111');
    
}


 
  • October 07, 2015
  • Like
  • 0
Iam suprised that we can call standard button in VF page but we cannot call the custom button which is created through UI in VF page. We need to create a custom controller in order to define the custom button functionality.

is there any other way we can call the custom button in VF page, without creating a custom controller
Hello all,

I wrote a web service to insert  values into object. Its working fine. but when I am tring to call it from Test method I am not able to get the lookup values The query returnig zero values. 

My Web service:
try
{         RestRequest req = RestContext.request;
         String bdy = req.requestBody.toString(); 
         new_whitepaper_registration whitepaper = (new_whitepaper_registration)JSON.Deserialize(bdy,new_whitepaper_registration.class);
         White_Papers__c ObjWhitePaper =New White_Papers__c(); 
 		 ObjWhitePaper.Name=whitepaper.Name;
 		 ObjWhitePaper.Document_Name__c=whitepaper.DocumentName;
         ObjWhitePaper.White_Paper_Id__c=whitepaper.WhitePaperId;  		
         ObjWhitePaper.Lead_Name__c=[select ID from Lead where Name=:whitepaper.LeadName Limit 1].ID;   
 		insert ObjWhitePaper;	
         
   return new ReturnClass('True');
}
catch(Exception ex)
{
system.debug('ERROR: '+ex.getMessage()+ ' '+ex.getStackTraceString());   
 return new ReturnClass('false');
    
}
My Test Class: 
 
@isTest
public class CreateNewWhitePaperTest {
static testmethod void TestCreateNewWhitePaper()
    {
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
        req.requestURI = 'https://offerboard--dev1.cs17.my.salesforce.com/services/apexrest/CreateWhitePaper';  
      req.httpMethod = 'POST';
        req.requestBody=Blob.valueof('{"Name":"Test White Paper","WhitePaperId":"123","DocumentName":"Demo Doc","LeadName":"Punam Sharma"}');
        RestContext.request = req;
       RestContext.response = res;
        CreateWhitePaper.ReturnClass results = CreateWhitePaper.NewWhitePaper();      
      
   		 System.assertEquals('True', results.success);
       
       
      
        
      
    }
}


 
Hi there

Salesforce does not allow you to create PDF attachments in batch job.

This is work around to that.
https://developer.salesforce.com/forums/?id=906F0000000AlGoIAK

It works!

But As of Summer 15, Salesforce have implemented a critical update "PageReference getContent() and getContentAsPDF() Methods Treated as Callouts". Once enabled, you may get the rather uninformative error "(304497466)|FATAL_ERROR|System.CalloutException: Callout loop not allowed".

And so I have the problem described in this blog: http://codrspace.com/gwickman/callout-loop-not-allowed-error-when-using-getcontent-and-getcontentaspdf/

Can someone please help me get around this error or help with another way to create PDF attachments for emails in a batch job?

Thank you very much


 
Hello all,

So, we have developed a sidebar component that is a pricing calculator for our Sales Rep. It is set-up as a Home Page Componenet and is a Visualforce Page.

On the Home page, it works/functions/appears fine:

View on Home Page Layout

... and looks like this when you click on the other object tabs. But, as soon as we click through to a specific record on the other tabs, it goes wonky:

User-added image
It appears to be displaying a portion of the Home page.

Here's (some of) the code from the VF page:


<apex:page standardController="Opportunity" extensions="OpportunityCustomLayoutExtension" sidebar="false" showHeader="false">
<body>
<style>
body {
font-size: 9px;
background-color: #cfeef8; }
.inputClass {
}
</style>
<apex:form id="theForm">
<table>
(all the table stuff here that creates the input fields etc.)
 </table>
</apex:form>
</body>
</apex:page>

Is there some way I need to wrap the whole thing up so it will display properly?

Thanks for any assistance in advance!


 
Hi all,
Iam unable to rendered the page block which i required wnen the field valiue is 'XXX'.
Can anyone help me over here.Below is my custom vfpage.
<apex:page standardController="Event__c">
<apex:sectionHeader title="New Event"> </apex:sectionHeader>
<apex:form >
<apex:pageBlock title="Event Edit" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value=" Save "> </apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information" columns="1"> 
<apex:pageBlock rendered="{IF(!Events__c.EventValueSwp__c == 'Education', true,false)}">
<apex:inputField value="{!Event__c.Name}" required="true" label="Educator’s Name"></apex:inputField>
<apex:inputField value="{!Event__c.Date__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Education_Team_Member__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Location_of_Event_text__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Return_Visit_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Topic__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Subject__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Visit_for_academic_year_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Schools__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Address__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Grade_Level_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Teacher_s_Name_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_students__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Content_Area_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Presentation_Description_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Student_Mastery_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Total_Staff_Hours_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Mileage_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Supplies_Cost_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Grant_ed__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Pictures_uploaded_to_dropbox_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Mistery__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Type_of_Grant__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Service_Project_Y_N__c}"></apex:inputField>
</apex:pageblock>

<apex:pageBlock  rendered="{IF(!Events__c.EventValueSwp__c == 'SweepLayout', true,false)}">
<apex:inputField value="{!Event__c.Name}" required="true" label="Sweeps Name"></apex:inputField>
<apex:inputField value="{!Event__c.Date__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Sweeps_Crew_Leader_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Location_of_Event_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_in_crew_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_workers__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_bags__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_tires__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_Code_Issues_Reported__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Intersections__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_intersections_cleaned__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Description_of_the_intersections__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_parkes_cleaned_in_the_area__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Description_of_the_parks__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Grant_s_del_c__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Is_this_location_in_NCEEP__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Cost__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Mileage__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Streets_Covered__c}"></apex:inputField>
</apex:pageBlock>

<apex:pageblock rendered="{IF(!Events__c.EventValuePsp__c == 'PartnershipLayout', true,false)}">
<apex:inputField value="{!Event__c.Name}" required="true" label="Partnership Name"></apex:inputField>
<apex:inputField value="{!Event__c.Date__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Location_ps__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Grant_p__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Event_Type_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Category__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Code_Issues_Reported_YTD_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Code_Issues_Resolved_YTD_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Quarterly_cleanup_event_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Monthly_cleanup1__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_Volunteers__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_bags__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_Trash_Bags__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_psp_Tires__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Partners_Description1__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Cost__c}"></apex:inputField>
</apex:pageblock>

<apex:pageblock rendered="{IF(!Events__c.EventValuePsp__c == 'Serviceproject', true,false)}">
<apex:inputField value="{!Event__c.Name}" required="true" label="ServiceProjects Name"></apex:inputField>
<apex:inputField value="{!Event__c.Date__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Location_of_Event_del__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Group_Organization__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Contact_info__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_Volunteers__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_bags__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Number_of_tires__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Cost__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Event_sponsor__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Other_Partners1__c}"></apex:inputField>
<apex:inputField value="{!Event__c.Does_this_Project_Related_to_NCEEP1__c}"></apex:inputField>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi,

I am having an apex class where i am not able to cover the following methods for which i need help on it,


Kindly help me pls

METHODS I NEED HELP IN MY APEX CLASS :


global without sharing class VRDInternalAccReqController {

global class AccDetails{
        public string accId{get;set;}
        public string accSFDCId{get;set;}
        public string accName{get;set;}
        public string accOwner{get;set;}
    }
    global class OpptyDetails{
        public string OpptyId{get;set;}
        public string OpptySFDCId{get;set;}
        public string OpptyName{get;set;}
        public string OpptyOwner{get;set;}
        public string OpptyStage{get;set;}
    }
    
    @remoteAction
    global static List<AccDetails> fetchAccDetails(string selctdOptn, string impUsrId){
        //GSAM Account List
        List<String> GSAMMatchAccId=listOfAcctGSAMCheck(impUsrId);
        string GSAMacct='';
        integer intCnt1 = 0;
        for (string gsam:GSAMMatchAccId) {
            intCnt1 = intCnt1 + 1;
            if(intCnt1==GSAMMatchAccId.size()){
                GSAMacct +=  gsam;
                break;
            }
            GSAMacct +=  gsam + '\','+'\'';
        }
        system.debug('GSAMacct==>'+GSAMacct);
        //Account team detail
        set<id> impacc= new set<id>();
        string accteamacc='';
        List<String>lsacc =new List<String>();
       
        for(Account_Team__c ip:[SELECT Id, User__c, Account__c from Account_Team__c where User__c=:impUsrId]){
            impacc.add(ip.Account__c);
            lsacc.add(ip.Account__c);
        }
        integer intCount = 0;
        for (string st:lsacc) {
            intCount = intCount + 1;
            if(intCount==lsacc.size()){
                accteamacc +=  st;
                break;
            }
            accteamacc +=  st + '\','+'\'';
        }
        system.debug('accteamacc==>'+accteamacc);
        //Oppty team details
        set<id> impopp= new set<id>();
        string oppteamoppty='';
        string oppteamopptyacc='';
        List<String> lstopty=new List<String>();
        List<String> lstoptyacc=new List<String>();
        for(Opportunity_Sales_Team__c ip1:[SELECT Id, User__c, Opportunity__c,Opportunity__r.Account.id from Opportunity_Sales_Team__c where User__c=:impUsrId]){
            impopp.add(ip1.Opportunity__c);
            lstopty.add(ip1.Opportunity__c);
            lstoptyacc.add(ip1.Opportunity__r.Account.id);
        }
        
        integer intCnt = 0;
        for (string ost:lstoptyacc) {
            intCnt = intCnt + 1;
            if(intCnt==lstoptyacc.size()){
                oppteamopptyacc +=  ost;
                break;
            }
            oppteamopptyacc +=  ost + '\','+'\'';
        }
        system.debug('oppteamopptyacc==>'+oppteamopptyacc);

        string soql;
        system.debug('selctdOptn==>'+selctdOptn);
        soql ='SELECT Id, Name, SFDC_Account_Id__c, Owner.Name FROM Account where VRD_Internal_Account__c=true';
        if(selctdOptn=='NAVRD'){
            soql+=' and Id not in (\''+accteamacc+'\')';
            soql+=' and Id in (\''+GSAMacct+'\')';
        }else if(selctdOptn=='NAOVRD'){
            soql+=' and Id in (\''+GSAMacct+'\')';
        }else if(selctdOptn=='RSAVRD'){
            soql+=' and Id in (\''+accteamacc+'\')';
        }else if(selctdOptn=='RSAOVRD'){
            soql+=' and Id in (\''+oppteamopptyacc+'\')';
        }
        system.debug('soql==>'+soql);
        
        List<AccDetails> lstResult = new List<AccDetails>();
        if(soql!='' && soql!=null)
        {
            for(Account acc:Database.query(soql)){
                AccDetails oAcc = new AccDetails();
                oAcc.accId = acc.Id;
                oAcc.accSFDCId = acc.SFDC_Account_Id__c;
                oAcc.accName = acc.Name;
                oAcc.accOwner = acc.Owner.Name;
                lstResult.add(oAcc);
            }
        }
        return lstResult;
    }
    
    @remoteAction
    global static List<OpptyDetails> fetchOpptyDetails(string selctdOptn, string impUsrId, string acct){
        //Oppty team details
        set<id> impopp= new set<id>();
        string oppteamoppty='';
        string oppteamopptyacc='';
        List<String> lstopty=new List<String>();
        List<String> lstoptyacc=new List<String>();
        for(Opportunity_Sales_Team__c ip1:[SELECT Id, User__c, Opportunity__c,Opportunity__r.Account.id from Opportunity_Sales_Team__c where User__c=:impUsrId]){
            impopp.add(ip1.Opportunity__c);
            lstopty.add(ip1.Opportunity__c);
            lstoptyacc.add(ip1.Opportunity__r.Account.id);
        }
        integer intCt = 0;
        for (string ost:lstopty) {
            intCt = intCt + 1;
            if(intCt==lstopty.size()){
                oppteamoppty +=  ost;
                break;
            }
            oppteamoppty +=  ost + '\','+'\'';
        }
        system.debug('oppteamoppty==>'+oppteamoppty);
        
        string soql;
        system.debug('selctdOptn==>'+selctdOptn);
        
        if(selctdOptn=='NAVRD'){
             
        }else if(selctdOptn=='NAOVRD'){
            soql ='SELECT Id,Name,Owner.Name,SFDC_Opportunity_Id__c,StageName,Account.id FROM Opportunity';
            soql+=' where Account.Id=\''+acct+'\'';
        }else if(selctdOptn=='RSAVRD'){
            
        }else if(selctdOptn=='RSAOVRD'){
            soql ='SELECT Id,Name,Owner.Name,SFDC_Opportunity_Id__c,StageName,Account.id FROM Opportunity';
            soql+=' where Id in (\''+oppteamoppty+'\')';
        }
        system.debug('soql==>'+soql);
        List<OpptyDetails> lstResult = new List<OpptyDetails>();
        if(soql!='' && soql!=null)
        {
            for(Opportunity oppty:Database.query(soql)){
                
                OpptyDetails oOpp = new OpptyDetails();
                oOpp.OpptyId = oppty.Id;
                oOpp.OpptySFDCId = oppty.SFDC_Opportunity_Id__c;
                oOpp.OpptyName = oppty.Name;
                oOpp.OpptyOwner = oppty.Owner.Name;
                oOpp.OpptyStage=oppty.StageName;
                lstResult.add(oOpp);
            }
        }
        return lstResult;
    }
   
}

 
MY TEST CLASS 

/*
* Name: VRDInternalAccReqController_Test
*/

@isTest(seeAllData=true)
public class VRDInternalAccReqController_Test {

    static testMethod void VRDInternalAccReqController_Test1() {
	
	
	 User usr = [Select id from User where Id = :UserInfo.getUserId()];

 // setup a nasp
       ALL_NASP_IDs__c AllNasp = new ALL_NASP_IDs__c(        
          NASP1__c = '9XXYY',
          Name = '9XXYY',
          NASP_NAME__c = 'NASP 9',
          GARM_APP_Level__c = 'A16',
          Generic_NASP__c = 'FALSE',
          OWNING_AREA__c = 'US ENTERPRISE',
          DUNS_Number__c = '8888'
       );
       insert AllNasp;    
    
             // setup an account
        Utilities_Vaiables.setisvdmsdatefieldtrigger();
        Utilities_Vaiables.setForTest();
        GSAMUtilityClass.isGSAMAccountValidationChkCalled = true;
        Utilities_Vaiables.isForTest = true;
        StaticConstantsUtil.ranChangePtnrMgrOnAccOwnrChange  = true;
        Utilities_Vaiables.isvdmsdatefieldtrigger = true;
        Utilities_Vaiables.isBBcreated  = true;
        Utilities_Vaiables.setIsPRMTest();  
        Utilities_Vaiables.skipCTrigger = true;
        Utilities_Vaiables.isChatterRolechanged = true;
        Utilities_Vaiables.isCCI = true;
        GSAMUtilityClass.isGSAMUserObjectTriggerCalled = true;
        GSAMUtilityClass.GSAMUserAfterTriggermethod = true;       
        SFDCtoECSfromTrigger.isttesting = true;  
        
        Account act = new Account(
            
            Name = 'DLM Account',
            phone = '7894563256',
            Organization__c = 'EMEA',
            Account_NASP_ID__c = AllNasp.id,
            Primary_Account__c = true,
            BillingStreet = 'test Billing Street', 
            BillingCity = 'test Billing City', 
            BillingState = 'test Billing State', 
            BillingPostalCode = '600000', 
            BillingCountry = 'USA',
           Partner_Category__c='cloud',
           Partner_Primary_Focus__c='Wireless'
         
            
        ); 
        insert act;
        
		//set up an account team
		
		Account_Team__c atm = new Account_Team__c();
		atm.User__c = usr.Id;
		atm.Account__c=act.Id;
		insert atm;
        
         // setup an opportunity
             
        RecordType UpsellRT = [SELECT Id,Name FROM RecordType WHERE sObjectType = 'Opportunity' AND Name = 'Wireline Sales Opportunity' LIMIT 1];
        
        Utilities_Vaiables.isRTcreated = false;
        SFDCtoECSfromTrigger.setisttest();
        EP_Utilities.isOpportunityPRMLOACheckCalled = true;
        Utilities_Vaiables.setisvdmsdatefieldtrigger();
        Utilities_Vaiables.setForTest();
        GSAMUtilityClass.isGSAMAccountValidationChkCalled = true;
        Utilities_Vaiables.isForTest = true;
        StaticConstantsUtil.ranChangePtnrMgrOnAccOwnrChange  = true;
        Utilities_Vaiables.isvdmsdatefieldtrigger = true;
        Utilities_Vaiables.isBBcreated  = true;
        Utilities_Vaiables.setIsPRMTest();  
        Utilities_Vaiables.skipCTrigger = true;
        Utilities_Vaiables.isChatterRolechanged = true;
        Utilities_Vaiables.isCCI = true;

        GSAMUtilityClass.isGSAMUserObjectTriggerCalled = true;
        GSAMUtilityClass.GSAMUserAfterTriggermethod = true;       
        SFDCtoECSfromTrigger.isttesting = true;
        OpportunityUpdateIntegration.istest=true;
        
        Opportunity opp1 = new Opportunity();
        opp1.Name='XXABC';
        opp1.AccountId=act.id;
        opp1.StageName = '0 Identify';
        opp1.ForecastCategoryName = 'Funnel';
        opp1.CloseDate=date.today();
        opp1.NextStep = 'next';  
        opp1.RecordTypeId = UpsellRT.Id;
        opp1.Type='Renewal Only';
        opp1.subNASP__c='0001';
        opp1.Deal_Expire_Update__c=true;
        insert opp1;
        
        opp1.Deal_Expire_Update__c=false;
        opp1.subNASP__c='0002';
        update opp1;
	
	ApexPages.StandardController TestNewAAR = new ApexPages.StandardController(atm);
	VRDInternalAccReqController vrd = new VRDInternalAccReqController(TestNewAAR);

	vrd.fnSubmit();
	vrd.fnCancel();
    VRDInternalAccReqController.ChatterFeedPost('test','test1');
	}
	}
 Kindly help  me how to cover those methods in my test class
Thanks in Advance
I'm unable to add a picklist of territories in visualforce page and render table. How do I proceed? Please refer any materials if possibles. Following is my code..
 
public class TrackingPartners{

    public List<Torders__c> orders {get; set;}
    public TrackingPartners() {   
    }
    
    
    public list<Torders__c> getstart() {

    Map<Id,UserTerritory> UserTerritoryCurrentUserMap = new  Map<Id,UserTerritory>([Select u.UserId, u.TerritoryId, u.IsActive, u.Id  From UserTerritory u Where 

u.isActive=true and u.userId =: UserInfo.getUserId()]);
    system.debug('-----UserTerritoryCurrentUserMap SIZE-------'+UserTerritoryCurrentUserMap.size());
    
    
    set<Id> TerritoryIdSet = new set<Id>();
    for(UserTerritory ut:UserTerritoryCurrentUserMap.values())
    {
          TerritoryIdSet.add(ut.TerritoryId);
    }    
    
    List<Territory> childTerritories = [Select Id from Territory where ParentTerritoryID in :TerritoryIdSet];
    
    for(Territory ct : childTerritories) {
            TerritoryIdSet.add(ct.Id);
        }
    
    

    list<Group> map_group = [Select Id, RelatedId from Group where (Type='Territory' OR Type='TerritoryAndSubordinates') AND RelatedId IN : TerritoryIdSet];
    system.debug('-----map_group -------'+map_group);
   




    List<SUBSCR_SYSTEMS__c> lst_PartnersAcc = [SELECT LEGACY_CUST_NUM__c,Account__c
                                                 FROM SUBSCR_SYSTEMS__c WHERE Account__c IN                                                  
                                                 (Select  AccountId from AccountShare where ( UserOrGroupId IN : map_group OR  UserOrGroupId =:UserInfo.getUserId()) 

AND RowCause IN ('Territory', 'TerritoryManual', 'TerritoryRule'))
                                                 ];
                                               
    
                                                
                                                 
    Set<String>tempList = new Set<String>();

    for(SUBSCR_SYSTEMS__c s : lst_PartnersAcc) {
        tempList.add(s.LEGACY_CUST_NUM__c);

        
    }
    
    system.debug('-----tempList-------'+tempList);

    
    List<Torders__c> orders =[SELECT Torders__c,id, 

customer_order_number__c,name,order_no__c,account__c,account__r.name,number_of_line_items__c,number_of_items_open__c,lines_items_shipped__c,number_of_items_delivered__

c,order_date__c,Bill_to__c,Payer__c,Ship_To__c,Sold_to__c FROM Torders__c   
                                 WHERE  Bill_to__c IN: tempList OR
                                        Payer__c IN: tempList OR 
                                        Ship_To__c IN: tempList OR
                                        Sold_to__c IN: tempList
                                     ]; 
                                     system.debug('-----orders-------'+orders);

     return orders;                                
  }                                
  
}

and the VF ...
<apex:page Controller="TrackingPartners" >
<apex:stylesheet value="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/css/jquery.dataTables.css')}"/>

 <apex:pageBlock >
         <apex:pageBlockTable value="{!start}" var="o" styleClass="dataTable">
                <apex:column >
                        <apex:facet name="header">Order No.</apex:facet>                        
                 <a href="Class?id={!o.id}" onMouseOver="setTimeout(function(){awin=window.open('OrderLines?id={!o.id}','Order Lines','height=300, 

width=1000, left=400, scrollbars=yes');},1000);" onmouseout="awin.close();">{!o.Torders__c}</a>
           
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Account</apex:facet>
                        <apex:outputText value="{!o.account__r.name}"/>
                </apex:column>                
                <apex:column >
                        <apex:facet name="header">Partner No.</apex:facet>
                        <apex:outputText value="{!o.Ship_To__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Customer PO</apex:facet>
                        <apex:outputText value="{!o.customer_order_number__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Open</apex:facet>
                        <apex:outputText value="{!o.number_of_items_open__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Shipped</apex:facet>
                        <apex:outputText value="{!o.lines_items_shipped__c}"/>
                </apex:column>
                <apex:column >
                        <apex:facet name="header">Delivered</apex:facet>
                        <apex:outputText value="{!o.number_of_items_delivered__c}"/>
                </apex:column>   
                <apex:column >
                        <apex:facet name="header">Order Date</apex:facet>
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!o.order_date__c}"/>
                        </apex:outputText>                         
                </apex:column>                                                                                               
        </apex:pageBlockTable>
        <apex:form>
        <apex:selectList id="mgr" value="" size="1" title="Manager">
                        <apex:selectOptions value=""></apex:selectOptions>
        </apex:selectList>
        </apex:form>
<script type="text/javascript" language="javascript" src="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/js/jquery.js')}"></script>
<script type="text/javascript" language="javascript" src="{!URLFOR($Resource.jQueryDataTablesZip, 'jQueryDataTablesZip/js/jquery.dataTables.js')}"></script>
     
 </apex:pageBlock>    

</apex:page>
Thanks in advance!
 
  • February 26, 2015
  • Like
  • 0
Hi everybody, 
Now I have very fruitful position in Germany, Berlin from product company. main requirements: 3+ years of experience in Salesforce.com (frontend and backend), Java, JavaScript (CSS and HTML), advanced English level. Full relocation package(if you need). Salary rate 45-50k euro per a year. If you are interested in working in Germany or changing your current project, please write me by skype: somova.it

I'll be grateful for any recommendations:) Thank you for attention and have a perfect day!

 
I don't see a Setup menu to run the Lightning App Builder for a challange.  I'm using the Summer `15 Developer Edition.  How is it enabled? 
Hi I am trying to merge two or more pdfs in one pdf in Salesforce, I looked into many things and searched allot but didn't got anything.
If anybody have done any POC on this thing do let me know.

Thanks