0

我对标准查找字段有疑问。当我尝试保存它时,当我使用自动完成或仅键入名称时它的值为null但当我通过单击查找图标使用查找弹出窗口时它可以工作。

这是(部分)代码。(不是全部,但即使是这个简单的控制器和页面也不起作用......)控制器:

public with sharing class UnresolvedItemsController {

public list<TaskItem> myUnresolvedTaskItems {get;set;}

public class TaskItem {
    public string taskId {get;set;}
    public string subject {get;set;}
    public datetime createdDate {get;set;}
    public DummyObject__c dumObj {get;set;}
}


public UnresolvedItemsController(ApexPages.Standardcontroller controller) {
    if (myUnresolvedTaskItems==null) {
        myUnresolvedTaskItems = new list<TaskItem>();
        list<Task> myUnresolvedTasks = [select id,subject,createdDate,Description from Task Where Status='Not Started' and isDeleted=false and isClosed=false and isArchived=false and OwnerId=:UserInfo.getUserId() and subject like 'Unresolved Email:%' limit 10];
        TaskItem tmp = new TaskItem();
        for (task myT:myUnresolvedTasks) {
            myUnresolvedTaskItems.add(getInfoFromTask(myT));
        }
    }   
}

public TaskItem getInfoFromTask(Task myTask) {
    TaskItem returnTaskItem = new TaskItem();
    returnTaskItem.subject = myTask.Subject.replace('Unresolved Email: ','');
    returnTaskItem.createdDate = myTask.createdDate;
    returnTaskItem.taskId = myTask.Id;
    returnTaskItem.dumObj = new DummyObject__c();
    return returnTaskItem;
}

public pagereference save() {
    system.debug('1-----'+myUnresolvedTaskItems);
    return null;
}
}

看法:

<apex:page standardcontroller="Task" extensions="UnresolvedItemsController">
<apex:form >
    <apex:pageblock >
        <apex:pageblockbuttons >
            <apex:commandbutton action="{!Save}" value="{!$Label.Save}" />
            <apex:commandbutton action="{!Cancel}" value="{!$Label.Cancel}" />
        </apex:pageblockbuttons>

        <apex:pageblocktable value="{!myUnresolvedTaskItems}" var="ti">
            <apex:column >
                <apex:facet name="header">Subject</apex:facet>
                <a href="/{!ti.taskId}">{!ti.subject}</a>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Date</apex:facet>
                {!ti.createdDate}
            </apex:column>
            <apex:column >
                <apex:facet name="header">Assign to salesforce.com objects</apex:facet>
                <apex:inputfield value="{!ti.dumObj.Contact__c}" />
            </apex:column>

        </apex:pageblocktable>
    </apex:pageblock>
</apex:form>
</apex:page>

dummyObject 是一个具有几个查找字段的对象。(Contact_c到 Contact, Account_c到 Account,等等...)

我实际上并没有保存它。但是当你 system.debug 时它不应该为空......

4

1 回答 1

1

我终于发现了问题所在。这是一个已知问题,我认为这是一个非常严重的错误。为联系人使用输入字段时,如果名字字段或姓氏字段中有空格,则会出错。

知识文章编号:000123565

于 2013-02-20T07:18:08.830 回答