• prats23
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 17
    Replies

Hi,

 

I am trying to create a Email Functionality on click a custom button. i.e. I have a button that runs javascript on click and it executes the Apex class.

 

Button is:

-------------------

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var result=sforce.apex.execute( "EmailMe", "EmailFunction", {});
alert(result);

-------------------

 

Apex Class is:

--------------------

public with sharing class EmailMe {
    
    private String[] toAddresses;
    
    public EmailMe(){
        List<User> currentUser = [Select Email from User where Id =:UserInfo.getUserId()];
        String[] toAddresses = new String[] {currentUser[0].Email};
    }
    
    public String EmailFunction(){
        
             Messaging.reserveSingleEmailCapacity(4);
        
             Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                
        mail.setToAddresses(toAddresses);
        mail.setSubject('Test Mail');
        mail.setPlainTextBody('Your Case has been created for testing');
        
        Messaging.SendEmailResult[] res = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        if(res[0].isSuccess()){
            return 'Email is sent';    
        }
        else{
            return res[0].getErrors()[0].getMessage();
        }            
    }
}

--------------------

 

But i am recieving something like this error:

 

"{http:// soap.sforce.com/schemas/package/EmailMe}Emailfunction please check the WSDL for the service.."

 

Do you think I have to setup some connection or something??

I am using my DEV org.

 

Help!!

Hi,

 

We have a old S-control on a custom object that is used to Email the details of the record to the current user's Email id.

This S-control was created long back.

 

But recently, we have found that the button on clik gives error "faultcode:"Soapenv:Client" faultstring:The content of elements must consist of well-formed character data or markup".

 

Well I am not able to debug the code, as it was written by someone else.

 

What do you reckon could be a possible solution?? I am really bad with S-controls but I know Javascript

 

Please help!

 

 

P.S. Creating this functionality using VF is on my mind, but i will try to debug this first!

Hi all!!

 

I have  aparticular piece of apex code that is excuted on click of a button (Javascript based custom button).. I am facing problem in writing test mthods for it..

 

Callout from button is like:-

-----------------------------------------

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}


var result=sforce.apex.execute(
"calculateData", // class
"initialMethod", // method
{});

alert(result);

 

----------------------------------------

 

The apex class calculateData is like :-

----------------------------------------

global class calculateData {

 

Webservice static String initialMethod()  { 

 

    //Variables Declaration 
 
    /* SOQL query to 2 different objects storing raw data and then calulation    logic applied(call to calc method) and calculated data inserted to a 3rd object

    */

 

return 'success'; 

 

}

 

 /*Method for Calculation */
  public Double doCalc(arguments passed from initialMethod)
  {

     // calculation logic
   }

 

}

 

---------------------------------------------

 

Now, I am not able to write test methods for this class. I am really confused about what dataset should I create for testing, as the data is fetched from the existing objects!

 

Please help!! I hope the scenario is clear.. i have tried my best to put my problem across.. Any help or suggestion?

Hi all,

 

We a button that on click executes an apex class. There are SOQL queries and DML statements in FOR loop in that class. Hence, i wanted to know the governor limit on that? We do not have any trigger in between.

 

Scenario is: We have to fetch data from 2 objects and after some calculation on it, we have to insert a new record to a 3rd object.

 

Do you think having SOQL/DML in FOr loop will run over Governor limits? Please suggest! Shall we follow best practices?

Hi all,

 

I have a requirement to show reports to users based on their own name as the filter criteria.

We have a object which contains the incentives of employees (employees => lookup to user) on monthly basis. The report is to show the employees there own incentives data only, when they click on the link or something for report.

 

I thought of creating a Generic report template which checks for the user id as they login to the system and on clicking the link the filter for the report should take the used name from user id and show respective records! Also, i will make the records

 

Is this feasible in SF? I am not sure how to go about creating a Genereic report! Please suggest!!

 

Also, please suggest is there any other simpler or better way to achieve this requirement?

 

Thanks a lot =)

Hi all,

We have a requirement of using data from 2 custom objects to do some calculations and feed calculated data as a new record into a 3rd object. The operation is to be done once a month and on click of a button or something.

I thought of using Dynamic Apex to create a class having code to calculate the required numbers after fetching records from 2 objects and feed into the 3rd object as new record. Also, to initiate the operation, i would put a custom button on the view page 3rd(calculated object) and on click of it the code (Dynamic apex) should run!

Is my thought process okay? Is it feasible in SFDC using Dynamic APex? Please suggest as i am new to SF development!

Also, i am having problem in attaching the apex class to the custom button! How to make the button run the code on click??

Please suggest! Thanks a lott!!

Can triggers be used to transfer Content files across workspaces?

  • April 25, 2011
  • Like
  • 0

 

