• Mudasir Wani
  • SMARTIE
  • 1289 Points
  • Member since 2013
  • Salesforce Consultant

  • Chatter
    Feed
  • 39
    Best Answers
  • 0
    Likes Received
  • 6
    Likes Given
  • 4
    Questions
  • 387
    Replies
Hi all,

I need to send email based on the country language of the user. For example if the user choose india, Email body will be in hindi. If user choose Korea the body will be in korean language. Suggestion please.

Thank You,
 
 
I am using the below sectin in VF page to render selectively based on Value of Opportunity Stage

            <apex:pageBlockSection id="Stage_Details" title="Stage Details" >
                
                <apex:repeat id="Opportunity_Stage_Fields" value="{!OpportunityStageFields}" var="f">
                     <apex:pageBlockSectionItem >
                         <apex:outputLabel id="fs_contract_type_label" value="{!$ObjectType.Opportunity.Fields[f].label}"/>
                         <apex:inputField id="fs_contract_type" value="{!sOpportunity[f]}">
                             <apex:actionSupport event="onchange" immediate="true" rerender="Stage_Details"  rendered="true"/>    
                         </apex:inputField>
                     </apex:pageBlockSectionItem>                                                                              
                 </apex:repeat><br/>
                 
                 <apex:repeat id="Reason_Comments" value="{!OpportunityStageReasonFields}" var="f">
                     
                     <apex:pageBlockSectionItem rendered="{!if(sOpportunity.stagename == 'Closed On Hold','true','false')}">
            <apex:outputLabel id="fs_Reason_label" value="{!$ObjectType.Opportunity.Fields[f].label}"/>
                         <apex:inputField id="fs_Reason" value="{!sOpportunity[f]}" rendered="{!if(sOpportunity.StageName == 'Closed On Hold','true','false')}"/>                        
                     </apex:pageBlockSectionItem>                                                                             
                 </apex:repeat>
                 
            </apex:pageBlockSection>


Below is the sections added in Controller


    public List<Schema.FieldSetMember> getOpportunityStageFields() {
            return SObjectType.Opportunity.FieldSets.Opportunity_Stage.getFields();
    }


    public List<Schema.FieldSetMember> getOpportunityStageReasonFields() {
            return SObjectType.Opportunity.FieldSets.Opportunity_Stage_Reason_Closed.getFields();
    }


Additionally have created two field sets 
1) Opportunity_Stage (field Opportunity Stage) 
2) Opportunity_Stage_Reason_Closed (Reason Closed & Reason Closed COmments)


Still once I change the status of the Field Opportunity Stage, if does not return with the Reason Closed & Reason Closed COmments fields.
  • November 10, 2015
  • Like
  • 0
Hi,

I have a list of bottling's done each day that I'm breaking up by user email and then account so each user might be multiple accounts.  The structure I went with was map<email, map <account id, bottling_lot__C>

Then my idea was to pass that map into a visualforce page's custom controller where it could then generate a custom visualforce page which I could then bring back into my main class convert from blob to string and send on it's merry way as an html email.

So my question is in two parts, one is this a reasonable way to do this, or should is there a better solution.

The second is I can't figure out how to get the visualforce page to connect to the right version of my class that has the correct map.  Normally I would pass in an Id of some sort but that won't exactly work here.  I need to pass in the map, or at least a list of some type.

Any ideas?
 
public void sendClientEmail() {
       
        
        Set<String> repSet = new set<String>();
        map<String, Map<string, Bottling_Lot__c>> repMap = new map<String, Map<string, Bottling_Lot__c>>(); // email <account Id, bottling lot>
        Map<string, Bottling_Lot__c> acctMap;
        
        // build a set of all the owner Id that will have to be emailed        
        if (botLotList.size() > 0) {
            for (Bottling_Lot__c bot:botLotList) {  
                repSet.add(bot.client_lookup__r.owner.email);
            }
            for (String s:repSet) {
                acctMap = new map<String, Bottling_lot__c>();
                for (Bottling_Lot__c bot:botLotList) { 
                    if (s == bot.client_lookup__r.owner.email) {
                        acctMap.put(bot.client_lookup__c, bot);
                    }
                 }
                repMap.put(s, acctMap);
             }
            system.debug('repMap = ' + repMap);
         }
        
        // Define the email
       
        for (String s:repSet) {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();        
            String[] toAddresses = new String[] {}; 
            String[] ccAddresses = new String[] {}; 
            toAddresses.add('mathew@terravant.com');

            blob body;
            BottlingEmail_Class botClass = new BottlingEmail_Class(repMap);
            PageReference htmlPage = page.bottlingEmail_Page;
            body = htmlPage.getContent();
            String htmlBody = body.toString();
 
			email.setToAddresses(toAddresses);
            email.setSubject('test');
            email.setHtmlBody(htmlBody);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
            
        }
      
        
        
    } // end the send email method
 
