I have created a new custom Formula Field called Locale on the Case object. I want to extract all values which are available on User object (Locale field values) to this Case Locale field. How? without using Apex Class we can use validation Rule or formula Field or any other Method
122387
I Have Created a New Custom Formula Field called Locale in Case Object,I want to Extract all Values which is available on User object(Locale Field Value) to case Locale Field, How ? Can anyone Explain to this Question.
80637
So I have a collection of objects.  The exact type isn't important.  From it I want to extract all the unique pairs of a pair of particular properties, thusly:  myObjectCollection.Select(item=&gt;new                                 {                                      Alpha = item.propOne,                                      Bravo = item.propTwo                                 }                  ).Distinct();   So my question is:  Will Distinct in this case use the default object equals (which will be useless to me, since each object is new) or can it be told to do a different equals (in this case, equal values of Alpha and Bravo => equal instances)?  Is there any way to achieve that result, if this doesn't do it?
46064
How can I go about displaying a date that is formatted to a users locale, for example me and my Australian friends use the format dd/MM/yyyy, while the Americans amoung us use MM/dd/yyyy. I know I can format a date in visualforce like so  &lt;apex:outputText value="{0,date,dd/MM/yyyy}"&gt;     &lt;apex:param value="{!myDateValue}" /&gt;  &lt;/apex:outputText&gt;   but how can I use the salesforce locale,   but how can I use these on my page?  I have found a very comprehensive solution , but I was hoping someone new of an inbuilt, or more elegant way.
87162
I have contact object and Registration Custom Object.  I want to list the registration object fields in contact object using relationship as follows:  SELECT id, name, (SELECT id,name FROM Registrations__r) FROM Contact;   I want to do the same thing using SOSL. is that Possible? I did something like this for Contact fields.  FIND 'searchText' IN ALL FIELDS RETURNING Contact(name,Email);   doesnot know how to use registration object fields here...
112643
I have an issue with remote objects: I run the following code:  &lt;apex:remoteObjectModel name="Case" jsShorthand="case"                      fields="Subject,Id,CaseNumber,CreatedDate,Status,Description,IsClosed,Priority,Type"/&gt;      var cases = new SObjectModel.Case();     cases.retrieve({where: {IsClosed: {eq: false}}}     , function(error, records) {     });   and the error is:  Error occurred while performing RETRIEVE operation on sobject: Case with data: {where={IsClosed={eq=true}}} (MALFORMED_QUERY:  subject, createddate, id, casenumber, _cid FROM Case WHERE IsClosed =                                      ^ ERROR at Row:1:Column:76 line 1:76 no viable alternative at character '_')    Well, yesterday it was working ok. What can be wrong with this part?
33374
I've got a report being built from a dataset. The dataset uses the Sort property to order the data. I know that I can create a sort expression like this:  "field desc, field2 asc"  But what I need now is a way to do a custom sort. In SQL, I can perform a custom sort by doing something like this:  order by      case when field = 'Some Value' then 0 end     case when field = 'Another Value' then 1 end   To basically re-define my sort (i.e, Some Value comes before Another Value).  Is it possible to do something similar as a sort expression against a DataView?
25865
I'd like to increment fields based on the quote field, so when a quote is created, a custom field will increment depend on the region (each field will have format of "ZO - {000}). Each region should have it's own series of Unique numbers. For example: if it's a "US" region quote, "Quote Number1" custom field will increment (. If it's a "ROW" region quote, "Quote Number2" custom field will increment.  Standard "Autonumber" field works on any record creation, and not customized by record types..  UPDATE: I modified a trigger posted as an answer (@user2590, see below your modified code). I want the autonumbers to work only for "Invoice" record type in Quotes ("Quote record type should be affected"). I assume it is simpler than the original code but somehow it doesn't work...I'm getting: "System.NullPointerException: Attempt to de-reference a null object". Can you have a look and see what's not working?  trigger SampleAutoNumberRegion on Quote (before insert){ String[] name = new String[]{'Invoice'};  Map&lt;Id, RecordType&gt; regions = new Map&lt;Id,RecordType&gt;([SELECT Name from RecordType WHERE sObjectType = 'Quote' AND Name IN :name]);  AggregateResult res = [SELECT MAX(US_Invoice__c) max1, MAX(ROW_Invoice__c) max2 FROM Quote WHERE RecordType.Name IN :name ];   Integer max1 = Integer.valueOf(((String)res.get('max1')).substringAfter('- ') ); Integer max2 = Integer.valueOf(((String)res.get('max2')).substringAfter('- ') );   for(Quote theQuote : trigger.new){          if(thequote.Opportunity.Account.Region__c.contains('US')){   //region corresponds to 'US'         String num1 = String.valueOf( (max1 != null) ? ++max1 : 1 );//will use the incremented value of max unless max was null (else use 1 instead)          for(Integer i=0; i&lt; (3 - num1.length() ); i++){ //should pad with leading zeros to ensure format of {000}             num1 = '0' + num1;         }         theQuote.US_Invoice__c = 'ZO - ' + num1;      }       else if(!thequote.Opportunity.Account.Region__c.contains('US')) {          String num2 = String.valueOf( (max2 != null) ? ++max2 : 1 );         for(Integer i=0; i&lt; (3 - num2.length() ); i++){ //should pad with leading zeros to ensure format of {000}             num2 = '0' + num2;         }         theQuote.ROW_Invoice__c = 'ZO - ' + num2;    }  } }
66126
I have a custom object "Reporting__c".  This custom object is linked to MyContracts__c, which is a child of Opportunity.  I need to display a field from Opportunity on my Reporting__c object and I want to use a formula.  I tried:  Formula(Text) = MyContracts__r.Opportunity.CustomField   But this does not work. Isn't this possible?  Tia.
9948
I would like to either populate a cell value from direct key input or have the cell value derived from a formula.  Example: either directly input a number into cell A4 or have the value for A4 = A2 + A3    I don't want the formula overwritten should direct key input be used.  Thx, hope this clarifies.
106917
This formula works fine when adding a new list item:  =[Class Date]>=TODAY()+3  Basically ensuring the user selects a date greater than two days away from current date.  I don't want the formula to be in effect if the record is an UPDATE to an existing record.  So if someone comes back to this record after completing it correctly and saving it, but now wants to update a different field I don't want this field to be editable nor do I want the validation formula to be applied to the updating of the record.  Is this possible?
92730
I'm trying to use the FIELDS(ALL) function in my apex test class, in order to prevent this kind of error  SObject row was retrieved via SOQL without querying the requested fields...  But I can't save class with such query, because of this error:         The SOQL FIELDS function is not supported with an unbounded set of fields in this API.   Api version on test class 51 When I try to use the same query by dev console, it works fine.  Any thoughts?
77638
I'm trying to implement a preview screen with a picklist of available languages and a textbox with translated text. The problem is System.Label.My_Preview_Text or $Label.My_Preview_Text are already translated to current User's locale. Is there a way to retrieve a translation for the specified locale, something like System.Label.getValue('My_Preview_Text','en_US'). Like we can do this in  or . Is there a way to do that in Apex/VisualForce?
100478
I'm trying a library that acts like an object factory. It works with serialization, so it is possible to specify formula fields without DML, which is pretty handy with tests.  My issue is that I'm trying to write a class that requires the Quote type. The apex compiler throws me the following error when using Quote.class:     Invalid field class for SObject Quote   But Opportunity.class, Account.class and even QuoteLineItem.class work just fine. Any idea why? Is it not possible to get the quote type? Or is there another way of doing it?
2668
In my module I have some custom strings. I use these in the t() function. When I go to admin/config/regional/translate/translate and filter the untranslated strings my custom strings do not show here.  What could be going wrong?
12448
I have a custom object with name and a lookup to contact among other fields.  The need that i have is that i need to make sure that only record name should not be duplicated for a contact.  There can be duplicate names as long as its not the same contact. We should not allow duplicate names for the same contact.  Can we achieve this using validation rules? I am trying to avoid using triggers if this can be achieved using validation rules.
111931
I am new to Apex and just starting to understand using maps to avoid loops within loops and hitting limits. My trigger below updates opp line items with the internal cost from another object using a map and the one value - "Service_Name".  My issue is I need to update another field on the Opp line item with "Agent Fee" in the same way  - but there are 4 criteria to get the right Agent Fee from another object. I cant see how do so this other than have a loop of agent Fees object with the opp line loop? How else can I do this? Is it possible with Maps ?  trigger sectortest on Opportunity (after update) {          for (Opportunity eachopportunity : Trigger.new){                                        //Get costs for the Opps FY and put in map         List&lt;Internal_Costs__c&gt; costs = [SELECT Id, Financial_Year__c, Service_Name__c, Standard_Cost__c  FROM Internal_Costs__c WHERE Financial_Year__c =: eachopportunity.Financial_Year__c];          Map&lt;string, Decimal&gt; costmap = new Map&lt;string, Decimal&gt;();         for (Internal_Costs__c eachcost : costs){                                         costmap.put(eachcost.Service_Name__c, eachcost.Standard_Cost__c);                         }                 //Get Line Items for Opp         List&lt;OpportunityLineItem&gt; opplines = new List&lt;OpportunityLineItem&gt;();           opplines = [SELECT Id, DS_Status__c, Country__c, Product2Id, UnitPrice FROM OpportunityLineItem WHERE OpportunityId =: EachOpportunity.Id];           List&lt;OpportunityLineItem&gt; opplinesupdate = new List&lt;OpportunityLineItem&gt;();                //assign cost to line items              for (OpportunityLineItem EachOppline : opplines) {                                                                                              decimal cost = costmap.get(EachOppline.Service_Name__c);                                                                 EachOppLine.Internal_Cost__c = cost;                                                                             opplinesupdate.add(EachOppline);                                                                                                                                                        }              update opplinesupdate;                        }                       }
20434
I'm trying to create a validation rule formula in Salesforce, that uses two picklist fields which have the same values : p1, p2, p3.  One of the picklists is on the account object and the other one on the contact object.  If the selected value on the contact record is p1 and on the contact's account record is p2 then I would like to throw an error.  Any help would be greatly appreciated.