• hch
  • NEWBIE
  • 219 Points
  • Member since 2011

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 31
    Replies

 

Hi,

 

What should be the query to cancatinate two fields in SOQL

 

The equivalent mysql query is

select id from User where concat(firstname," ",lastname)="Hari G S";

 

Thanks and Regards

Hari G S

I have an app that does stuff with OpptyTeamMembers, but that app can't be installed in orgs that dont' have it turned on, and I don't want to have to create 2 versions of the app.

 

My solution to this is to make all the opptyTemMember references dynamic using sObjects, but I'm stuck on how to create new records as I get an error trying to do this:

sObject ot=new sObject();

 Error: Type cannot be constructed:sObject

 

I can't simply copy & update an existing opptyTeamMember as the ID fields aren't updatable.  

 

I realize the Apex guide says this isn't possible:

The new operator still requires a concrete sObject type, so all instances are specific sObjects.

 

...but an old thread on the partner API hints that it should be possible:

http://boards.developerforce.com/t5/NET-Development/getting-error-when-using-create-with-the-Partner-wsdl/m-p/27483/highlight/true

I have a search page for my custom object and in the result display the Member field (linked to Contact) is automatically clickable. I don't want this to be the case. Can I disable this?

 

The code for the section is:

 

<apex:column >               

<apex:facet name="header">                   

<apex:commandLink value="Member" action="{!toggleSort}" rerender="results,debug">                       

<apex:param name="sortField" value="member" assignTo="{!sortField}"/>                   

</apex:commandLink>               

</apex:facet>               

<apex:outputField value="{!counselling_practice.Member__c}"/>           

</apex:column>

 

Thanks in advance

 

Justyn

  • November 02, 2011
  • Like
  • 0

Hi, my code as follows

global class InboundLinxUserRegistration {
      global class dtRegistrationInput {
      webservice ID UserId;
      webservice String First_Name;
      webservice String Last_Name;
      webservice String Email_Address;
      webservice String Status;
      webservice ID Workplace_Id;
      webservice String Workplace_Name;
      webservice String Workplace_Province;
      webservice String Workplace_City;
      webservice String Workplace_Postal_Code;
      webservice String Workplace_Address;
      webservice String Speciality;
      webservice String Record_Type;
        }
     global class dtRegistrationOutput {
       webservice String status;
       webservice String Message_Text;
      }
     
      public webservice static dtRegistrationOutput Registration(dtRegistrationInput Registration){
           dtRegistrationOutput retvalue=new dtRegistrationOutput();
           retvalue.status='Success';
                          
            List<Account> account=new List<Account>();
                             
                     account[0].National_Code__c=Registration.UserId;
                     account[0].FirstName=Registration.First_Name;
                     account[0].LastName=Registration.Last_Name;
                     account[0].PersonEmail=Registration.Email_Address;
                     account[0].Account_Status_NES__c=Registration.Status;
                     account[0].Primary_Parent_vod__c=Registration.Workplace_Id;
                     account[0].Primary_Province_NES__c=Registration.Workplace_Province;
                     account[0].Primary_City_NES__c=Registration.Workplace_City;
                     account[0].Primary_Postal_Code_NES__c=Registration.Workplace_Postal_Code;
                     account[0].Primary_Address_1_NES__c=Registration.Workplace_Address;
                     account[0].Specialty_1_vod__c=Registration.Speciality;
                     account[0].RecordTypeId=Registration.Record_Type;
                     try{
                          insert account[0];
                         } catch (Exception e){
                            retvalue.Status='Failure';
                            retvalue.Message_Text= e.getMessage();
                           }
                  
          return retvalue;
       }
  }   

 

when i am trying this code with xmlspy i am getting the error

<

faultcode>soapenv:Client</faultcode><faultstring>System.ListException: List index out of bounds: 0

Class.InboundLinxUserRegistration.Registration: line 28, column 30

External entry point

</faultstring>

How would you determine what object is associated with an event. The Related To field on Events object is a drop down of Objects so how can one determine the selected object at runtime?

 

Thanks

Need to do a simple total of values from a query. Some database numeric fields do not have a value.

 