<apex:page controller="BottlingEmail_Class" >
    
    <p>
        Hello, the following items were bottled for your clients
    </p>
    
    <table>
        <tr>
        <th>Date</th>
        <th>Account</th>
        <th>Cases</th>
        </tr>
        
        <apex:repeat value="{!botLotList}" var="v">
        	<tr>
                <td>{!v.Bottling_Shift__r.Bottling_Day__r.Bottling_Date__c}</td>
                <td>{!v.client_lookup__r.name}</td>
                <td>{!v.Actual_Bottled__c}</td>
                <td>testing</td>
            
            
            </tr>
        </apex:repeat>
        
        
        
    </table>
    <p>
        end of page
    </p>
    
</apex:page>
 
public class BottlingEmail_Class {
    
    public map<String, Map<string, Bottling_Lot__c>> repMap {get; set;}  // email <account Id, bottling lot>
    public List<Bottling_Lot__c> botLotList {get; set; }
        
    
 
    
    public BottlingEmail_Class(map<String, Map<string, Bottling_Lot__c>> repMap) {
        botLotList = new List<bottling_Lot__c>();
    	this.repMap = repMap;
        for (string key :repMap.keySet()) {
            Map<String, Bottling_lot__c> acctMap = new Map<String, Bottling_Lot__c>();
            acctMap = repMap.get(key);
            for (Bottling_Lot__c lot :acctMap.values() ) {
                botLotList.add(lot);
                
            }
            
            
        }
       
        
        
    } // end the constructor

}

 
Hi All,
I am trying to create my first VF page and Controller class. I need help for further enhancements please.

User-added image

I need help with the following:
  1. When I hit that "Back" command button - it should redirect to a custom object page, lets say - "Employee__c".
  2. Also, a custom page message should come up if any of the numbers/ text not filled (please see screenshot).
  • where and how to add the following:
     if(firstNumber == '' || firstNumber == null || secondNumber == '' || secondNumber == '')
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter First and Second numbers'));
Please look into the below code for VF Page and Class and help me with the code. Thanks.

VF Page:
<apex:page controller="firstcls">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockButtons location="top">
              <apex:commandButton value="Add" action="{!Addnumbers}"/>
              <apex:commandButton value="Subtract" action="{!SubtractNumbers}"/>
              <apex:commandButton value="Multiply" action="{!Multiplynumbers}"/>
              <apex:commandButton value="Divide" action="{!Dividenumbers}"/>
              <apex:commandButton value="Back" action="{!getBack}"/> //Not sure if, its right or wrong?
             
          </apex:pageBlockButtons>
          <apex:pageBlockSection >
              <apex:outputLabel value="Enter First Number"/>
              <apex:inputtext value="{!firstNumber}"/>
              <apex:outputLabel value="Enter Second Number"/>
              <apex:inputtext value="{!secondNumber}"/>
              
              <apex:outputLabel value="Result"/>
              <apex:inputText value="{!result}"/>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

CLASS:
public class firstcls {
public string firstNumber {get;set;}
    public string secondNumber {get;set;}
    public string temp;
    public string result {get;set;}
    
    public firstcls ()
    {
        //firstNumber = '0';
        //secondNumber = '0';
        result = '0';
    }
   public void Addnumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) + Integer.valueof(secondNumber));
    }
    
    public void SubtractNumbers()
    {
        result = string.valueof(Integer.valueof(firstNumber) - Integer.valueof(secondNumber));
    }
    public void Multiplynumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) * Integer.valueof(secondNumber));
    }
    public void Dividenumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) / Integer.valueof(secondNumber));
    }
    public PageReference getBack()
    {
    PageReference ref= new PageReference('/'+00B61000002AkLf);
    ref.setredirect(true);
    return ref;
    }
}

