鉴于此代码:
var Container = CRM.GetBlock("Container");
var CustomCommunicationDetailBox = CRM.GetBlock("CustomCommunicationDetailBox");
Container.AddBlock(CustomCommunicationDetailBox);
if(!Defined(Request.Form)){
CRM.Mode=Edit;
}else{
CRM.Mode=Save;
}
CRM.AddContent(Container.Execute());
var sHTML=CRM.GetPageNoFrameset();
Response.Write(sHTML);
我用这个参数调用这个.asp页面但似乎不起作用
popupscreeens.asp?SID=33185868154102&Key0=1&Key1=68&Key2=82&J=syncromurano%2Ftabs%2FCompany%2FCalendarioCitas%2Fcalendariocitas.asp&T=Company&Capt=Calendario%2Bcitas&CLk=T&PopupWin=Y&Key6=1443Act=512
注意Key6 = Comm_Id和Act = 512 ???我相信它是在编辑时吗?
如何通过实体dada填充屏幕的字段? 在这种情况下,它是一个通信实体
答案 0 :(得分:1)
要使用数据填充自定义屏幕,您需要将数据传递到屏幕。
首先,您需要获取Id值。在这种情况下,我们会从网址获取它:
var CommId = Request.QueryString("Key6") + '';
我们还要进行一些其他检查。这些主要用于处理不同版本或不同用户操作的场景。
// check we have a value and get the Id from context if we don't
if(CommId == 'undefined'){
CommId = CRM.GetContextInfo("Communication","comm_communicationid");
}
// if CommId is still undefined, set it to zero to check later
// otherwise, make sure the URL only contains one CommId
if(CommId == 'undefined'){
CommId = 0;
} else if(CommId.indexOf(",") > -1){
CommId = CommId.substr(0,CommId.indexOf(","));
}
某些用户操作可以使URL在同一属性中保存多个ID。在这些情况下,这些ID用逗号分隔。因此,如果未定义Id,我们会检查其中是否有逗号。如果有,我们采取第一个ID。
我们有了Id之后,我们需要加载记录。此时,您应该已经检查过您有一个有效的ID(例如,不是零)并进行了一些错误处理。在某些页面中,您可能希望显示错误,而在其他页面中您可能想要创建一个新的空白记录。这得到了记录:
var CommRecord = CRM.FindRecord("communication","comm_communicationid = " + CommId);
之后,您需要将记录应用到屏幕上。使用上面的示例:
CustomCommunicationDetailBox.ArgObj = CommRecord;
将所有内容添加到您的脚本中,您将获得:
var CommId = Request.QueryString("Key6") + '';
// check we have a value and get the Id from context if we don't
if(CommId == 'undefined'){
CommId = CRM.GetContextInfo("Communication","comm_communicationid");
}
// if CommId is still undefined, set it to zero to check later
// otherwise, make sure the URL only contains one CommId
if(CommId == 'undefined'){
CommId = 0;
} else if(CommId.indexOf(",") > -1){
CommId = CommId.substr(0,CommId.indexOf(","));
}
// add some error checking here
// get the communication record
var CommRecord = CRM.FindRecord("communication","comm_communicationid = " + CommId);
// get the container and the detail box
var Container = CRM.GetBlock("Container");
var CustomCommunicationDetailBox = CRM.GetBlock("CustomCommunicationDetailBox");
// apply the communication record to the detail box
CustomCommunicationDetailBox.ArgObj = CommRecord;
// add the box to the container
Container.AddBlock(CustomCommunicationDetailBox);
// set the moder
if(!Defined(Request.Form)){
CRM.Mode=Edit;
} else {
CRM.Mode=Save;
}
// output
CRM.AddContent(Container.Execute());
var sHTML=CRM.GetPageNoFrameset();
Response.Write(sHTML);
但是,我们建议进行更多的错误/异常处理。如果用户正在保存记录,则还需要在写入页面后添加重定向。
Six Ticks Support