• AndreaRoz
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 10
    Replies

Hi to all,

I've got a apx class which is a webservices class, before publishing the webservices

from sandbox to production i need to create a test class for that?

If yes how can I invoke in my test class the internal webservices?

 

Best

 

Hi,
I've got a very simple page with a  select list  composed by records from Group object, here my page:
Code:
<apex:page standardController="Case" tabStyle="Case"  extensions="queueController">
<apex:sectionHeader title="Department"></apex:sectionHeader>
<apex:messages />
<apex:form >

<apex:pageBlock title="Select a department" mode="edit">
<table class="detailList" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td class="labelCol">Department List</td>
        <td><apex:selectList id="code" value="{!queues}" multiselect="false" size="1">
                        <apex:selectOptions value="{!items}"/>
                </apex:selectList></td>
   </tr>
   <tr>
    <td align="left"><apex:commandButton value="SaveAssociation" action="{!saveDep}" id="saveBtn" disabled="{!enableBtn}" /></td>
   </tr>
   </table>
</apex:pageBlock>

</apex:form>
</apex:page>

I used the following method to populate the selectList:
Code:
    public List<SelectOption> getItems()
    {     
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('0','--None--'));
        qList=[select Id, Name from group where type='Queue' AND Name like '%Dep']; 
        
        for(Group gg: qList)
        {
            options.add(new SelectOption(gg.Id,gg.Name));   
        }
      
                return options;
    }

I've got also setter and getter for "queues" and everything goes well.
When I use the get method for queues I can have only the value of the selected option but not the displayed string, for example in the above example the result for System.debug(this.queues) call is the salesforce Id of the selected Group record.
How can I get also the displayed value?

Best regards
--
Ar


Hi to all,
I am confused as regards the governor limit.
I wrote the following trigger:
Code:
trigger GetDep on Case (before insert, before update) {
 List<Group> listCode;
   listCode =[select Id, Name from group where type='Queue' AND Name like '%Dep%']; 
 boolean found;
 for(Case c : Trigger.new)
 {
  found = false;
  for(Group g:listCode)
     {
       if(g.Id==c.OwnerId)
       {
        found = true;
        break;
       }
      }
  if(found==false)
  {
   List<User> lu = [select myDep__c from User where Id =: c.OwnerId];
   User u;
   if(lu.size()>0){
    u = lu.get(0);
    if((u.myDep__c != null) || (u.myDep__c !=''))
    {
     c.myDep__c = u.myDep__c;
    }
   }
  }  
 
 }
}

 
In the log file I find this line:
"Resource usage for namespace: (default)
Number of SOQL queries: 100 out of 100 ******* CLOSE TO LIMIT"
and the test failed, with the following version of the trigger everyting goes well:
Code:
trigger GetDep on Case (before insert, before update) {
Set<Id> UserIds = new Set<Id>();
 for (Case MyCase : Trigger.new)
  {
   UserIds.add(MyCase.OwnerId);
  }
 Map<Id, User> Users = new Map<Id, User>([select Id, myDep__c from User where Id in :UserIds]);
 
 for (Case MyCase : Trigger.new)
 {
  If (Users.get(MyCase.OwnerId)!=null)
   MyCase.myDep__c = Users.get(MyCase.OwnerId).myDep__c;   
 }
}

 
It seems that there is a loop with the first version of the trigger, someone could explain me where is the error?
Best regards
--
Andrea
Hi to all,
I have got a page with a custom controller, inside the controller I use the "addMessage" to display custom message to the user:
Code:
ApexPages.Message msg;
msg = new ApexPages.Message(ApexPages.Severity.ERROR,'messaggeText');
ApexPages.addMessage(msg);

 
I created my tester class and but when I run test there is following error:
 ApexPages.addMessage can only be called from a VisualForce page, following the piece of code of my testerClass:
Code:
PageReference pageRef = Page.FilialeAssegnazione;
Test.setCurrentPageReference(pageRef);
pageRef.getParameters().put('id',MyCase.Id);
queueController controller;
ApexPages.StandardController stdController;
controller = new queueController(new ApexPages.StandardController(MyCase));

 
How can I test ApexPages.addMessage(msg) instruction in the testerClass?
Best Regards
--
Andrea Rosa
Hi to all,

