标签: apex-code

如何获得实现Schedulable接口的Apex类?

我有许多实现可调度接口的类.我想通过另一个顶级课程一次编写多个Apex类.所以我需要查询所有实现Schedulable接口的类.

我使用以下代码snipet来实现这一点,但我收到如下编译器错误

错误:"您必须选择实现Schedulable接口的Apex类.在第127行第13列"

码:

list<ApexClass> listClasses; 

String input='0 0 8 13 2 ?';

listClasses=[Select Id, Name,body from ApexClass]   
for(ApexClass a:listClasses){            
        system.schedule(a.Name+' AutoScheduler', input, a);    
}
Run Code Online (Sandbox Code Playgroud)

问题:如何查询实现可调度接口的所有apex类?这样我就可以直接将它传递给system.schedule()方法.

不同尝试:在收到此错误后,我尝试仅查询实现可调度接口的一个顶点类(已知类).再没有用.请参阅下面的snipet了解不同的尝试

码:

list<ApexClass> listClasses; 

String input='0 0 8 13 2 ?';

//Retriving only one class of Name='SchedularTest' 

listClasses=[Select Id, Name,body from ApexClass where Name ='SchedularTest']   
for(ApexClass a:listClasses){            
        system.schedule(a.Name+' AutoScheduler', input, a);    
}
Run Code Online (Sandbox Code Playgroud)

错误:"您必须选择实现Schedulable接口的Apex类.在第127行第13列"

提前致谢

Satheeskumar

salesforce apex-code

1
推荐指数
1
解决办法
5590
查看次数

如何在调用后关闭或销毁一个类?

我在类中调用了一个方法,如下所示:

String key1 = "test1";
String key2 = "test2";

long[] datalr = new long[] {};

TestClass myTC1 = new TestClass(); 
datalr = myTC1.callerSub(key1,key2);
TestClass myTC2 = new TestClass(); 
datalr = myTC2.callerSub(key1,key2);
Run Code Online (Sandbox Code Playgroud)

测试类如下:

public class TestClass {

  private final Long[] P = new Long[18];



  Public TestClass {
  }

