• Noam Dgani
  • NEWBIE
  • 34 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies

I have been trying and searching for a while and I can't seem to find a way to display the Time specificly the hour and minutes from and Date time field. I would like to display the Hour and Minute from the NOW() function in salesforce formula editor. If anyone can give me some tips that would be great. Thanks.

Hi All

 

Spoiler: i dont have a specific issue - i'm just looking for the insights and expirience of the community members.

 

The company i work for started out using Salesforce as their CRM system about 4 yrs ago and is now at a point where most backend processes are built on the Force.com platform, due to the relative rapid development opportunities it presents. 

 

Due to the ongoing growth in demand for new processes in the Force.com platform, we are researching the possibility of going vertical with our Force.com development (and when i say development, i dont just mean code - configuration, data model etc.) - which basically means, if we look at our ultimate goal, every product/business unit will have an allocated Force.com mini-team (1-2 people) to provide their Backend/CRM needs.

 

The challange is to allow these autonomous silos of force.com teams to work independently without stepping on each other's toes - and that is not a straight forward task when using Force.com (or any system for that matter - but Force makes it harder).

 

Some clashes that come to mind are:

1. sharing governer limits.

2.sharing a data model.

3. sharing the application layer (if not coded correctly - a simple exception in a trigger could affect processes fromother silos).

 

and many more.

 

The idea of multi-orgs has been raised, but from personal expirience, i think its a turn you dont want to take (generally speaking of course).

 

I would like to hear you opinions and expiriences with such challanges.

 

King Regards

Noam Dgani

 

Hi,

 

I'm a beginner with APEX, i just finished to administrate my company Salesforce but we need some APEX class and Trigger to be able to use Salesforce as we wish.

 

