• tzuvy
  • NEWBIE
  • 25 Points
  • Member since 2010

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

Hi,

 

I'm writing an APEX class that should look for some strings on an xml and populate a SF custom object with its respective fields and values.

 

The function currently works fine as follows:

 

 public Chat_Details__c UpsertChatDetails ( String sessionId, MAP<String,String> XMLNode){

 

Chat_Details__c chatInfo = new Chat_Details__c();

 

pChatInfo.VI_Country__c = getValueFromXML(sessionId , XMLNode , 'geoCountry');
pChatInfo.VI_IP_Address__c = getValueFromXML(sessionId , XMLNode , 'geoIP');
pChatInfo.VI_City__c = getValueFromXML(sessionId , XMLNode , 'geoCity');
pChatInfo.VI_State_Province__c = getValueFromXML(sessionId , XMLNode , 'geoReg');
pChatInfo.VI_ISP__c = getValueFromXML(sessionId , XMLNode , 'geoISP');

 

return chatinfo;

 

}

 

I would like to create the same value assignment by using custom settings in order to give standard users the ability to add new fields to the custom object and be able to look in the XML for the right value.

 

For this I created a custom settings object called ChatDetailFieldMapping which has two fields (SF API Field Name and XML attribute to be looked for) see attached screenshot.

 

Custom Settings

 

My question is, how would I go about the same function I created to be able to look into the Custom Setting object and populate the fields based on the custom mapping?

 

Thanks

 

Tzuvy

 

 


  • April 15, 2012
  • Like
  • 0

Hi,

 

I'm working on a trigger that should send an email to a contact when an event is created on the salesforce calendar.

We are using a VF email template which is related to events. The problem is that we would like to send information related to the event in the email to the contact.

 

If we try "email.setwhatId(event.Id);"

 

We get the following error:

"First exception on row 0; first error: INVALID_ID_FIELD, Only accounts, assets, campaigns, cases, contracts, opportunities, orders, products, solutions and custom objects are allowed as whatId.: "

 

What is the right way to do this? The whole purpose of this trigger is to notify the contact with the details of the agreed meeting after setting it up.

 

Best

 

Tzuvy

  • February 02, 2012
  • Like
  • 0

Hi,

 

 

I'm trying to write a triger that for certain cases would send a notification to a specirfic contact. The case has a "component" field, which is a picklist. On the other side, we have a number of contacts and every contacts is assigned to one or more components on a multipicklist.

 

What we want to do is to send an email when a case is closed based on the component of the case, to the contact that has that component selected in the contact's multipicklist.

 

We try to query this way:

 

List<Contact> recipients = [SELECT c.id, c.firstname FROM Contact c WHERE c.RecordTypeId = :contactTypeId.id AND c.eXpertsRelatedComponent__c.Includes (Case Component)];

 

What should be the syntax to such scenario?

 

Any help will be greately appreciated!

 

Thanks

 

Tzuvy

  • December 05, 2011
  • Like
  • 0

Hi, I'm trying to create an escalation button in which a Level 2 analyst will use it to escalate his case to a level 3 analyst.

 

After doing so some fields should be updated, name, role and the date the escalation was done.

 

{!requireScript('/soap/ajax/20.0/connection.js')} 
try{ var update_Case = new sforce.SObject('Case'); update_Case.Id = '{!Case.Id}'; update_Case.Disable_Change_Owner_Validation__c = new Date(); update_Case.Escalated_By_Name__c = '{!$User.FirstName} {!$User.LastName}'; update_Case.Esclated_By_Role__c ='{!$UserRole.Name}';update_Case.Escalated_on__c ={!DATEVALUE(NOW())};update_Case.OwnerId = "00G00000006pPTc" ;var updateRecords = []; updateRecords.push(update_Case); var resultUpdate = sforce.connection.update(updateRecords); if (resultUpdate[0].getBoolean("success")) { parent.location.href = "/" + '{!Case.Id}'; }else{ alert(resultUpdate[0].errors.message); } }catch(err){ alert(err.description); }

 

As you can see, I created a javascript button but I'm having problems with the date field. The field is called Case.Escalated_on__c  and is a date one. How whould I insert the date of the moment the button was clicked? I tried Now, Today. Nothing worked. I get a weird number 0.11545444666

 