When I am trying to save the above class, I am getting this error-
Error: firstcls Compile Error: expecting a right parentheses, found 'B61000002AkLf' at line 39 column 47

I need guidance on this. Look forward for your helpful replies.

Thanks.
 

 
  • October 30, 2015
  • Like
  • 0
Hello everyone,

I am working at data migration project. I have problem that I must select an existed App in Salesforce platform of company to move my App in it. I have to study about 90 Apps to select one coresponded with my App. So could you please help me to guide how i study App in Salesforce quickly? What I should focus on?
My idea is:
- I will try to list all Objects of App. I can see it in
User-added image
If it is enough or not?
- And then I want to see the relationship between Object in App but I don't know how to have it, by scheme builder or any tools? And if it can be done by Scheme builder, could you please show me the steps to do it?

Thank you very much.
Huong
I have a custom object with a text field having values that represent fiscal period ids -- in the form YY-MMM. For example: 14-Jan, 14-Feb, etc.
When I query this object and order by this period id, since the field is text, it orders chronologically -- i.e., in the order 14-Apr, 14-Aug, 14-Dec, 14-Feb, etc., -- which is useless.

What would be the easiest way to achieve a sort order assuming this field represents calendar periods?

I've thought of adding another custom table to map these to month number, but couldn't figure out how to do this without a lookup relationship.

Thanks.
 
Hi i have a requirement please find the below req and suugget me , or send my any related code is already developed .

Display all related opp records for a particualr account with the below conditions
1) Opportunities which are status= TRUE 
2) These Opportunities should have at least one Product.
3) This VF page should support Pagination, each page should have max of 25 record.
This VF page should have sorting in all the columns.
4) VF page should have i/p check box has to be present in front of every record.


i developed VF page for pagination for displaying account records but dont know how to to display one account related opportunities , please help me on this or send any code 

Regards,
Hanu
AND(Price__c>15,Quantity__c>4)
This Validation rule accepts Price bt won't accept Quantity as shown in image attached.
Is this formula correct or suggest me formulas for making it valid.User-added image
I have 3 Objects and i have a senario where i have to write a trigger to insert records in 3 objects, however if the 3 object record fails to insert the earlier 2 inserted record should get deleted. help is highly appreciated.
I have a visual force page that displays all ideas in a page block table.  I want to add a link to the side of the table that reads “Most discussed”.  When clicking on it, the ideas displayed will be sorted by the number of comments.  

Likewise, I want another link that says “popular” and when clicked it’ll sort by the number of votes.  

I’ve had a look at the below:

https://help.salesforce.com/apex/HTViewSolution?id=000171025&language=en_US

This kind of covers what I’m looking to do however I’m not sure how to implement the sort options.  My page uses a standard controller with an extension.

Can anyone suggest how I would code the sort options in the apex class and then implement in visual force?
  • May 27, 2015
  • Like
  • 0
Is it possible to put a condition on a validation rule that will stop it from triggering for particular users?

We need a field to be uneditable (unless blank) for all but one user (our marketing automation platform Eloqua). 
Hi,

I want to update a field by comparing two other fields in the same object. For that what should i do? should i write a trigger or workflow? if trigger means how to write?
Hello, I want to conditionally display a "Checkout" button if a merchandise item is added to the cart in the visualforce dataTable. How can I accomplish this in visualforce?
 
<apex:commandButton value="Checkout" action="{!checkout}" rendered="{!carti} <>null"/>
    </apex:form>


 
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" controller="StoreFront2">
  <apex:stylesheet value="{!URLFOR($Resource.styles)}"/>
  <h1>Store Front</h1>
   
  <apex:form >
      <apex:dataTable value="{!products}" var="pitem" rowClasses="odd,even">
          
          <apex:column headerValue="Product">
              <apex:outputText value="{!pitem.merchandise.name}" />
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!pitem.merchandise.Price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:inputText value="{!pitem.tempCount}"/>
          </apex:column>
   
      </apex:dataTable>
      
      <br/>
      <apex:commandButton action="{!shop}" value="Add to Cart" reRender="msg,cart">
      
      </apex:commandButton>
  </apex:form>
  
    <apex:outputPanel id="msg">{!message}</apex:outputPanel><br/>    
    <h1>Your Basket</h1>
    