We have the basic product, and when the salesman will add a product to an opportunity we will ask him to put a "mpn number". So we want to use the mpm number who will define the real price of the product(it's a particular number linked to a product depends on the customization of this product)

 

The administrator of ou e-commerce give me an URL as this one

 

http://mycompany.com/mpn.getprice?id=[produit_uad_id]&mpn=[code_mpn]

 

i saw this:

public class HttpCalloutSample {
    // Pass in the endpoint to be used using the string url
   
    public String getContent(String url) {
        // Instantiate a new http object
        Http h = new Http();
        
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        return res.getBody();
    }
}

 but i still don't undsertand of i can use it with my opportunity product.

 

I'll try to find by myself, but if someone an help me it would be great!

I have been trying and searching for a while and I can't seem to find a way to display the Time specificly the hour and minutes from and Date time field. I would like to display the Hour and Minute from the NOW() function in salesforce formula editor. If anyone can give me some tips that would be great. Thanks.

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger EscalateCase caused an unexpected exception, contact your administrator: EscalateCase: execution of BeforeInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Trigger.EscalateCase: line 76, column 1

 

It is erroring on line:

List<Case> cCaseTypes = [SELECT Status, Id FROM Case where Status='Escalation Hold' AND ParentId =:escalatedcase.id LIMIT 10];


 

trigger EscalateCase on Case (before update, before insert) {
//MAP record type ID's to record type names.
        List<RecordType> rTypes = [select id,name from RecordType where SobjectType='Case'];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
           
        MAP<Id , String> maprtID_rtName = new MAP<ID , String>();  //map record type ID's to record type names.
        for(RecordType rTypeObj :  rTypes)
        {
            maprtID_rtName.put(rTypeObj.id , rTypeObj.Name); //for all recordtypes... log id's and record type names.
        }
//MAP Record type names to record type ID's
        List<RecordType> rTypesCases = [select name,id from RecordType where SobjectType='Case'];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
        
        MAP<String, ID> maprtName_rtIDCases = new MAP<String, ID>();  //map record type ID's to record type names.
        for(RecordType rTypeObj :  rTypesCases)
        {
            maprtName_rtIDCases.put(rTypeObj.Name, rTypeObj.id); //for all recordtypes... log id's and record type names.
        }
        
//MAP Case User Owner/Queue Names to reference ID's
        List<User> uTypesUsers = [select name,id from User];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
        
        MAP<String, ID> maprtName_rtIDUsers = new MAP<String, ID>();  //map record type ID's to record type names.
        for(User uTypeObj :  uTypesUsers)
        {
            maprtName_rtIDUsers.put(uTypeObj.Name, uTypeObj.id); //for all recordtypes... log id's and record type names.
        }
        
//MAP Case Group Owner/Queue Names to reference ID's
        List<Group> gTypesGroups = [select name,id from Group where Type='Queue'];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
        
        MAP<String, ID> maprtName_rtIDGroups = new MAP<String, ID>();  //map record type ID's to record type names.
        for(Group gTypeObj :  gTypesGroups)
        {
            maprtName_rtIDGroups.put(gTypeObj.Name, gTypeObj.id); //for all recordtypes... log id's and record type names.
        }
    
////map for temporary return from escalation
    
    

//bulk cases for upsert
      List<Case> Cases = new List<Case>();
      List<CaseComment> ccomments = new List<CaseComment>();
      List<CaseComment> dcomments = new List<CaseComment>();
      List<CaseComment> pcomments = new List<CaseComment>();
      boolean escalated = false;
      boolean bccomments = false;
      boolean bdcomments = false;
      boolean bpcomments = false;
      MAP<ID, ID> mapescalate_add = new MAP<ID, ID>();

//lets have a look at all the trigger(s)
for (Case escalatedcase:Trigger.new){

escalated = false;    
    
//trying to close the parent case while children are still open   
      if (escalatedcase.Status=='Closed') { //trying to close the parent case while children are still open
            integer close = [Select count() from Case where ParentId = :escalatedcase.id and isClosed != true];
            if (close > 0) {
                  escalatedcase.addError('There are still Child Cases Open - Please close and try again!'); //in your face!
            }
      }
//END trying to close the parent case while children are still open


      if(maprtID_rtName.get(escalatedcase.RecordTypeId) == 'National Client Service') {
            
                  if(escalatedcase.ParentId == null) {
                      
                        if(escalatedcase.Status != 'Escalated' && escalatedcase.Status != 'Returned from Escalation' && escalatedcase.Status != 'Closed') {
                              //if any escalatedcase childcase has a status 'Escalation Hold' then pass the comments back to that case and put this case on status escalated and put that status as new
                              // then if not, proceed with the escalation group stuff
                            
                            //List<Case> cCaseTypes = [SELECT Status, Id FROM Case where ParentId =:escalatedcase.id LIMIT 10];
                            List<Case> cCaseTypes = [SELECT Status, Id FROM Case where Status='Escalation Hold' AND ParentId =:escalatedcase.id LIMIT 10];
                            for(Case eCase : cCaseTypes) {
                                If (eCase.Status == 'Escalation Hold') {
                                                
                                      Case CaseAdd = new Case(Id = eCase.id);
                                      CaseAdd.Status = 'New';
                                      CaseAdd.Escalation_Completion_Date__c = System.now();
                                      Cases.add(CaseAdd);
                                    
                                    
                                            List<CaseComment> comments = [Select c.Id, c.ParentId, c.IsPublished, c.CommentBody, c.CreatedById, c.CreatedDate, c.SystemModstamp, c.LastModifiedDate, c.LastModifiedById, c.IsDeleted from CaseComment c where c.ParentId = :escalatedcase.Id];
            
                                            for(CaseComment oldcomment :  comments) {
                                                CaseComment newcomment = new CaseComment();
                                                dcomments.add(oldcomment);
                                                bdcomments = true;
                                                newcomment.ParentId = escalatedcase.ParentId;
                                                newcomment.IsPublished = oldcomment.IsPublished;
                                                newcomment.CommentBody = oldcomment.CommentBody + escalatedcase.OwnerId + escalatedcase.Owner.Name;
                                                //Do I want to remove duplicates?
                                                //if (newcomment.CommentBody.substring(0,6) == 'Parent') { } else {
                                                    pcomments.add(newcomment);  
                                                    bpcomments = true;
                                                //}
                                            }
             
                                        
                                        
                                        escalated = true;
                                }
                            }
                            
                            

 


Hi, 

 

I am trying to create a SOQL with two AND conditons. It would look something similar to this: SELECT ID FROM Contact Where firstName ! = 'Test' AND lastName = 'User' AND Date_of_Birth__c != TODAY]. I know this syntax is not correct, but I am not sure what the correct syntax would be in this case. Please help. Thank you. 

 

How can we  get the current application name in vf page using controller

 

Hi all,

 

I have a problem when trying to develop a solution that deals with 'large' amounts of data. The situation is the following. 

We have to develop for our customer a solution that handles records inserted in their Salesforce under a custom object (Unprocessed Agreements). Each record from this custom object hosts information that, once processed, will end in Accounts, Contacts and a custom object called 'Agreements'. Basically, each record of the custom object has all the information of an agreement with its account and its contact related. So processing each record of 'Unprocessed Agreements' means to create an Account (if not already in SF); a Contact (if not already in SF) and an Agreement (if is already in Salesforce, updates this agreement). All the logic built to meet this requirements has to rely on a scheduled class that will run and perform this every day.

The number of agreements, Accounts and Contacts might be around 3000 for each entity, in order to not hit the SOQL limits, we developed the functionality so that first 'dumps' all the accounts, contacts and agreements existing in Salesforce into Lists, and we do searches over that lists to check if the Accounts, Contacts or Agreements were created before, then we build the logic on top of this checks. 

Our problem seems that when we want to perform searches over those Lists of records, we hit a limit: ''Too many statements: 200001" when looping over those lists. We make sure to not hit the SOQL query limit, but we faced this limit mentioned above. The logic built works as desired when we keep low the amount of Accounts, Contacts and Agreements. 

Do you have any ideas on how to handle this?

Best regards, 

 

MGA.