Can someone help?

 

Thanks

 

Tzuvy

 

 

  • September 27, 2011
  • Like
  • 0

Hi,

 

We are using SalesForce to provide service and we ate having trouble to report on the time cases have been handled by the different owner. Although all changes in status are recorded in the case's history, this seems not to be enough to report on them.

 

What we are trying to accomplish is a way to create reports that would provide how long a case has been in each owner, queue or status.

 

Is there a way to do this?

 

Thanks

 

Tzuvy

  • May 22, 2011
  • Like
  • 0

Hi,

 

I have trouble creating test methods for the following class.

 

global class scheduable_Tier1ChatExport implements Schedulable  {

    
    global void execute(SchedulableContext SC){
   
            getChats();
      }

     @future(callout=true)
     public static void getChats(){
         
         Chat_Transcript_Export__c chat = new Chat_Transcript_Export__c (name = 'Tier1 '+ datetime.now(), Status__c='Not Processed');
         
        String fileBeingProccesed = '';
         datetime startDate = Datetime.now();     //today
        startDate=startDate.addDays(-1);         //yesterday
         
         try{
                 
           upsert chat;
           
           Integer j=0;
           
           for(Integer i = 0; i<8; i++){
                
                fileBeingProccesed =  'Tier1 Chats N:'+i+' '+startDate.date();                                                
                   
                   
                String url='https://myurl.com&startDate='+startdate.year()+'-'+startdate.month()+'-'+startdate.day()+'T'+j+':00:00&endDate='+startdate.year()+'-'+startdate.month()+'-'+startdate.day()+'T'+(j+2)+':59:59&limit=5000&toZip=false';
                HttpRequest req = new HttpRequest();                
                req.setEndpoint(url);
                req.setMethod('GET');
                req.setTimeout(60000);
                Http http = new Http();
                HTTPResponse res = http.send(req);                     
                System.debug(res.getBody());
                j=j+3;
                
                Attachment att = new Attachment (name = 'Tier1 Chats N:'+i+' '+startDate.date(), ParentId = chat.Id, Body =  Blob.valueof(res.getBody()));             
                insert att;
            
           }
           
         }
         
         catch(Exception e){
         
             chat.Export_Log__c = 'Errors were found: '+e.getMessage()+' On File: ' + fileBeingProccesed;
             upsert chat;
             
              }
    
     }
    
    
}

 

This class simply schedules an export for data coming from an external service and creates xml attachments on an obeject called Chat_transcript_export.

I call for 8 different exports because the amount of data can be too big and exceed the maximum timeout allowed by salesforce.

 

How can I create the test methods for this class?

 

Thanks

 

Tzuvy

  • April 17, 2011
  • Like
  • 0

Hi,

 

I'm trying to write a controller extemsion. I want to show a list of records related to a case's specific field.

 

For this I wrote the following:

 

public with sharing class CaseObjectController {



   
    private final Case caseObj;
    transient List<Account_Hot_News__c> caseNews;
     date todaysDate = date.today();
    
    public CaseObjectController(ApexPages.StandardController stdController) {
        this.caseObj = (Case)stdController.getRecord();
    }

    public List<Account_Hot_News__c> getNewsForCases() {
       
        
        if (caseNews == null) {
            
            
                return [
                select   Id, Account_s_Main_SiteID__c, Alert_Message__c,  name, Expires_On__c, Affecting_All_Servers__c, Account_s_Server_Name__c
                from Account_Hot_News__c
                where  (Account_Hot_News__c.Account_s_Main_SiteID__c = :caseObj.Case_Site_ID__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL ) ) OR (Affecting_All_Servers__c = true AND Account_s_Server_Name__c = :caseObj.Account_Server_Name__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL))  ];
                
             
        }
        else {
            return caseNews;
        }
    }

}

 

But me problem is that I don't know how to create the test method for this class.

 

Can anyone help understand how to do it?

 

Thanks

 

Tzuvy

  • March 23, 2011
  • Like
  • 0

Hi,

 

I'm creating a VF page that should be displayed in the case object.

 

I would like to retrieve information about the account  in which that case resides and pass it on to the apex controller in that page.

 