ErrorError: Invalid field Eval_Request_Detail__r for SObject Trial_Request__c
what is the error in following code?
<messaging:emailTemplate subject="Eval Request and Request Details" recipientType="User" relatedToType="Trial_Request__c">
<messaging:htmlEmailBody >
<table>
     <tr>
     <td>  Dear Sir </td>
      </tr>
       <tr>  
           <td> <dd> Below Eval Request and Eval Requestdetails</dd></td>
          </tr>          
                        <tr>
                        <td> Name   : {!relatedTo.Name}</td>
                        </tr>   
                       <tr>
                        <td>Customer Name   : {!relatedTo.Contact_Name__c}</td>
                        </tr>
                        <tr>
                        <td>status   : {!relatedTo.Status__c}</td>
                        </tr>
                        <tr>
                        <td>E-mail Address: {!relatedTo.E_mail_Address__c}</td>
                        </tr>
                        
                         </table>
               
                   <table border="1">
                       <tr>
                           <th> Detail Number </th>
                           <th> Product Name </th>
                           <th> Quantity </th>
                           <th> Remarks </th>
                           
                       </tr>
                      <apex:repeat var="itemslist" value="{!relatedTo.Eval_Request_Detail__r}">
                       <tr>
                       
                       
                          <td>{!itemslist.Name}</td>
                          <td>{!itemslist.Product__c}</td>
                          <td>{!itemslist.Quantity__c}</td>
                          <td>{!itemslist.Remarks__c}</td>
                         
                         
                       </tr>
                        </apex:repeat>
                    </table>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Hi,

 

I am trying to create a Email Functionality on click a custom button. i.e. I have a button that runs javascript on click and it executes the Apex class.

 

Button is:

-------------------

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var result=sforce.apex.execute( "EmailMe", "EmailFunction", {});
alert(result);

-------------------

 

Apex Class is:

--------------------

public with sharing class EmailMe {
    
    private String[] toAddresses;
    
    public EmailMe(){
        List<User> currentUser = [Select Email from User where Id =:UserInfo.getUserId()];
        String[] toAddresses = new String[] {currentUser[0].Email};
    }
    
    public String EmailFunction(){
        
             Messaging.reserveSingleEmailCapacity(4);
        
             Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                
        mail.setToAddresses(toAddresses);
        mail.setSubject('Test Mail');
        mail.setPlainTextBody('Your Case has been created for testing');
        
        Messaging.SendEmailResult[] res = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        if(res[0].isSuccess()){
            return 'Email is sent';    
        }
        else{
            return res[0].getErrors()[0].getMessage();
        }            
    }
}

--------------------

 

But i am recieving something like this error:

 

"{http:// soap.sforce.com/schemas/package/EmailMe}Emailfunction please check the WSDL for the service.."

 

Do you think I have to setup some connection or something??

I am using my DEV org.

 

Help!!

Hi,

 

We have a old S-control on a custom object that is used to Email the details of the record to the current user's Email id.

This S-control was created long back.

 

But recently, we have found that the button on clik gives error "faultcode:"Soapenv:Client" faultstring:The content of elements must consist of well-formed character data or markup".

 

Well I am not able to debug the code, as it was written by someone else.

 

What do you reckon could be a possible solution?? I am really bad with S-controls but I know Javascript

 

Please help!

 

 

P.S. Creating this functionality using VF is on my mind, but i will try to debug this first!

Hi there,

 

We are trying to implement a new custom object to store product defects.  We have 1 requirement we are not sure if it requires customization.  The specific requirement is the following:

 

- The ability to relate product defects to each other (ie. records within the same object) by selecting existing defects in the system.

- A *single* related list (eg. "Related Defects") on the product defect layout to show all "linked" product defects, eg. if DefectA is linked to DefectB and DefectC, DefectA's related list will show B and C, DefectB's related list will show A and C, and so on.

 

Can this be done without customization?

 

thanks

Hi, All

 

i just want know that salesforce upgraded all server instances  ??? means na7, ap1 etc .....

coz, i have just creared new developer org and its instance is ap1. and i saw that  there are new features like [ Apex Test Execution,  Apex Test Results ] are available in that org...

but that chages are not in my previouly created developer org which on na7 instance.

 

why is it so .... ??

  • March 02, 2011
  • Like
  • 0

Hi all,

 

We a button that on click executes an apex class. There are SOQL queries and DML statements in FOR loop in that class. Hence, i wanted to know the governor limit on that? We do not have any trigger in between.

 

Scenario is: We have to fetch data from 2 objects and after some calculation on it, we have to insert a new record to a 3rd object.

 

Do you think having SOQL/DML in FOr loop will run over Governor limits? Please suggest! Shall we follow best practices?

Hi all,

 

I have a requirement to show reports to users based on their own name as the filter criteria.

We have a object which contains the incentives of employees (employees => lookup to user) on monthly basis. The report is to show the employees there own incentives data only, when they click on the link or something for report.

 

I thought of creating a Generic report template which checks for the user id as they login to the system and on clicking the link the filter for the report should take the used name from user id and show respective records! Also, i will make the records

 

Is this feasible in SF? I am not sure how to go about creating a Genereic report! Please suggest!!

 

Also, please suggest is there any other simpler or better way to achieve this requirement?

 

Thanks a lot =)

Hi all,

We have a requirement of using data from 2 custom objects to do some calculations and feed calculated data as a new record into a 3rd object. The operation is to be done once a month and on click of a button or something.

I thought of using Dynamic Apex to create a class having code to calculate the required numbers after fetching records from 2 objects and feed into the 3rd object as new record. Also, to initiate the operation, i would put a custom button on the view page 3rd(calculated object) and on click of it the code (Dynamic apex) should run!

Is my thought process okay? Is it feasible in SFDC using Dynamic APex? Please suggest as i am new to SF development!

Also, i am having problem in attaching the apex class to the custom button! How to make the button run the code on click??

Please suggest! Thanks a lott!!