嗨,这是Ashwaq 我有一个顶级类和顶点页面,这两件事我必须上传到包,而我上传这个包我得到这个错误“没有在包的选定的Apex代码中找到testMethods”。所以请让我知道这个解决方案并给我回复asp。
apex class:
public global virtual class SendEmailToFeedback
{
public String items { get; set; }
Opportunity opportunity;
public String subject{ get; set; }
public String body { get; set; }
public String lid { get; set; }
public String response {get; set;}
List<Opportunity> Opp;
public PageReference cancel()
{
return null;
}
public List<Opportunity> getOpp()
{
if(Opp== null)
{
lid = System.currentPageReference().getParameters().get('name');
Opp= [Select o.Name,o.Email__c from Opportunity o where o.id =:lid];
}
return Opp;
}
public PageReference send()
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
String addresses;
if (Opp[0].Email__c != null)
{
addresses = Opp[0].Email__c;
if (Opp[0].Email__c != null)
{
addresses += ':' + Opp[0].Email__C;
String[] toAddresses = addresses.split(':', 0);
email.setSenderDisplayName('THYLAKSOFT LLC');
email.setSubject(subject);
email.setToAddresses(toAddresses);
email.setPlainTextBody(body + 'Click The Followoing Link http://tefllife.com/studentfeedback.html');
try
{
Messaging.SendEmailResult [] resultMail= Messaging.sendEmail(new
Messaging.SingleEmailMessage[] {email});
if(resultMail[0].isSuccess())
response = 'ok sent!';
else
{
response = resultMail[0].getErrors().get(0).getMessage();
}
}
catch(System.EmailException ex)
{
response = ex.getMessage();
}
}
}
return null;
}
}
顶点是:
<apex:page controller="SendEmailToFeedback" id="thePage">
<script>
function confirmCancel() {
var isCancel = confirm("Are you sure you wish to cancel?");
if (isCancel) return true;
return false;
}
</script>
<apex:form >
<apex:pageBlock >
<p>Fill out the fields below to test how you might send an email to a Opportunity.</p><br />
<apex:dataTable value="{!Opp}" var="o" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!o.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!o.Email__c}
</apex:column>
</apex:dataTable>
<br /><br />
<apex:outputLabel value="Subject" for="Subject"/>:<br />
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br /><br />
<apex:outputLabel value="Body" for="Body"/>:<br />
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br /><br /><br />
<apex:commandButton value="SendEmail" action="{!send}"/>
<apex:commandButton action="{!cancel}" value="Cancel"
onclick="return confirmCancel()" immediate="true"/>
</apex:pageBlock>
</apex:form>
</apex:page>
答案 0 :(得分:3)