For instance let's say my controller looks like this

 

public class MyController {

      private final Account account;

      public MyController() {
            account = [select id, name, site from Account where id =
                       :ApexPages.currentPage().getParameters().get('id')];
      }

      public Account getAccount() {
            return account;
      }

      public PageReference save() {
            update account;
            return null;
      }
}

Becaus of the page being diplayed in the case, I can't querry for the Account ID this way

:ApexPages.currentPage().getParameters().get('id')

Since the id is not present in the case's url.

 

How can I pass the account ID from the case to the apex controller?

 

Any help will be much appreciated.

 

Thanks

 

Tzuvy

 

  • March 09, 2011
  • Like
  • 0

Hi,

 

My organization has reached the maximum allowed number of applications installed and we need to install new apps, when I went to the installed list I see that there is no reference to whom install them and where are they being used. I'm the administrator of the account and I believe most of the installed apps are from way before I took this role.

 

Is there a way to determine who installed them or at least where are they being used?

 

Thanks

 

Tzuvy

  • January 16, 2011
  • Like
  • 0

Hi,

 

I would like to create a formula field that should compare the value of two strings. I need to know which string is bigger in char size. For example fielda= 9.0.0.3 and fieldb=9.3.0.0

 

Fieldb is bigger than fielda how could I write the IF statement in order to compare who is bigger?

 

Thanks

 

tzuvy

  • December 09, 2010
  • Like
  • 0

Hi,

 

I'm creating a VF page in which I want to display the list of Account History changes for a specific account.

I'm querring for the account this way in a controller:

 

account = [select field1, field2, field3  from Account where field4= :params.get(0)];

 

And presenting them in a page block section this way:

 

<apex:pageblockSection id="Account" columns="1"
                title="account" collapsible="true">
                <apex:pageblocktable align="center" value="{!account}" var="account"
                    title="account" width="100%">
                    <apex:column headerValue="Field1" width="10%">
                        <apex:outputField value {!account.Field1}></apex:outputlink>
                    </apex:column>
                       <apex:column headerValue="Field2" width="10%">
                        <apex:outputField value {!account.Field2}></apex:outputlink>
                    </apex:column>

   <apex:column headerValue="Field3" width="10%">
                        <apex:outputField value {!account.Field3}></apex:outputlink>
                    </apex:column>


                    </apex:pageblockTable>
            </apex:pageblockSection>

 

How can I querry and present the same way the account history for this account?

 

Thanks

 

Tzuvy

  • December 03, 2010
  • Like
  • 0

Hi,

 

I'm creating a date / time formula field in which I would like to keep te time of another date time field and subtract five hours from it.

 