<apex:form >    
     <apex:dataTable id="cart" value="{!cart}" var="carti" rowClasses="odd,even">
			
   <apex:column headerValue="ID" rendered="false">
       <apex:outputText value="{!cart[carti].merchandise.Id}" >
       </apex:outputText>
          </apex:column>
          <apex:column headerValue="Product">
              <apex:outputText value="{!cart[carti].merchandise.name}">
          	
         </apex:outputText>
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!cart[carti].merchandise.price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:outputText value="{!cart[carti].count}"/>
          </apex:column>
         <apex:column headerValue="Remove?">
             <apex:commandButton action="{!Remove}" value="Remove" reRender="cart">
                 <apex:param name="rowDel" assignTo="{!rowDel}" value="{!carti}"/>
             </apex:commandButton>
         </apex:column>
                     

      </apex:dataTable>
    	<apex:commandButton value="Checkout" action="{!checkout}" rendered="{!rowDel}"/>
    </apex:form>
    
  
</apex:page>

Apex
public virtual class StoreFront2 {    
    public String message { get; set; }
    List<DisplayMerchandise> products;
    Map<Id, DisplayMerchandise> cart;

    public Id rowz;
    public id rowDel{get;set;}
    
    public PageReference shop(){
   
        handleTheBasket();
        message = 'You bought: ';
        for (DisplayMerchandise p:products){
            if(p.tempCount > 0){
               message += p.merchandise.name + ' (' + p.tempCount + ') ' ;
               }
            }
        return null;
    }
    
    public void remove(){
     rowz = (Id) ApexPages.currentPage().getParameters().get('rowDel');
        system.debug(rowz);
        if(cart.containsKey(rowz)){
            cart.remove(rowz);
    
            
        }  
         
    }

        public pageReference back(){
        PageReference doit = new PageReference('/apex/StoreCart');
        doit.setRedirect(false);
            return doit;
        }
    
    public Pagereference checkout(){
        PageReference send = new PageReference('/apex/ConfirmBuy');
   
        //send.setRedirect(false);
    	return send;    
    } 
    
    
    public void handleTheBasket(){
        for(DisplayMerchandise c : products){
            if(c.tempCount > 0){
            if(cart.containsKey(c.merchandise.Id)){
                
                cart.get(c.merchandise.Id).count += c.tempCount;
                
            }
            else{
                cart.put(c.merchandise.Id, c);
                cart.get(c.merchandise.Id).count = c.tempCount;
             
          		

            } 
        
        }
        }
        
    }
    
    public Map<Id, DisplayMerchandise> getCart() {
        if(cart == null){
            cart = new Map<Id, DisplayMerchandise>();
 
                }
       
        return cart;
    }

    public class DisplayMerchandise {
        public Merchandise__c merchandise{get; set;}
        public Decimal count{get; set;}
        public Decimal tempCount{get;set;}
        public DisplayMerchandise(Merchandise__c item){
            this.merchandise = item;
            
        }
    }

    public List<DisplayMerchandise> getProducts() {
        if (products == null){
            products = new List<DisplayMerchandise>();
    
            for (Merchandise__c item :
            [SELECT id, name, description__c, price__c
            FROM Merchandise__c
            WHERE Total_Inventory__c > 0]) {
           
            products.add(new DisplayMerchandise(item));
            }
        }
        return products;
    }

}

 
public class SalesOrder {
  public Order record{get;set;}
    public SalesOrder (ApexPages.standardcontroller std)
     { 
       record = new Order();           
     } 
  public pagereference dosave(){
      record.QuoteId = ApexPages.currentPage().getParameters().get('quoteID');
       insert record;
       ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
       pagereference page=new pagereference('/apex/SalesOrder');     
       return page;        
    }     
  public pageReference Cancel(){        
         pagereference page = new pageReference('/apex/QuoteVfPage');
         page.setRedirect(true);
         return page;
     }   
}