here's the code snippet-

trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C +Trigger.new[i].Admin_Fee__c;

 

in this case admin_fee__C is not applicable so has null value(its a numeric field)

 

Tried most functions to get around the issue - how do I get the total working?

 

Thanks much.

 

included below is a summary of my various attempts!

 

trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + NULLVALUE(Trigger.new[i].Admin_Fee__c,0);

Error:
Method does not exist or incorrect signature: NULLVALUE(Decimal, Integer) at line 47 column 71


tried replacing with decimal with following local variable
decimal replaceNULL=0;
trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + NULLVALUE(Trigger.new[i].Admin_Fee__c,replaceNULL);
     
Error:
Method does not exist or incorrect signature: NULLVALUE(Decimal, Decimal) at line 48 column 71

same with blankvalue
trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + BLANKVALUE(Trigger.new[i].Admin_Fee__c,replaceNULL);

error:
Method does not exist or incorrect signature: BLANKVALUE(Decimal, Decimal) at line 48 column 71

 

if (ISNULL(Trigger.new[i].Admin_Fee__c) ) {Trigger.new[i].Admin_Fee__c=0;}

--Error:
--Method does not exist or incorrect signature: ISNULL(Decimal) at line 45 column 11

if (ISBLANK(Trigger.new[i].Admin_Fee__c) ) {Trigger.new[i].Admin_Fee__c=0;}
--similar error


also tried using len(fieldname) <1 to check if null - does not work

 

I have just started writing apex controller and I'm quite new to it.....and I'm not sure what is happening here....I wanted the output of the VF page to be 1 2 3 4 but instad it is 1 1 1 1.  Is there a work around for this?......I need the values within the <repeat>tag itself. 

<!-- The VF PAGE -->

<apex:page controller="increment" sidebar="false" showHeader="false" >
     <apex:repeat var="a" value="{!a}">
         {!i} <br/>
     </apex:repeat>
</apex:page>


/* The Controller ----Increment */

public class increment
{
    integer i=0;
    list<integer> a{get;set;}
      
    public integer geti()
    {
       
        i++;
        return i;
    }
    public list<integer> geta()
    {
        a = new list<integer>();
        a.add(10);
        a.add(10);
        a.add(10);
        a.add(10);
        return a;
    }
}


Hi All,

 

           I need salesforce help ballon image after inputtext field in visualforce page.

 

 

Thanks

Sreenath

Hi,

 

I want to use the search functionality in salesforce similar to Google. i.e. salesforce should be able to use the semantic search(like, if I search "docmnts" salesforce should display all the results related to  "documents").

 

Any help is appreciated!!

 

 

  • June 18, 2012
  • Like
  • 0

Hi,

 

How can I resolve the following issue..

 

I email a contact from salesforce,  That email is stored under the Activity History section.
Now, received contact person replied to that mail..
But, that reply does not show up in that contact's activity history. 

 

What necessary steps I have to take so that the replied mail will be stored under the same activity history..

 

Any help is appreciated!!

  • February 24, 2012
  • Like
  • 0

Hi,

 

I am getting the above error when I am sharing a lead through apex.

 

Scenario: I am creating a lead by logging in as Partner User. When the assignment rule checkbox is checked the created lead get assigned to another user. I wanted to share that lead with the created user ID(Partner user).  For this purpose, I wrote trigger. When the trigger get fired it is throwing the above exception.

 

How can I resolve it??

 

Thanks in advance!!

 

  • February 23, 2012
  • Like
  • 0

I want to display a visualforce page with the users information and with their respective roles. The Output should be like this:

 

USER                                           EMAIL

RoleA

  User A                            userA@test.com

  User  B                           userB@test.com

Role B

  User C                            userC@test.com

  User D                             userD@test.com

 

Please help me in accomplishing this requirement.

 

Thanks in Advance!!

  • January 23, 2012
  • Like
  • 0

Hi,

 

I am trying to retrieve the list of users grouping by their role names:

The output should be something like:

 

Role A

   User A

   User B

Role B

   User C

   User D

 

I used the following query:

list<AggregateResult> listAr  = [select  UserRole.Name,name from User where  IsActive =true group by UserRole.Name];

 

but it is showing the duplicate alias: Name error.

 

How can I achieve this?

 

Thanks in advance!!

 

 

  • January 19, 2012
  • Like
  • 0

I want to display list of accounts in a page block table with the expand/ collapse capabilities. I refereed to the following site:

http://www.forcetree.com/2010/04/expand-collapse-pageblock-table-columns.html

 

In the above blog they have used the nested page block tables. But I want to display the single pageblock table with one column as '+' or '-' sign and another column as Account Name.When a user clicks on the + sign the list of accounts should be displayed with the Account Name as their header.

 

 

Thanks in advance!!

  • January 10, 2012
  • Like
  • 0

I want to take back up of all cases which are created before 1/1/2008 and having attachments attached to it.

1. I am not able to create a report on the Attachments object

2. Through data loader when i am querying like:

Select Id, CaseNumber, CreatedDate, CreatedById, LastModifiedById,(Select ContentType,id,ParentId From Attachments) FROM Case where CreatedDate<2008-01-01T00:00:00Z

The csv file is not returning attachment details.

 

How can i accomplish this requirement?

 

Thanks in advance!!

  • December 16, 2011
  • Like
  • 0

Hi,

 I am facing problem with the integration of java with salesforce.

 

I have created a webservice class and generated wsdl for the same.When i am trying to call the webservice method in java it is showing the invalid session ID error.

 

CODE:

       HelloWebServiceLocator serLocator = new HelloWebServiceLocator ();

        PartnerConnection connection = null;
        ConnectorConfig partnerConfig  = new ConnectorConfig();
        partnerConfig .setUsername("*********************");
        partnerConfig .setPassword("************************");
        connection = Connector.newConnection(partnerConfig );

        serLocator.HelloWeb().sayHello();    //HelloWeb is the Apex Class & sayHello is the method

 

Here I am not passing sessionId.serLocator is not showing any default methods to set sessionID. How can I set session ID to the serLocator object? Can anyone provide me the sample code for this one?

 

  • October 24, 2011
  • Like
  • 0

Hi,

 

I am getting the above error when I am sharing a lead through apex.

 

Scenario: I am creating a lead by logging in as Partner User. When the assignment rule checkbox is checked the created lead get assigned to another user. I wanted to share that lead with the created user ID(Partner user).  For this purpose, I wrote trigger. When the trigger get fired it is throwing the above exception.

 

How can I resolve it??

 

Thanks in advance!!

 

  • February 23, 2012
  • Like
  • 0

Hi,

 

I am trying to retrieve the list of users grouping by their role names:

The output should be something like:

 

Role A

   User A

   User B

Role B

   User C

   User D

 

I used the following query:

list<AggregateResult> listAr  = [select  UserRole.Name,name from User where  IsActive =true group by UserRole.Name];

 

but it is showing the duplicate alias: Name error.

 

How can I achieve this?

 

Thanks in advance!!

 

 

  • January 19, 2012
  • Like
  • 0

 

Hi,

 

What should be the query to cancatinate two fields in SOQL

 

The equivalent mysql query is

select id from User where concat(firstname," ",lastname)="Hari G S";

 

Thanks and Regards

Hari G S

Hi All,

 

     How to get the total count of all contacts  with atleast one related Case.

 

Thanks

I have an app that does stuff with OpptyTeamMembers, but that app can't be installed in orgs that dont' have it turned on, and I don't want to have to create 2 versions of the app.

 

My solution to this is to make all the opptyTemMember references dynamic using sObjects, but I'm stuck on how to create new records as I get an error trying to do this:

sObject ot=new sObject();

 Error: Type cannot be constructed:sObject

 

I can't simply copy & update an existing opptyTeamMember as the ID fields aren't updatable.  

 

I realize the Apex guide says this isn't possible:

The new operator still requires a concrete sObject type, so all instances are specific sObjects.

 

...but an old thread on the partner API hints that it should be possible:

http://boards.developerforce.com/t5/NET-Development/getting-error-when-using-create-with-the-Partner-wsdl/m-p/27483/highlight/true