For example, in field A I would have "11/23/2010 9:03 PM" and in field B (the formula one I should see "11/23/2010 4:03 PM"

 

 

Is this possible?

 

Thanks

 

Tzuvy

  • November 25, 2010
  • Like
  • 0

Hi,

 

I've created a custom page that queries an account and its opened cases. For that page I've created an apex controller that queries for the account based on one of the account's fields.

 

Until now everything works fine, the query is a very simple one:

 

    List <Account> account =  [select  field1_c field2_c etc from Account where field1_c = :'ggggg'];

    List<Case> cases = [select  field1_c field2_c etc from Case where field1_c = :'ggggg'];

 

Now I would like to also have access to a relationship field and I would like to know how to query it.

The field I'm trying to show in that page is:

 

             Account.Parent.Parent.Account_Manager__r.FirstName

 

How should I write the select in order to query for this type of field?

They appear as default when I create a page with a standard controller referencing the account object.

 

Thanks

 

Tzuvy

 

  • November 15, 2010
  • Like
  • 0

Hi,

 

I've written a couple of classes that should run on my production account in salesforce. I've finished my tests and everything works perfect. Now I'm trying to deploy the classes into my production account and get the following message in eclipse:


Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required    Cost Of Service        line 1    Force.com code coverage warning

 

When I run all tests in my prod account the average coverage on all classes is 82%.

 

The clas I'm trying to deploy has 74% coverage.

 

Here is the code of the first clas I'm trying to deploy:

 

 

I created a test class to bring the coverage from 2% to 74% but I'm obviously doing something wrong.

I would appreciate if someone could give me an example of how to write a test method for one of my methods so I can deploy this code.

 

Thanks

Tzuvy

  • August 11, 2010
  • Like
  • 0

Hi,

 

We are trying to implement and take advantage of the new possibilities offered by this feature and I was wondering if it is possible to define a group in the scheduler to act as a resource in outlook.

 

Here is an example:

 

Let's say we have a customer that wants to set a meeting with one of our teams, let's say the support team. The meeting is offered by another team, let's say the sales team. I would like the meeting to be arranged by the client and the sales team and automatically appear in the support calendar without giving support the ability to accept or not. Mostly the idea would be to define them like we would define a room in outlook.

 

Is this possible?

 

Thanks

 

Tzuvy

  • August 04, 2010
  • Like
  • 0

Hi,

 

I was working on a project in my sandbox environment and decided that I need to check the performance of the project in my dev account. I'm working with eclipse and I have no idea how to migrate the custom objects I've created into my dev account.

 

I have two custom objects with lots of fields and I would like to somehow copy them and not to have to create them again.

 

I tried copying the xml that defines the object, create the same object on the dev and copy the content of the xml into it.

 

After saving the changes to the server I only see the mandatori fields in the object but none of the other fields.

 

Thanks for the help

 

Tzuvy

  • July 27, 2010
  • Like
  • 0

Hello,

 

I'm trying to write a class that would be schedulled in order to download a file from the internet and attach it to a custom object once a day.

 

The file is a Zip file that contains an XML document inside.

 

Idealy in java I simply use the IO.downloadFileFromHttpsURL(url, null, file); method to save the file into a local machine. IS there a method in SalesForce to do this and save the file downloaded to an instance of a custom object?

 

Thanks

 

Tzuvy

  • July 09, 2010
  • Like
  • 0

Hi,

 

I have a field populated with values that look like this:

 

{"Features":["Operations Reports","Save Engage-sessions to DB"]}

 

I need to create another field that contains the same that but cleaned. I need it to be

 

"Operations Reports","Save Engage-sessions to DB"

 

So basically I need to remove the word Features and the "{,},[,]"

 

Is there a way tom do this?

 

Thanks

Tzuvy.

  • July 08, 2010
  • Like
  • 0

Hi,

 

I've created a button that should prepopulate the descrption for cases while opening new ones. The thing is that users can see the content in cas15 while using FF but when they open the same case with the same button using IE or Chrome the description is not there.

 

Here is the button:

 

https://cs1.salesforce.com/500/e?def_contact_id={!Contact.Id}&def_account_id={!Account.Id}&RecordType=0120000000002Wv&&cas15="**Exact%20date%20and%20time%20in%20EST%20the%20issue%20occurred%20:%0D%0A(If%20applicable%20-%20logs)%0D%0A%0D%0A**Description%20-%20Customer%20impact:%0D%0AFrequency;%20how%20many%20operators%20are%20affected?%0D%0AWhen%20the%20client%20initially%20has%20noticed%20the%20issue?%0D%0ADid%20it%20work%20in%20the%20past?%0D%0AWas%20there%20any%20change%20prior%20the%20issue%20appeared%20in%20the%20system?%0D%0A%0D%0A**Steps%20to%20replicate%20:%0D%0A%0D%0A**Analysis%20already%20performed%20:%0D%0AOn%20customer’s%20environment%20/%20internal%20environment%20-test%20account%0D%0APlease%20specify%20the%20environment%20used%20to%20replicate%20the%20issue%20–%20software%20versions%0D%0Alogin credentials%20–%20website/%20affected%20operators.%0D%0A%0D%0A**Any%20known%20workaround%20(If applicable):%0D%0A%0D%0A**Highlights%20/%20Next%20steps%20that%20should%20be%20taken:%0D%0A%0D%0A**KB%20related%20(Document%20ID/Article ID):%0D%0A%0D%0A**Available%20data%20:%0D%0APLogs,%20Events,%20logs,%20screenshots%20etc.%0D%0AAttach%20the%20relevant%20to%20the%20last%20ticket%20comment/case.%0D%0A%0D%0A**Test\clone%20site%20ID%20(If applicable):%0D%0A"

 

As you see I pass content to the cas15 variable while opening new cases from the contact "new case" button.

 

Tested this in Chrome 5.0.375.86 and IE8 doesn't work.

 

FF 3.6.3 works perfectly.

 

Any help will be appreciated.

 

Thanks

 

tzuvy

 

  • July 06, 2010
  • Like
  • 0

I've created a class that receives a url and based on it parses all the variables and creates an instances of a custom object in a specific account.

 

The class works perfectly when called on an apex page. The problem is that I'm sending the url from a server directly to SF and the server doesn't know how to open the page. For this reason the class is never called and the object never inserted.

 

Is there a way to create a page/process in SF that would create a record without loading a page?

 

Here are the class and the page I'm referring to.

 

public class ChatDetail {

   


      private final Account account;
      public Chat_Details__c chat {get; private set;}

      private list<String> operator;
      private list<String> params;
      string DefaultSiteSMB;
      string DefaultSiteENT;

      public ChatDetail() {
      
      DefaultSiteSMB='74714728';
       try {
           
           params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
                        :params.get(0)];
           operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
           
           
           chat=new Chat_Details__c();
           chat.Account_del__c= account.id;
            chat.Chat_End_Time__c=operator.get(3);
            chat.Chat_Operator__c=operator.get(1);
            chat.Chat_Start_Time__c=operator.get(2);
            chat.Customer_Admin_Level__c=operator.get(5);
            chat.Customer_Subscription__c=operator.get(4);
            chat.Name=operator.get(6);
            
           
          
          

           
       } 
       // System.DMLException e
       //catch(System.DMLException e) {
         //  params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           //account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
             //           :DefaultSiteSMB];
           //operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
          
           
       //}
       catch(Exception e) {
           params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
                        :'74714728'];
           operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
           
           chat=new Chat_Details__c();
           chat.Account_del__c= account.id;
           chat.Chat_End_Time__c=operator.get(3);
           chat.Chat_Operator__c=operator.get(1);
           chat.Chat_Start_Time__c=operator.get(2);
           chat.Customer_Admin_Level__c=operator.get(5);
           chat.Customer_Subscription__c=operator.get(4);
           chat.Name=operator.get(6);
       }

                                    
      }
      
    
          
    public String getOperator() {
        return operator.get(1);
    }
    
    public String getStartDate() {
        return operator.get(2);
    }
    
     public String getEndDate() {
        return operator.get(3);
    }
    
     public String getSubscription() {
        return operator.get(4);
    }
    
     public String getAdminLevel() {
        return operator.get(5);
    }
    
     public String getName() {
        return operator.get(6);
    }

     public Account getAccount() {
            return account;
      }

     public PageReference save() {
     try {
     upsert(chat);
     } catch(System.DMLException e) {
     ApexPages.addMessages(e);
     return null;
     }
     //  After Save, navigate to the default view page:  
    
     return (new ApexPages.StandardController(chat)).view();
   }

     
}

 

 

 