here is the test class i have written correct me. i am new to salesforce

@istest
Private class TestSalesOrder{
 Static TestMethod void Dosave(){
  Test.startTest(); 
 PageReference pageRef = Page.SalesOrder;
Test.setCurrentPageReference(pageRef);
  String quoteId;
    if(!test.isrunningtest()) {
      quoteId = ApexPages.currentPage().getParameters().get('quoteID');
      Account a=new Account(Name='test1',Phone='9458383336');
     insert a;
     Order ord=new Order(AccountId=a.id,Name='test',status='draft',EffectiveDate=system.today());
     insert ord;
     }
     else
      {
      }
Test.stopTest();
}
Static TestMethod void Cancel(){
Test.StartTest();
PageReference pageRef = Page.QuoteVfPage;
Test.setCurrentPageReference(pageRef);
}
}
Hi, I have a situation where I need to check for multiple stages. My opportunity page behaves as per the stage opportunity has, so there will be multiple conditions in VF as well as in controllers. Right now, stages are hardcoded and it is very troublesome to make further stage related changes. 
What would be best way to replace these hardcoded stages names? Custom lables or Lookups?

Thanks & Regards
Sanjivani
Hi 
scenario: i have two picklist values A and B in a picklist field as a controlling field and check box as a dependent field,
when A is choosen the dependent check box should be true(should be checked automatically),if B is choosen the check box should be false (unchecked). i wonder if it is possible or not ?
<apex:page standardController="Account">

    <apex:pageBlock title="My Content">

        <apex:pageBlockTable value="{!account.Contacts}" var="item">

            <apex:column value="{!item.name}"/> 

        </apex:pageBlockTable> 

    </apex:pageBlock> 

</apex:page>

What do i need to do if i need to use other custom object Object__C.

I do not not understand, if i can realize this without a controller or I will always need a controller
What are recursive triggers. How can we avoid the recursion problem?????
Hello Friends,

I have a requirement where I need to send the report as an email to the subscribed users using apex.
Salesforce may be storing the data when we are selecting to subscribe a report.
I want to know where salesforce stores this information and how I can fetch it using apex.

Any help is appreciated. 
 
Hello Guys,

I want to develop an offline mobile solution for both IOS and Android.
Can you please suggest me the best way to achieve it.
Please help me with some good links to sample code or demo.

Best Regards,
Mudasir.
Hello Guys,
  
Have a look on my requirement.
First thing is that I am not allowed to use a validation rule.
and I have to perform the action on detail page save button action and not from the Inline VF page button.

1. I have to perform some action on salesforce detail page save button.
2. I have an inline VF page where I want to use JQuery to dynamically capture salesforce detail page save button action and before saving i need to handle some logic.
3. My actual requirement is that I need to give an alert to the user informing him about filling a value in one of the fields if he wants otherwise we need to save the record.

Any idea is appreciated. 
Hi Guys,

For last few days we are facing an error in our existing code which uses PageReference.getContent.
When this peice of code runs it gives us following error.
"The page you submitted was invalid for your session. Please try your action again".

I have visited many blogs which are saying it is  a network problem.
We have checked it with different networks and on different salesforce instances as well and there is same result.

Can you please help.
Please help me with the correct answer.

A developer creates an Apex helper class to handle complex trigger logic. How can the helper class warn users when the trigger exceeds DML governor limits?
A. By using ApexMessage.Message() to display an error message after the number of DML statements is exceeded.
B. By using Messaging.SendEmail() to conthtinue the transaction and send an alert to the user after the number DML statements is exceeded.
C. By using PageReference.setRedirect() to redirect the user to a custom Visualforce page before the number DML statements is exceeded.
D. By using Limits.getDMLRows() and then displaying an error message before the number of DML statements exceeded.
I am looking for someone to create a tool for exporting to a specific file type (I have no idea the best way to accomplish what I need, counld be Web Services, could be something built-in) that does the following:

1. Generate a tab-delimited file that will be used for import into our accounting software. Name file with an extension of .iif (Quickbooks import file).
2. The file will require specific header names, and a repeating pattern for each row of data. For example:

Row 1 - Header names
Row 2 - Second row of header names
Row 3 - Close header names section