I have copied the Bitset class from the dependent picklist sample code (bottom of page) into an extension class.

 

I get the error on the line indicated below.

 

  class Bitset {
    byte[] data;
    
    public Bitset(byte[] data) {
      this.data = data == null ? new byte[0] : data;
    }
    
    public boolean testBit(int n) {
      return (data[n >> 3] & (0x80 >> n % 8)) != 0; //error reported on this line
    }
    
    public int size() {
      return data.length * 8;
    }
  }

 

Any ideas as to what could be wrong?

 

FYI I'm looking at this code because I have a requirement to conditionally display dependent picklist values in a table  instead of using the standard selectLists.

I have a search page for my custom object and in the result display the Member field (linked to Contact) is automatically clickable. I don't want this to be the case. Can I disable this?

 

The code for the section is:

 

<apex:column >               

<apex:facet name="header">                   

<apex:commandLink value="Member" action="{!toggleSort}" rerender="results,debug">                       

<apex:param name="sortField" value="member" assignTo="{!sortField}"/>                   

</apex:commandLink>               

</apex:facet>               

<apex:outputField value="{!counselling_practice.Member__c}"/>           

</apex:column>

 

Thanks in advance

 

Justyn

  • November 02, 2011
  • Like
  • 0

How to avoide the error in the following code................actually when i am testing this webservice with xmlspy it is giving the error

 

global class InboundLinxUserRegistration {
     global class dtRegistrationInput {
       webservice ID UserId;
       webservice String First_Name;
       webservice String Last_Name;
       webservice String Email_Address;
       webservice String Status;
       webservice ID Workplace_Id;
       webservice String Workplace_Name;
       webservice String Workplace_Province;
       webservice String Workplace_City;
       webservice String Workplace_Postal_Code;
       webservice String Workplace_Address;
       webservice String Speciality;
       webservice String Record_Type;
      }
     global class dtRegistrationOutput {
       webservice date mydate;
       webservice String added;
       webservice String status;
       webservice String Message_Text;
       webservice String error;
      
      }
     
      public webservice static dtRegistrationOutput userregistration(dtRegistrationInput userregistration){
           dtRegistrationOutput retvalue=new dtRegistrationOutput();
           for(List<Account> account :[select National_Code__c,PersonEmail from Account]){
              for(Account acc : account) {
                 if((acc.National_Code__c==userregistration.UserId)||(acc.PersonEmail==userregistration.Email_Address)){
                         retvalue.status='Failure';
                         retvalue.error='Duplicate';
                    }else {    
                     account[0].National_Code__c=userregistration.UserId;
                     account[0].FirstName=userregistration.First_Name;
                     account[0].LastName=userregistration.Last_Name;
                     account[0].PersonEmail=userregistration.Email_Address;
                     account[0].Account_Status_NES__c=userregistration.Status;
                     account[0].Primary_Parent_vod__c=userregistration.Workplace_Id;
                     account[0].Primary_Province_NES__c=userregistration.Workplace_Province;
                     account[0].Primary_City_NES__c=userregistration.Workplace_City;
                     account[0].Primary_Postal_Code_NES__c=userregistration.Workplace_Postal_Code;
                     account[0].Primary_Address_1_NES__c=userregistration.Workplace_Address;
                     account[0].Specialty_1_vod__c=userregistration.Speciality;
                     account[0].RecordTypeId=userregistration.Record_Type;
                     try{
                         insert acc;
                         retvalue.added='True';
                         retvalue.Message_Text='Registration Successfull';
                        } /*catch(DMLException e) {
                             retvalue.mydate=system.today();
                             retvalue.added='false';
                             retvalue.Message_Text=e.getMessage();
                        }*/
                        catch (Exception e){
                          retvalue.mydate=system.today();
                          retvalue.added='false';
                          retvalue.Message_Text=e.getMessage();
                         }
                    
                 }
              }
             return retvalue;
           }
            
                                 
          return retvalue;
       }
  }

How to get the created time of an opportunity based on the created date. The created date datatype is datetime.