I'd like to know if it's possible to use the variable {!User_Session_ID} to logon into SalesforcePortal, something like that:
https://<instance>.salesforce.com/sserv/login.jsp?orgId=<org_id>&sid=<{!User_Session_ID}>

Best Regards
--
Andrea Rosa
Hi to all,
 
I need to get the serverURL in a trigger, is there a method to use?
Best Regards
--
Andrea Rosa
Hi,
is it possible to customize PriceBookEntry object? if yes how?!?
I wish to create a custom field as External Id so as to use this field for automatic import process via Apex Data Loader for OpportunityLineItem.
Without a custom filed I'm not able to create a batch process for import data because in the opportunityLineitem I need:
1) OpportunityId -> I can use an external id field for automatic lookup
2) PricebookEntryId -> If I have got only standard field I can't automate the "upsert" , process ... is it right?
Thank you
--
Andrea
Hi to all,
 
I created a list Button for cases and I'd like to add it in a custom report for Cases so as to be able to perform the S-control associated with the button, something like the "Add to Campaign" button in the "Campaign Contacts" report, is it possible?
thanks
--
Andrea
Hi to all,
I inserted a lot of new case through the Excel connector using the administrator account, I have also an assignement rule for cases and the user can decide to send notifications after creating a new case.
 
When a record is inserted or updated via the excel connector the administrator receives an email notification but if I use the API or tools as Apex Data Loader after inserting or updating the administrator doesn't get the notifications.
My question is if it's possible to disable auto-notifications for records inserted using the excel connector.
 
Thanks,
--
Andrea
Hi to all,
has anyone ever experienced with relationship queries in the Winter 07 release using Ajax Toolkit?
I studied the on-line documentatione in which I found usefull examples for relationship queries but now I need to do  complex (at least to me) queries with three objects:
Campaing
CampaignMember
Task
the relationships for the objects are:
Campaign <-> CampaignMember (with CampaignId field)
Campaign <-> Task (with the Polymorphic Key WhatId)
I need for a specifc contact member of a campaign retrieving custom fileds for tasks related to the Contact for the campaing in which the contact is involved.
The only solutions I found is looping for all campaings and then checking (for each campaign) if the contact is a member of.
Thanks,
--
Andrea
Hi to all,
I am testing the new  SOQL relationship queries feature but I can't understand how It's possible to create queries with 3 or more objects joined together.
For example the following query give me Campaing name, EndDate and some activity field for tasks regarding a specific contact:

result = sforce.connection.query("Select Name, EndDate, " +

"(SELECT ActivityDate, MyField__c  From Tasks where WhoId ='{!Contact.Id}') " +

" from Campaign ");

 

I would like to improve the previous query adding the object CampaignMember so as to filer only for Campaing in which the Contact is a member...something like this:

result = sforce.connection.query("Select Id, Campaign.Name, " +

"(SELECT ActivityDate, MyField__c From Tasks where WhoId ='{!Contact.Id}'  ) " +

" from CampaignMember, CampaignMember.Campaign Where Id = ‘a value’ and CampaignMember.Contact.Id = ‘{!Contact.Id}’ ");

...but I don't know how define the relationship between Tasks and Campaing using the CampaingMember.Campaing relationship.

 

Thanks

Andrea

 

Please help!

I’ve created an APEX class

 

 

global class LeadImporterExternal {

       WebService static String importLead(String xmlParameter) {

              leadImporter importer = new leadImporter();

              return importer.importLead(xmlParameter);

       }

}

 

Downloaded WSDL file for this class. Using this file I have generated a C# code for accessing a web service.

In my code, I’m calling this service in the following way:

 

 

 

SforceService SFSevice = new SforceService();

LoginResult loginResult = SFSevice.login(userName, password);

 

LeadImporterExternalService myService = new LeadImporterExternalService();

myService.Url = loginResult.serverUrl;

myService.SessionHeaderValue = new SessionHeader();