Row 4 - Open Data Row
Row 5 - Data
Row 6 - Close Data Row

Rows 4-6 repeat that pattern until the data runs out. 

If you think this is something you can handle, please let me know and perhaps offer up a bid. You can email me directly at shantelle AT openlegalservices.org .
Hi,

I am trying to send an email where I include certain values from a customObj1. I noticed that when I insert the field "Start_Date__c" (type is Date) into the email body, then the field renders as "2015-08-12 00:00:00". This is not what I want.

How can I include a Date field that will output as "MM/DD/YYYY" (or MM-DD-YYY) in an email that is sent from an apex classes?
  • November 25, 2015
  • Like
  • 0
HI all,

what is @Remoteaction why we are using this in controller 

any one  could you please explain 


Thanks 
SS
  • November 23, 2015
  • Like
  • 0
HI Experts,

I have requirment there is profile 'ABC' this profile have object called 'Orgnisation' which contain Read , Edit, Create, view all permission for this profile,
my requirement is that there is picklist field called 'Orgnistaion_Type__c'. Now requirment is that if Orgnistaion_Type__c= 'supplier' then i need to provide Read and Edit access for the user ,if other than 'supplier' i need to provide Ready access only, if user  try to edit such record by the user i need to provide an error message.
HI
  How to remove the left navigation in the user profile.


Thanks&Regards
RangaReddy
Hi all,

I need to send email based on the country language of the user. For example if the user choose india, Email body will be in hindi. If user choose Korea the body will be in korean language. Suggestion please.

Thank You,
 
 
I am using the below sectin in VF page to render selectively based on Value of Opportunity Stage

            <apex:pageBlockSection id="Stage_Details" title="Stage Details" >
                
                <apex:repeat id="Opportunity_Stage_Fields" value="{!OpportunityStageFields}" var="f">
                     <apex:pageBlockSectionItem >
                         <apex:outputLabel id="fs_contract_type_label" value="{!$ObjectType.Opportunity.Fields[f].label}"/>
                         <apex:inputField id="fs_contract_type" value="{!sOpportunity[f]}">
                             <apex:actionSupport event="onchange" immediate="true" rerender="Stage_Details"  rendered="true"/>    
                         </apex:inputField>
                     </apex:pageBlockSectionItem>                                                                              
                 </apex:repeat><br/>
                 
                 <apex:repeat id="Reason_Comments" value="{!OpportunityStageReasonFields}" var="f">
                     
                     <apex:pageBlockSectionItem rendered="{!if(sOpportunity.stagename == 'Closed On Hold','true','false')}">
            <apex:outputLabel id="fs_Reason_label" value="{!$ObjectType.Opportunity.Fields[f].label}"/>
                         <apex:inputField id="fs_Reason" value="{!sOpportunity[f]}" rendered="{!if(sOpportunity.StageName == 'Closed On Hold','true','false')}"/>                        
                     </apex:pageBlockSectionItem>                                                                             
                 </apex:repeat>
                 
            </apex:pageBlockSection>


Below is the sections added in Controller


    public List<Schema.FieldSetMember> getOpportunityStageFields() {
            return SObjectType.Opportunity.FieldSets.Opportunity_Stage.getFields();
    }


    public List<Schema.FieldSetMember> getOpportunityStageReasonFields() {
            return SObjectType.Opportunity.FieldSets.Opportunity_Stage_Reason_Closed.getFields();
    }


Additionally have created two field sets 
1) Opportunity_Stage (field Opportunity Stage) 
2) Opportunity_Stage_Reason_Closed (Reason Closed & Reason Closed COmments)


Still once I change the status of the Field Opportunity Stage, if does not return with the Reason Closed & Reason Closed COmments fields.
  • November 10, 2015
  • Like
  • 0
Can I edit a Non-profit starter pack trigger? The trigger npe5__Affiliation__c from the NPSP is causing an error for certian users. Since the functionality of this trigger is not neccessary for those users getting the error, I was wonderin if I can disable it for them? Can anyone help me do that? 
Hi All,

While updating the user record of the deactivated user by making IsActive as 'true' through apex code we are getting below error.
Update failed. First exception on row 0 with id 005F0000005sY9qIAE; first error: INVALID_CROSS_REFERENCE_KEY, Cannot activate a disabled portal user: [IsActive]

