• ~Onkar
  • NEWBIE
  • 398 Points
  • Member since 2007

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 80
    Replies
I'm having a problem with getting a formula field to calculate the correct percentage. I have 3 fields    Cost (currency field) Number of Months(Number Field) Retainer(Percent Field)

I'm trying to create a formula that shows the results of
Cost__c * Number_Of_Months__c - Retainer__c

But when i view the Total__c field, My formula is only reducing the amount by the number I enter into the retainer field.

So I enter 1,000 into the cost field and 5 in the number of months  field and 5 percent in the retainer field  my return value is $4,999.95 not 4,750. Can any one help me with this formula? 
Hello,
I need to export the State & Country picklist values which I think are in the Settings folder in the workbench but I need an xml file to do so

Looking for the format of the xml file needed
Hello.I am new using SFDC and i have a problem now.

I want to select some data that was created 14 days ago. so i wrote soql like this:
Select Id, CreatedDate FROM ***** WHERE CreatedDate < Last_N_DAYs:14 order by CreatedDate DESC
for example today is 19th so i want to get the date before 5th, but the latest date i get is 2016-08-03T23:34:01.000+0000
FYI i am in UTC 9 time zone. but it is still not right considering the time zone thing.  

I appriciate if someone can tell me what is wrong with it. thanks.
There is a duplicate rule on Account object enabled in my org. I have a customize lead convert classic page, in which if I select Create New account option then on click of convert button, it should display the error message of the duplicate rule. I added the below code to be displayed in error messge.
Database.LeadConvertResult leadConvertResult = Database.convertLead(leadConvert);
        
        // if the lead converting was a success then create a task
        if (!leadConvertResult.success)
        {
           PrintErrors(leadConvertResult.errors);
            
            return null;
         }

    //this method will take database errors and print them to teh PageMessages 
    public void PrintErrors(Database.Error[] errors)
    {
        for(Database.Error error : errors)
        {
            if(error instanceof Database.DuplicateError)
            {
               Database.DuplicateError duplicateError = (Database.DuplicateError)error;
               Datacloud.DuplicateResult duplicateResult = duplicateError.getDuplicateResult();
			// Display duplicate error message as defined in the duplicate rule
               ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.Severity.ERROR, 'You are creating a duplicate record. We recommend you use an existing record instead.');
               System.debug('The error message'+errorMessage);
                ApexPages.addMessage(errorMessage); 
            }
        }
    }
The above code doesn't provide the simple error message as mentioned in the code. However I recieve a the below error. What is it that I am doing wrong here ?
Hi
I am trying to understand trigger basics, so I have an custom field HelloWorld in acocunt object and when I create a new record I am updating the custom field with some value and the code is working
My requirement is to update the custom field in the old account records also.
How to access old record records?
Pls let me know.
public class HelloWorld
{
   public void Display(List<Account> acc)
    {
       for(Account val:acc)
       {
           if (val.Hello__c == null)
                 val.Hello__c='World';
       }
    }
} 

trigger trgupd_hello on Account (before Insert,before update,before delete,after insert,after update,after delete,after undelete)
{
      if (trigger.isBefore) 
      {
           if (trigger.isInsert)
           {
               HelloWorld obj_hello=new HelloWorld();
               obj_hello.Display(trigger.new);  
            }
     } 
}

Thanks
Pooja Biswas

Is there a way APEX, Visualforce, Admin settings or anything that will disable a user to create their own column search?

So when I search for something and click on show more, is there are a way to disable the customize section for other users such as My columns and Columns and buttons for All users?

User-added image

Only reason because I dont want the users be able to access some data.

Thanks in advance

I need to display products in Order object. We are using 'Order Products (Pricebook)' standard object which is in lookup with 'Orders'. But i am unable to find api name of 'Order Products' standard object to query them products selected from pricebook.

I need to show both "order details" and "products in order (Order Products)" details.

My contoller code. Working for only retriving orders. Not working for quering order products (Pricebook)
 
public with sharing class OrdersController {

    public List<Order> orderList {get;set;}
    
    public OrdersController(){
        orderList = new List<Order>();
    }
    
    public List<Order> getOrders(){
        return [SELECT OrderNumber, TotalAmount, Status (Select Product2Id, Product2.Name From PricebookEntry__r Where Product2Id =: productdet) FROM Order WHERE OwnerID=: UserInfo.getUserId()];
    }
 }
My VF code:
 
<apex:page controller="OrdersController" showHeader="false">

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
    
jQuery.noConflict();
    
    jQuery(document).ready(function($) {
        
        $("#pnl_details").hide();
 
        $('#viewDetails').click(function () {
            if ($("#pnl_details").is(":hidden")) {
                $("#pnl_details").slideDown("slow");
                $("#viewDetails").html("Show Less Details");
                 return false;
            } else {
                $("#pnl_details").hide("slow");
                $("#viewDetails").html("Show More Details");
             return false;
            }
            });         
    });
</script>

  <apex:pageBlock >
  <!-- <apex:repeat value="{!Orders}" var="owd">
            ['{!owd.OrderNumber}','{!owd.TotalAmount}','{!owd.Status}']
