标准查找字段存在问题。 当我尝试保存它时,当我使用自动完成时它的值为 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是一个具有几个查找字段的Object。 (Contact_ c to Contact,Account _c to Account,等等......)
我实际上并没有保存它。但是当你system.debug它时,它不应该是 null ...
答案 0 :(得分:1)
我终于发现了问题所在。 这是一个众所周知的问题,我认为这是一个非常严重的错误。 使用联系人的输入字段时,如果在firstname字段或lastname字段中有空格,则会出错。
知识产品编号:000123565