And here is the page:

 

 

<apex:page controller="ChatDetail" tabStyle="Account" action="{!save}" >



</apex:page>

 

 

Any help will be appreciated.

 

Thanks

 

Tzuvy

 

 

  • June 27, 2010
  • Like
  • 0

Hi,

 

I'm working on a trigger that should send an email to a contact when an event is created on the salesforce calendar.

We are using a VF email template which is related to events. The problem is that we would like to send information related to the event in the email to the contact.

 

If we try "email.setwhatId(event.Id);"

 

We get the following error:

"First exception on row 0; first error: INVALID_ID_FIELD, Only accounts, assets, campaigns, cases, contracts, opportunities, orders, products, solutions and custom objects are allowed as whatId.: "

 

What is the right way to do this? The whole purpose of this trigger is to notify the contact with the details of the agreed meeting after setting it up.

 

Best

 

Tzuvy

  • February 02, 2012
  • Like
  • 0

Hi,

 

 

I'm trying to write a triger that for certain cases would send a notification to a specirfic contact. The case has a "component" field, which is a picklist. On the other side, we have a number of contacts and every contacts is assigned to one or more components on a multipicklist.

 

What we want to do is to send an email when a case is closed based on the component of the case, to the contact that has that component selected in the contact's multipicklist.

 