</apex:repeat> -->
  <apex:pageBlockSection title="Orders" id="pnl_details" columns="1">
        <apex:pageBlockTable value="{!orders}" var="o">
      
            <!-- <apex:column headerValue="Order Number">
                <apex:commandLink action="{!URLFOR($Action.Order.View, o.id)}" value="{!o.OrderNumber}"/>
            </apex:column> -->
            <apex:column value="{!o.OrderNumber}"/>
            <apex:column value="{!o.TotalAmount}" />
            <apex:column value="{!o.Status}" />
            
      </apex:pageBlockTable>
  </apex:pageBlockSection>
<apex:pageBlockSection columns="1">
    <apex:relatedList list="Pricebook2 " />
</apex:pageBlockSection>
  </apex:pageBlock>

</apex:page>



help me in this.
 
I have a bunch of new Contacts without an Account name field.  However, I have a custom field on the Contact Level called email Domain; how can I create a WF or trigger, where if the custom field Email Domain matches then the Account Name should be the same as well.

For Example
I have: 

Name:Bruce Wayne                                       
Account: Wayne Enterprise
Email Domain: abcinc.com

IF
Name: Clark Kent
Account: (blank)
Email Domain: abcinc.com

Then for Contact Clark Kent then Account = Wayne Enterprise.

 
Hiii,
Can any one please help me out in generating report on task object, I am able to display only single object records but i need to display as shown below:.. 
User-added image
Thanks in Advance.
I need to create a VF Page for Account for creating, viewing and editing records. What is the best approach to handle the fields for opening them for edit and view only mode? Can we use the same VF page to handle all the scenarios? How to code controller logic to handle multiple scnearios(save, edit and view)?
public with sharing class SendNamerFinacialSdlGroup{
i have the method where i will check the lead (lead records related to group members) owners and status is not changed with in 24 hoursthen  i will update the checkbox__x to true.

Currently i have written the code until fetching the leads related to particulr public group of test_Team.Please suggest me how to check the existed old status with new lead status in apex class to process furthur.
 public static void updateNamercheckbox(List<Lead> allleadlist){
       set<id> useridset=new set<id>();
       set<id> leadid=new set<id>();
       
       for(Lead led:allleadlist){
       leadid.add(led.ownerId);
       }
        List<Group> pbgrpid = [select id from Group where type='Regular' AND DeveloperName='test_Team'];
        List<GroupMember> userids = [select UserOrGroupId,GroupId  from GroupMember where GroupId IN:pbgrpid];
          for(GroupMember gmid:userids){
            useridset.add(gmid.UserOrGroupId);
            }
          system.debug('useridset' +leadid);
    
}
}
Hi all,

I was wondering if its possible for a trigger to automatically create an opportunity product when an opportunity is closed won.

I have an Object related to the opportunity that has fields called Product_Name__c and Total_Price__c.

I would like the trigger to populate these fields into the corresponding fields on the Opportunity Products object.

Thanks
Hi All,

I'm running one time update using Execute Anonymous and getting error "Salesforce SOQL Error Too many SOQL 001" for the following code, I tried few options to change the code but couldn't run the update, anyone can help with this code please: (Opportuntiy is master for custom object Sales Team, 1 : M)

List <Opportunity> OpptySalesRep = [Select Id,Sales_Rep__c From Opportunity Where  Sales_Rep__c !=null and (CreatedDate > 2014-11-01T00:00:00Z and CreatedDate <= 2014-11-30T00:00:00Z)];    

    set<Id> opportunityIdSet = new set<Id>();
        for (Opportunity Oppty : OpptySalesRep) {
          
            list<Sales_Team__c> newGSTmember = new list<Sales_Team__c>(); 
           
            opportunityIdSet.add(Oppty.Id); //Needed for following SOQL for GST       

           //Query to get all Sales team memeber for the opportunity                    
           List <Sales_Team__c> gst = [Select Sales_Team_Member__c,Primary__c,Producer__c,Opportunity__c,Id
                                             From Sales_Team__c
                                             Where Opportunity__c  IN: opportunityIdSet and  Producer__c = null and Opportunity__c <> null];
                                        
                                             system.debug('Number of Sales Team Member# ' + gst.size());
            
            //Reset  opportunityIdSet for avoid duplicate iteration 
             opportunityIdSet.remove(Oppty.Id);
                           
            boolean IsnewSalesRep = true;  //to check if Sales Rep already exists in GST            
              
           // Loop through the list and update GST record that matches to Sales Rep
           for (Sales_Team__c OpptyGST : gst){
              system.debug('GST Memebr# : ' + OpptyGST.Sales_Team_Member__c);                        
              
              //Update Sales Rep to Primary
              if (OpptyGST.Sales_Team_Member__c == Oppty.Sales_Rep__c){
                  system.debug('INSIDE If');
                  OpptyGST.Primary__c = true;
                    IsnewSalesRep = false;
                }
              // Update Sales reps to non-primary
                else if (OpptyGST.Sales_Team_Member__c != Oppty.Sales_Rep__c && OpptyGST.Primary__c == true){
                  system.debug('INSIDE else If');
                  OpptyGST.Primary__c = false;
              }
                            
              }
            
            //Add Sales Rep to GST          
             if (IsnewSalesRep == true)
             {
             Sales_Team__c newGST = new Sales_Team__c (); //instantiate the GST object to put values
                          
            newGST.Sales_Team_Member__c = Oppty.Sales_Rep__c;
             newGST.Primary__c = true;
             newGST.Opportunity__c = Oppty.Id;
             newGSTmember.add(newGST);
             insert newGSTmember;
             
              }
           
              update gst;  
                         
           }