Is it possoble through code or not?
Can any one help me on this matter?

Thanks in advance
Hi,

I have a list of bottling's done each day that I'm breaking up by user email and then account so each user might be multiple accounts.  The structure I went with was map<email, map <account id, bottling_lot__C>

Then my idea was to pass that map into a visualforce page's custom controller where it could then generate a custom visualforce page which I could then bring back into my main class convert from blob to string and send on it's merry way as an html email.

So my question is in two parts, one is this a reasonable way to do this, or should is there a better solution.

The second is I can't figure out how to get the visualforce page to connect to the right version of my class that has the correct map.  Normally I would pass in an Id of some sort but that won't exactly work here.  I need to pass in the map, or at least a list of some type.

Any ideas?
 
public void sendClientEmail() {
       
        
        Set<String> repSet = new set<String>();
        map<String, Map<string, Bottling_Lot__c>> repMap = new map<String, Map<string, Bottling_Lot__c>>(); // email <account Id, bottling lot>
        Map<string, Bottling_Lot__c> acctMap;
        
        // build a set of all the owner Id that will have to be emailed        
        if (botLotList.size() > 0) {
            for (Bottling_Lot__c bot:botLotList) {  
                repSet.add(bot.client_lookup__r.owner.email);
            }
            for (String s:repSet) {
                acctMap = new map<String, Bottling_lot__c>();
                for (Bottling_Lot__c bot:botLotList) { 
                    if (s == bot.client_lookup__r.owner.email) {
                        acctMap.put(bot.client_lookup__c, bot);
                    }
                 }
                repMap.put(s, acctMap);
             }
            system.debug('repMap = ' + repMap);
         }
        
        // Define the email
       
        for (String s:repSet) {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();        
            String[] toAddresses = new String[] {}; 
            String[] ccAddresses = new String[] {}; 
            toAddresses.add('mathew@terravant.com');

            blob body;
            BottlingEmail_Class botClass = new BottlingEmail_Class(repMap);
            PageReference htmlPage = page.bottlingEmail_Page;
            body = htmlPage.getContent();
            String htmlBody = body.toString();
 
			email.setToAddresses(toAddresses);
            email.setSubject('test');
            email.setHtmlBody(htmlBody);
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
            
        }
      
        
        
    } // end the send email method
 
<apex:page controller="BottlingEmail_Class" >
    
    <p>
        Hello, the following items were bottled for your clients
    </p>
    
    <table>
        <tr>
        <th>Date</th>
        <th>Account</th>
        <th>Cases</th>
        </tr>
        
        <apex:repeat value="{!botLotList}" var="v">
        	<tr>
                <td>{!v.Bottling_Shift__r.Bottling_Day__r.Bottling_Date__c}</td>
                <td>{!v.client_lookup__r.name}</td>
                <td>{!v.Actual_Bottled__c}</td>
                <td>testing</td>
            
            
            </tr>
        </apex:repeat>
        
        
        
    </table>
    <p>
        end of page
    </p>
    
</apex:page>
 
public class BottlingEmail_Class {
    
    public map<String, Map<string, Bottling_Lot__c>> repMap {get; set;}  // email <account Id, bottling lot>
    public List<Bottling_Lot__c> botLotList {get; set; }
        
    
 
    
    public BottlingEmail_Class(map<String, Map<string, Bottling_Lot__c>> repMap) {
        botLotList = new List<bottling_Lot__c>();
    	this.repMap = repMap;
        for (string key :repMap.keySet()) {
            Map<String, Bottling_lot__c> acctMap = new Map<String, Bottling_Lot__c>();
            acctMap = repMap.get(key);
            for (Bottling_Lot__c lot :acctMap.values() ) {
                botLotList.add(lot);
                
            }
            
            
        }
       
        
        
    } // end the constructor

}

 
Hi All,
I am trying to create my first VF page and Controller class. I need help for further enhancements please.

User-added image

I need help with the following:
  1. When I hit that "Back" command button - it should redirect to a custom object page, lets say - "Employee__c".
  2. Also, a custom page message should come up if any of the numbers/ text not filled (please see screenshot).
  • where and how to add the following:
     if(firstNumber == '' || firstNumber == null || secondNumber == '' || secondNumber == '')
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter First and Second numbers'));
Please look into the below code for VF Page and Class and help me with the code. Thanks.