We try to query this way:

 

List<Contact> recipients = [SELECT c.id, c.firstname FROM Contact c WHERE c.RecordTypeId = :contactTypeId.id AND c.eXpertsRelatedComponent__c.Includes (Case Component)];

 

What should be the syntax to such scenario?

 

Any help will be greately appreciated!

 

Thanks

 

Tzuvy

  • December 05, 2011
  • Like
  • 0

Hi,

 

I'm trying to write a controller extemsion. I want to show a list of records related to a case's specific field.

 

For this I wrote the following:

 

public with sharing class CaseObjectController {



   
    private final Case caseObj;
    transient List<Account_Hot_News__c> caseNews;
     date todaysDate = date.today();
    
    public CaseObjectController(ApexPages.StandardController stdController) {
        this.caseObj = (Case)stdController.getRecord();
    }

    public List<Account_Hot_News__c> getNewsForCases() {
       
        
        if (caseNews == null) {
            
            
                return [
                select   Id, Account_s_Main_SiteID__c, Alert_Message__c,  name, Expires_On__c, Affecting_All_Servers__c, Account_s_Server_Name__c
                from Account_Hot_News__c
                where  (Account_Hot_News__c.Account_s_Main_SiteID__c = :caseObj.Case_Site_ID__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL ) ) OR (Affecting_All_Servers__c = true AND Account_s_Server_Name__c = :caseObj.Account_Server_Name__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL))  ];
                
             
        }
        else {
            return caseNews;
        }
    }

}

 

But me problem is that I don't know how to create the test method for this class.

 

Can anyone help understand how to do it?

 

Thanks

 

Tzuvy

  • March 23, 2011
  • Like
  • 0

Hi,

 

I'm creating a VF page that should be displayed in the case object.

 

I would like to retrieve information about the account  in which that case resides and pass it on to the apex controller in that page.

 

For instance let's say my controller looks like this

 

public class MyController {

      private final Account account;

      public MyController() {
            account = [select id, name, site from Account where id =
                       :ApexPages.currentPage().getParameters().get('id')];
      }

      public Account getAccount() {
            return account;
      }

      public PageReference save() {
            update account;
            return null;
      }
}

Becaus of the page being diplayed in the case, I can't querry for the Account ID this way

:ApexPages.currentPage().getParameters().get('id')

Since the id is not present in the case's url.

 

How can I pass the account ID from the case to the apex controller?

 

Any help will be much appreciated.

 

Thanks

 

Tzuvy

 

  • March 09, 2011
  • Like
  • 0

Hi,

 

I would like to create a formula field that should compare the value of two strings. I need to know which string is bigger in char size. For example fielda= 9.0.0.3 and fieldb=9.3.0.0

 

Fieldb is bigger than fielda how could I write the IF statement in order to compare who is bigger?

 

Thanks

 

tzuvy

  • December 09, 2010
  • Like
  • 0

Hi,

 

I'm creating a date / time formula field in which I would like to keep te time of another date time field and subtract five hours from it.

 