myService.SessionHeaderValue.sessionId = loginResult.sessionId;

 

string result = myService.importLead(xmlText);

 

 

 

But I keep getting an error SoapHeaderException: No operation available for request

{http://soap.sforce.com/schemas/class/LeadImporterExternal}importLead.

 

Can someone tell me why this is not working and what I’m doing wrong?

I’ll appreciate any help

Thanks!

Hi,
I've got a very simple page with a  select list  composed by records from Group object, here my page:
Code:
<apex:page standardController="Case" tabStyle="Case"  extensions="queueController">
<apex:sectionHeader title="Department"></apex:sectionHeader>
<apex:messages />
<apex:form >

<apex:pageBlock title="Select a department" mode="edit">
<table class="detailList" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td class="labelCol">Department List</td>
        <td><apex:selectList id="code" value="{!queues}" multiselect="false" size="1">
                        <apex:selectOptions value="{!items}"/>
                </apex:selectList></td>
   </tr>
   <tr>
    <td align="left"><apex:commandButton value="SaveAssociation" action="{!saveDep}" id="saveBtn" disabled="{!enableBtn}" /></td>
   </tr>
   </table>
</apex:pageBlock>

</apex:form>
</apex:page>

I used the following method to populate the selectList:
Code:
    public List<SelectOption> getItems()
    {     
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('0','--None--'));
        qList=[select Id, Name from group where type='Queue' AND Name like '%Dep']; 
        
        for(Group gg: qList)
        {
            options.add(new SelectOption(gg.Id,gg.Name));   
        }
      
                return options;
    }

I've got also setter and getter for "queues" and everything goes well.
When I use the get method for queues I can have only the value of the selected option but not the displayed string, for example in the above example the result for System.debug(this.queues) call is the salesforce Id of the selected Group record.
How can I get also the displayed value?

Best regards
--
Ar


Hi to all,
I have got a page with a custom controller, inside the controller I use the "addMessage" to display custom message to the user:
Code:
ApexPages.Message msg;
msg = new ApexPages.Message(ApexPages.Severity.ERROR,'messaggeText');
ApexPages.addMessage(msg);

 
I created my tester class and but when I run test there is following error:
 ApexPages.addMessage can only be called from a VisualForce page, following the piece of code of my testerClass:
Code:
PageReference pageRef = Page.FilialeAssegnazione;
Test.setCurrentPageReference(pageRef);
pageRef.getParameters().put('id',MyCase.Id);
queueController controller;
ApexPages.StandardController stdController;
controller = new queueController(new ApexPages.StandardController(MyCase));

 
How can I test ApexPages.addMessage(msg) instruction in the testerClass?
Best Regards
--
Andrea Rosa
Hi to all,

I'd like to know if it's possible to use the variable {!User_Session_ID} to logon into SalesforcePortal, something like that:
https://<instance>.salesforce.com/sserv/login.jsp?orgId=<org_id>&sid=<{!User_Session_ID}>

Best Regards
--
Andrea Rosa

Does anyone know why the following query line:

List<Contact> contacts = new List<Contact> ([Select Id, Email from Contact where IsPersonAccount = false]);

Yields this error message:

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger LeadAssignmentFromImagitas caused an unexpected exception, contact your administrator: LeadAssignmentFromImagitas: 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.LeadAssignmentFromImagitas: line 18, column 9

?

The query returns only 58 rows.

Any help is greatly appreciated.  Thank you.
  • February 19, 2008
  • Like
  • 0
I inherited a contact table with duplicates and need to remove the dupes. The table has about 200k entries and I need to compare at least 5 fields. Is there a common practice or something in AppExchange that would do this? if not, I'm thinking of exporting the table using Data Loader, de-duping with a perl script, then importing the entire table using Data Loader.
 
Any advice on this process? I am a salesforce newbie but with a data/IT background.
 
Many thanks for advice/info.
Hi to all,
 
I created a list Button for cases and I'd like to add it in a custom report for Cases so as to be able to perform the S-control associated with the button, something like the "Add to Campaign" button in the "Campaign Contacts" report, is it possible?
thanks
--
Andrea