首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sage CRM -加载包含实体数据的屏幕?

Sage CRM -加载包含实体数据的屏幕?
EN

Stack Overflow用户
提问于 2016-09-15 22:05:38
回答 1查看 442关注 0票数 0

给定以下代码:

代码语言:javascript
复制
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页面,但似乎不起作用

代码语言:javascript
复制
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?我在编辑的时候是这么认为的?

如何实现用实体数据填充屏幕字段?在这种情况下,它是一个通信实体

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-16 16:38:07

为了用数据填充自定义屏幕,您需要将数据传递给屏幕。

首先,您需要获取ID值。在本例中,我们从URL获取它:

代码语言:javascript
复制
var CommId = Request.QueryString("Key6") + '';

不过,我们还要做一些其他的检查。它们主要用于处理在不同版本或不同用户操作中出现的场景。

代码语言:javascript
复制
// 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在同一属性中包含多个in。在这些情况下,这些In用逗号分隔。因此,如果Id未定义,我们将检查其中是否有逗号。如果有,我们取第一个Id。

在获得Id之后,我们需要加载记录。在这一点上,你应该已经检查了你有一个有效的id (例如,不是零),并放入了一些错误处理。在某些页面中,您可能希望显示错误,而在其他页面中,您可能希望创建一个新的空白记录。这将获取记录:

代码语言:javascript
复制
var CommRecord = CRM.FindRecord("communication","comm_communicationid = " + CommId);

在此之后,您需要将记录应用于屏幕。使用上面的示例:

代码语言:javascript
复制
CustomCommunicationDetailBox.ArgObj = CommRecord;

将所有这些添加到您的脚本中,您将获得:

代码语言:javascript
复制
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);

然而,我们建议增加更多的错误/异常处理。如果用户正在保存记录,则还需要在写入页面后添加重定向。

支持六个刻度

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39513201

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档