For example, in field A I would have "11/23/2010 9:03 PM" and in field B (the formula one I should see "11/23/2010 4:03 PM"

 

 

Is this possible?

 

Thanks

 

Tzuvy

  • November 25, 2010
  • Like
  • 0

Hi,

 

I've written a couple of classes that should run on my production account in salesforce. I've finished my tests and everything works perfect. Now I'm trying to deploy the classes into my production account and get the following message in eclipse:


Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required    Cost Of Service        line 1    Force.com code coverage warning

 

When I run all tests in my prod account the average coverage on all classes is 82%.

 

The clas I'm trying to deploy has 74% coverage.

 

Here is the code of the first clas I'm trying to deploy:

 

 

I created a test class to bring the coverage from 2% to 74% but I'm obviously doing something wrong.

I would appreciate if someone could give me an example of how to write a test method for one of my methods so I can deploy this code.

 

Thanks

Tzuvy

  • August 11, 2010
  • Like
  • 0

Hi,

 

I was working on a project in my sandbox environment and decided that I need to check the performance of the project in my dev account. I'm working with eclipse and I have no idea how to migrate the custom objects I've created into my dev account.

 

I have two custom objects with lots of fields and I would like to somehow copy them and not to have to create them again.

 

I tried copying the xml that defines the object, create the same object on the dev and copy the content of the xml into it.

 

After saving the changes to the server I only see the mandatori fields in the object but none of the other fields.

 

Thanks for the help

 

Tzuvy

  • July 27, 2010
  • Like
  • 0

Hello,

 

I'm trying to write a class that would be schedulled in order to download a file from the internet and attach it to a custom object once a day.

 

The file is a Zip file that contains an XML document inside.

 

Idealy in java I simply use the IO.downloadFileFromHttpsURL(url, null, file); method to save the file into a local machine. IS there a method in SalesForce to do this and save the file downloaded to an instance of a custom object?

 

Thanks

 

Tzuvy

  • July 09, 2010
  • Like
  • 0

Hi,

 

I have a field populated with values that look like this:

 

{"Features":["Operations Reports","Save Engage-sessions to DB"]}

 

I need to create another field that contains the same that but cleaned. I need it to be

 

"Operations Reports","Save Engage-sessions to DB"

 

So basically I need to remove the word Features and the "{,},[,]"

 

Is there a way tom do this?

 

Thanks

Tzuvy.

  • July 08, 2010
  • Like
  • 0

Hi,

 

I've created a button that should prepopulate the descrption for cases while opening new ones. The thing is that users can see the content in cas15 while using FF but when they open the same case with the same button using IE or Chrome the description is not there.

 

Here is the button:

 

https://cs1.salesforce.com/500/e?def_contact_id={!Contact.Id}&def_account_id={!Account.Id}&RecordType=0120000000002Wv&&cas15="**Exact%20date%20and%20time%20in%20EST%20the%20issue%20occurred%20:%0D%0A(If%20applicable%20-%20logs)%0D%0A%0D%0A**Description%20-%20Customer%20impact:%0D%0AFrequency;%20how%20many%20operators%20are%20affected?%0D%0AWhen%20the%20client%20initially%20has%20noticed%20the%20issue?%0D%0ADid%20it%20work%20in%20the%20past?%0D%0AWas%20there%20any%20change%20prior%20the%20issue%20appeared%20in%20the%20system?%0D%0A%0D%0A**Steps%20to%20replicate%20:%0D%0A%0D%0A**Analysis%20already%20performed%20:%0D%0AOn%20customer’s%20environment%20/%20internal%20environment%20-test%20account%0D%0APlease%20specify%20the%20environment%20used%20to%20replicate%20the%20issue%20–%20software%20versions%0D%0Alogin credentials%20–%20website/%20affected%20operators.%0D%0A%0D%0A**Any%20known%20workaround%20(If applicable):%0D%0A%0D%0A**Highlights%20/%20Next%20steps%20that%20should%20be%20taken:%0D%0A%0D%0A**KB%20related%20(Document%20ID/Article ID):%0D%0A%0D%0A**Available%20data%20:%0D%0APLogs,%20Events,%20logs,%20screenshots%20etc.%0D%0AAttach%20the%20relevant%20to%20the%20last%20ticket%20comment/case.%0D%0A%0D%0A**Test\clone%20site%20ID%20(If applicable):%0D%0A"

 

As you see I pass content to the cas15 variable while opening new cases from the contact "new case" button.

 

Tested this in Chrome 5.0.375.86 and IE8 doesn't work.

 

FF 3.6.3 works perfectly.

 

Any help will be appreciated.

 

Thanks

 

tzuvy

 

  • July 06, 2010
  • Like
  • 0

I've created a class that receives a url and based on it parses all the variables and creates an instances of a custom object in a specific account.

 

The class works perfectly when called on an apex page. The problem is that I'm sending the url from a server directly to SF and the server doesn't know how to open the page. For this reason the class is never called and the object never inserted.

 

Is there a way to create a page/process in SF that would create a record without loading a page?

 

Here are the class and the page I'm referring to.

 

public class ChatDetail {

   


      private final Account account;
      public Chat_Details__c chat {get; private set;}

      private list<String> operator;
      private list<String> params;
      string DefaultSiteSMB;
      string DefaultSiteENT;

      public ChatDetail() {
      
      DefaultSiteSMB='74714728';
       try {
           
           params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
                        :params.get(0)];
           operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
           
           
           chat=new Chat_Details__c();
           chat.Account_del__c= account.id;
            chat.Chat_End_Time__c=operator.get(3);
            chat.Chat_Operator__c=operator.get(1);
            chat.Chat_Start_Time__c=operator.get(2);
            chat.Customer_Admin_Level__c=operator.get(5);
            chat.Customer_Subscription__c=operator.get(4);
            chat.Name=operator.get(6);
            
           
          
          

           
       } 
       // System.DMLException e
       //catch(System.DMLException e) {
         //  params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           //account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
             //           :DefaultSiteSMB];
           //operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
          
           
       //}
       catch(Exception e) {
           params=ApexPages.currentPage().getParameters().get('siteid').split('\\?');
           account = [select   LPSiteID1__c, id, name, site from Account where LPSiteID1__c =
                        :'74714728'];
           operator = ApexPages.currentPage().getParameters().get('siteid').split('\\?var\\=');
           
           chat=new Chat_Details__c();
           chat.Account_del__c= account.id;
           chat.Chat_End_Time__c=operator.get(3);
           chat.Chat_Operator__c=operator.get(1);
           chat.Chat_Start_Time__c=operator.get(2);
           chat.Customer_Admin_Level__c=operator.get(5);
           chat.Customer_Subscription__c=operator.get(4);
           chat.Name=operator.get(6);
       }

                                    
      }
      
    
          
    public String getOperator() {
        return operator.get(1);
    }
    
    public String getStartDate() {
        return operator.get(2);
    }
    
     public String getEndDate() {
        return operator.get(3);
    }
    
     public String getSubscription() {
        return operator.get(4);
    }
    
     public String getAdminLevel() {
        return operator.get(5);
    }
    
     public String getName() {
        return operator.get(6);
    }

     public Account getAccount() {
            return account;
      }

     public PageReference save() {
     try {
     upsert(chat);
     } catch(System.DMLException e) {
     ApexPages.addMessages(e);
     return null;
     }
     //  After Save, navigate to the default view page:  
    
     return (new ApexPages.StandardController(chat)).view();
   }

     
}

 

 

 