VF Page:
<apex:page controller="firstcls">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockButtons location="top">
              <apex:commandButton value="Add" action="{!Addnumbers}"/>
              <apex:commandButton value="Subtract" action="{!SubtractNumbers}"/>
              <apex:commandButton value="Multiply" action="{!Multiplynumbers}"/>
              <apex:commandButton value="Divide" action="{!Dividenumbers}"/>
              <apex:commandButton value="Back" action="{!getBack}"/> //Not sure if, its right or wrong?
             
          </apex:pageBlockButtons>
          <apex:pageBlockSection >
              <apex:outputLabel value="Enter First Number"/>
              <apex:inputtext value="{!firstNumber}"/>
              <apex:outputLabel value="Enter Second Number"/>
              <apex:inputtext value="{!secondNumber}"/>
              
              <apex:outputLabel value="Result"/>
              <apex:inputText value="{!result}"/>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

CLASS:
public class firstcls {
public string firstNumber {get;set;}
    public string secondNumber {get;set;}
    public string temp;
    public string result {get;set;}
    
    public firstcls ()
    {
        //firstNumber = '0';
        //secondNumber = '0';
        result = '0';
    }
   public void Addnumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) + Integer.valueof(secondNumber));
    }
    
    public void SubtractNumbers()
    {
        result = string.valueof(Integer.valueof(firstNumber) - Integer.valueof(secondNumber));
    }
    public void Multiplynumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) * Integer.valueof(secondNumber));
    }
    public void Dividenumbers()
    {
        
        result = string.valueof(Integer.valueof(firstNumber) / Integer.valueof(secondNumber));
    }
    public PageReference getBack()
    {
    PageReference ref= new PageReference('/'+00B61000002AkLf);
    ref.setredirect(true);
    return ref;
    }
}

When I am trying to save the above class, I am getting this error-
Error: firstcls Compile Error: expecting a right parentheses, found 'B61000002AkLf' at line 39 column 47

I need guidance on this. Look forward for your helpful replies.

Thanks.
 

 
  • October 30, 2015
  • Like
  • 0

I need to export a report as a CSV to an FTP site or email it on a daily or weekly basis.

 

I have a Report.  I need to get the report out of Salesforce somehow into CSV format.

 

Ideally, this would be scheduled.


I'm a developer so I can do developer stuff.  However, I don't know APEX and I don't know VisualForce.  I can get someone to do that stuff if we need to.


Thanks!

  • July 26, 2011
  • Like
  • 2
I need to show all the contact id related to a particular account and total number of contact related to account  so that whenever i click on a particular contact id it should redirect me to that contact page.
Can anyone help me on this.
Thanx
I have a need for a Visualforce developer to help roll out a Customer Community for one our clients.  

4-5 pages (Case, Knowledge, Library/Documents, Collaboration/Chatter)

In lieu of the template option, we would like to wrap this Community/Portal around existing HTML already created for the public-facing website.  Based on my understanding of VF, I would only need a development to help with the programming of existing assets and plugging in the needed objects.  

Please contact me via this post or Sean Reed, 847-580-2250, sreed@continuumclinical.com
i want to disable a button based on a status. say quoting we have "email quote" button. this should be disabled till quote is in Approved status.please guide me on this ?

Any help would be greatly appriciated
Hi Guys,

    Hope so many peoples integrated google map in visualforce page using the javascript. From Salesforce Spring'15 onwards, Map components are released. Some of the people may not aware about this.

Please find the below link it will helpful who don't know about this component..!

http://salesforcekings.blogspot.in/2015/03/of-us-already-known-about-thegoogle-map.html

I need to export a report as a CSV to an FTP site or email it on a daily or weekly basis.

 

I have a Report.  I need to get the report out of Salesforce somehow into CSV format.

 

Ideally, this would be scheduled.


I'm a developer so I can do developer stuff.  However, I don't know APEX and I don't know VisualForce.  I can get someone to do that stuff if we need to.


Thanks!

  • July 26, 2011
  • Like
  • 2