Hi all,

 i want to write validation rule for text field name as sample and its default value is 'Test'. When i create the record first time its value is saved as usually.But when i try to edit the record at that time sample field does not allowing the value as Test.Need to change that value in second time.Any one can u please help me that.

 

Thanks in advance.

Hi, my code as follows

global class InboundLinxUserRegistration {
      global class dtRegistrationInput {
      webservice ID UserId;
      webservice String First_Name;
      webservice String Last_Name;
      webservice String Email_Address;
      webservice String Status;
      webservice ID Workplace_Id;
      webservice String Workplace_Name;
      webservice String Workplace_Province;
      webservice String Workplace_City;
      webservice String Workplace_Postal_Code;
      webservice String Workplace_Address;
      webservice String Speciality;
      webservice String Record_Type;
        }
     global class dtRegistrationOutput {
       webservice String status;
       webservice String Message_Text;
      }
     
      public webservice static dtRegistrationOutput Registration(dtRegistrationInput Registration){
           dtRegistrationOutput retvalue=new dtRegistrationOutput();
           retvalue.status='Success';
                          
            List<Account> account=new List<Account>();
                             
                     account[0].National_Code__c=Registration.UserId;
                     account[0].FirstName=Registration.First_Name;
                     account[0].LastName=Registration.Last_Name;
                     account[0].PersonEmail=Registration.Email_Address;
                     account[0].Account_Status_NES__c=Registration.Status;
                     account[0].Primary_Parent_vod__c=Registration.Workplace_Id;
                     account[0].Primary_Province_NES__c=Registration.Workplace_Province;
                     account[0].Primary_City_NES__c=Registration.Workplace_City;
                     account[0].Primary_Postal_Code_NES__c=Registration.Workplace_Postal_Code;
                     account[0].Primary_Address_1_NES__c=Registration.Workplace_Address;
                     account[0].Specialty_1_vod__c=Registration.Speciality;
                     account[0].RecordTypeId=Registration.Record_Type;
                     try{
                          insert account[0];
                         } catch (Exception e){
                            retvalue.Status='Failure';
                            retvalue.Message_Text= e.getMessage();
                           }
                  
          return retvalue;
       }
  }   

 

when i am trying this code with xmlspy i am getting the error

<

faultcode>soapenv:Client</faultcode><faultstring>System.ListException: List index out of bounds: 0

Class.InboundLinxUserRegistration.Registration: line 28, column 30

External entry point

</faultstring>

How would you determine what object is associated with an event. The Related To field on Events object is a drop down of Objects so how can one determine the selected object at runtime?

 

Thanks

Need to do a simple total of values from a query. Some database numeric fields do not have a value.

 

here's the code snippet-

trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C +Trigger.new[i].Admin_Fee__c;

 

in this case admin_fee__C is not applicable so has null value(its a numeric field)

 

Tried most functions to get around the issue - how do I get the total working?

 

Thanks much.

 

included below is a summary of my various attempts!

 

trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + NULLVALUE(Trigger.new[i].Admin_Fee__c,0);

Error:
Method does not exist or incorrect signature: NULLVALUE(Decimal, Integer) at line 47 column 71


tried replacing with decimal with following local variable
decimal replaceNULL=0;
trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + NULLVALUE(Trigger.new[i].Admin_Fee__c,replaceNULL);
     
Error:
Method does not exist or incorrect signature: NULLVALUE(Decimal, Decimal) at line 48 column 71

same with blankvalue
trigger.new[i].total_Amount__c = Trigger.new[i].meals_cost__C + BLANKVALUE(Trigger.new[i].Admin_Fee__c,replaceNULL);

error:
Method does not exist or incorrect signature: BLANKVALUE(Decimal, Decimal) at line 48 column 71

 

if (ISNULL(Trigger.new[i].Admin_Fee__c) ) {Trigger.new[i].Admin_Fee__c=0;}

--Error:
--Method does not exist or incorrect signature: ISNULL(Decimal) at line 45 column 11

if (ISBLANK(Trigger.new[i].Admin_Fee__c) ) {Trigger.new[i].Admin_Fee__c=0;}
--similar error


also tried using len(fieldname) <1 to check if null - does not work