And here is the page:

 

 

<apex:page controller="ChatDetail" tabStyle="Account" action="{!save}" >



</apex:page>

 

 

Any help will be appreciated.

 

Thanks

 

Tzuvy

 

 

  • June 27, 2010
  • Like
  • 0

Hi all,

 

I've created a page with a controller that queries a variable from an url and gives back the account name containing that value as a field. For example

 

salesforce.com/apex/mypage?contactname=raul will bring me the account that has a contact named raul.

 

Everything works fine, now I need to be able to run that page automatically for a process and I need to open this apex page and pass the variable with a single call.

 

I've tried doing the following

 

salesforce.com/apex/mypage?contactname=raul&pw=MyPassWord&un=MyUserName but this doesn't work and I'm prompted for login.

 

Is there a way to login and pass the variables to a page all sending one url?

 

Thanks

 

Tzuvy

  • June 23, 2010
  • Like
  • 0

I'm writing an application that should send data to my SF account and I need to white list all Salesforce IP ranges in order to allow the data to be sent. What are the ranges for the cs1.salesforce.com and ssl.salesforce.com instances?

 

Thanks

 

Tzuvy

  • June 16, 2010
  • Like
  • 0

Hi,

 

I'm trying to create a button that when clicked does the following:

 

1)Opens the description of an existing case for editing.

2)Appends a predefined text to the description (Without saving it)

3)And when the user clicks the save button changes the ownership parameter of the case using the following variable "newOwn="

 

 

Is this possible?

 

Thanks

Tzuvy.

  • June 13, 2010
  • Like
  • 0

Hi there,

 

I'm trying to import data records into my SandBox  and while using Apex Data Loader to upload the records I previously created from the production account I receive the following error message: "error logging in to Salesforce. Please check your username and password".

 

I'm using the credentials for the Sandbox account with the security tocken provided for my production account. Should I create a security tocken for the Sandbox as well?

 

Any help will be appreciated.

 

Thanks.

 

Tzuvy

 

 

  • May 02, 2010
  • Like
  • 0