  public long[] callerSub(string key1, String key2){

    long[] datalr = new long[] {0,0};
    integer i;
    system.debug(LoggingLevel.INFO,P[0]);

    datalr[0] = 2;
    datalr[1] = 3;
    for ( i = 0; i < 18; ++i ){
      P[i] = …
Run Code Online (Sandbox Code Playgroud)

java apex-code

1
推荐指数
1
解决办法
117
查看次数

salesforce中的字符串到日期时间转换

下面的行给出了salesforce中的'FIELD_INTEGRITY_EXCEPTION'.请为我提供替代方案.

imr.Assigned_DTM__c = DateTime.valueOfGmt(('06/08/2013 06:30:22').replaceAll('/',' - '));

salesforce apex-code

1
推荐指数
1
解决办法
1万
查看次数

如何添加按钮或链接到标准控制器与应用标签不同的visualforce页面?

我有visualforce页面CompetitorSearch.page使用CompSearchDummy__c标准控制器.

<apex:page StandardController="CompSearchDummy__c" extensions="CompetitorSearch">
Run Code Online (Sandbox Code Playgroud)

如果我要在页面上添加自定义按钮CompSearchDummy,则CompetitorSearch.page显示页面目标.

但我有Talent使用的页面,Talent__c sObject当我尝试添加自定义按钮并尝试设置目的地时,CompetitorSearch.page不会显示为选项,因为我没有设置Talent__cstandard controller.

是否有可能以某种方式将我的CompetitorSearch.page链接添加到Talent页面?

salesforce visualforce apex-code

0
推荐指数
1
解决办法
2万
查看次数

如何在Salesforce Apex中格式化double

我希望显示双重格式,如"12.30",但它在salesforce apex中显示"12.0".谁能帮我?

salesforce visualforce apex-code

0
推荐指数
1
解决办法
1663
查看次数

从Visualforce查找字段输出中删除链接

我正在使用VF页面将合同中的数据合并到PDF文档中.

当我试图直接打印查找字段的值时(例如{!contract.Outside_Broker_Name__c}),它会打印对象的id,所以我必须这样做:

<apex:outputField value="{!contract.Outside_Broker_Name__c}" />
Run Code Online (Sandbox Code Playgroud)

但是现在它会打印带有对象链接的名称,因此在pdf中它显示为带有下划线的蓝色文本.

我如何摆脱这个链接?或者更好的问题是,如何直接访问父对象以便我可以直接从VF访问其字段?

salesforce visualforce apex-code

0
推荐指数
1
解决办法
4151
查看次数

我可以根据VF页面中的布尔变量显示输出字段或输入字段

我有一个布尔变量,根据这是真还是假,我想将字段显示为inputfield或outputfield.

   {!IF(!Showinput), <apex:outputField value="{!a.field1__c}"/>, apex:inputField value="{!a.field1__c}"/>)}
   <apex:inputField value="{!a.field2__c}"/>
Run Code Online (Sandbox Code Playgroud)

当我试图保存时,我得到一个错误

  Error: Attribute value in <apex:inputField> must contain only a formula expression that resolves to a single controller variable or method
Run Code Online (Sandbox Code Playgroud)

有没有其他方法来实现这一目标

salesforce visualforce apex-code

0
推荐指数
1
解决办法
3344
查看次数

如何获得角色前5个字符为sales的用户列表

我需要获取一个用户列表,其角色的前5个字符为'Sales'我想在apex类上使用它

我的第一个想法是使用这样的东西

 select id from user where UserRoleId__r like 'Sales%'
Run Code Online (Sandbox Code Playgroud)

但这会引发错误

 No such column 'UserRoleId__r' on entity 'User'.
Run Code Online (Sandbox Code Playgroud)

我是否需要查询角色对象以获取所有ID,然后使用这些ID查询用户对象?

有更好的方法吗?

谢谢

salesforce apex-code

0
推荐指数
1
解决办法
4004
查看次数

是否有任何选项可以在salesforce平台中连接其他数据库?

我想知道是否有任何选项可以连接到salesforce平台中的外部数据库.

谢谢,Easwar

salesforce force.com visualforce apex-code

0
推荐指数
1
解决办法
1392
查看次数

角色''没有可行的选择

您好我在此代码/*类中收到以下错误:CreateMobileChatterCntrl说明:联系人发布Chatter.开发者:Harish Khatri(Appirio Offshore)创建日期:2012年6月2日*/

public without sharing class CreateMobileChatterCntrl {
  public final Id ContactID{get;set;}
  public String message{get;set;}
  public boolean isSuccess{get;set;}
  public boolean throwError{get;set;}
  public String deviceType{get;set;}
  //----------------------------------------------------------------------------    
    //constructor
  //----------------------------------------------------------------------------  
  public CreateMobileChatterCntrl() {
    throwError = false;
    isSuccess = false;
    if( ApexPages.CurrentPage().getParameters().get('id') != null){
      ContactID = ApexPages.CurrentPage().getParameters().get('id');
    }
    String userAgent = ApexPages.currentPage().getHeaders().get('USER-AGENT');
    if(userAgent.contains('iPhone')) 
      deviceType = 'iPhone';
    //else if(userAgent.contains('Android')) deviceType = 'Android';  
  }
  //----------------------------------------------------------------------------    
    // Post the chatter on contact
  //----------------------------------------------------------------------------
  public Pagereference save() {

    if(message == null || message ==''){
      throwError = true; …
Run Code Online (Sandbox Code Playgroud)

salesforce apex-code

0
推荐指数
1
解决办法
2万
查看次数

实体'Lead'上没有此列"所有者"

我收到以下错误

错误:编译错误:实体'Lead'上没有此列"所有者".如果您尝试使用自定义字段,请务必在自定义字段名称后附加"__c".请参考您的WSDL或描述调用以获取适当的名称.在第8栏第17栏

trigger Lead_Assignment on Lead (after insert) {

     List<Lead> le=trigger.new;
     User us=le.get(0).CreatedBy;
    List<User> u=[SELECT id from USER WHERE At_Work__c=true];    
    List<integer> ii=new List<Integer>();
    for(User uu:u){
    Integer xx= [SELECT count() from Lead WHERE Owner=:uu];


    }



}
Run Code Online (Sandbox Code Playgroud)

在Lead对象中有一个名为Owner的字段为什么我收到此错误请帮助解决此错误.

salesforce apex-code

0
推荐指数
1
解决办法
5649
查看次数

如何制作apex:pageBlockTable大小为全屏大小

我正在构建一个visualforce页面我必须在pageblocksectionitem中创建一个visualforce页面,就像我在我的代码中显示的那样.我不太了解css.我的代码是

<apex:page standardController="Account">
<apex:pageBlock title="My Content">
<apex:pageBlockSection>
<apex:pageBlockSectionItem>
<apex:pageBlockTable value="{!account.Contacts}" var="item">
<apex:column value="{!item.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Run Code Online (Sandbox Code Playgroud)

它显示的表格宽度小于屏幕宽度的一半.我不太了解css但是当我设置样式:{width:250%}然后它的宽度增加我必须设置多少百分比所以它的宽度将等于apex:pageblocktable没有被apex包围:blockSection和apex:pageBlockSectionItem或任何备用指南

salesforce visualforce apex-code

0
推荐指数
1
解决办法
6611
查看次数

标签 统计

apex-code ×12

salesforce ×11

visualforce ×6

force.com ×1

java ×1