簡體   English   中英

將潛在客戶ID克隆到crm后如何動態更改?

[英]How to change a lead id dynamically after cloning it in a crm?

在我的Microsoft CRM中,我需要創建一個克隆按鈕,按原樣復制銷售線索,以便我的用戶可以修改其中的少量數據然后保存。 我成功地將按鈕添加到功能區,並按照以下代碼設置克隆了我的線索:

網絡資源:

<RibbonDiffXml>
<CustomActions>
<CustomAction Id="My.MSCRM.incident.form.Clone.Button.CustomAction"         Location="Mscrm.Form.incident.MainTab.Collaborate.Controls._children" Sequence="0">
  <CommandUIDefinition>
    <Button Command="MSCRM.incident.form.Clone.Command" Id="MSCRM.incident.form.Clone.Button" Image32by32="$webresource:My_Clone32" Image16by16="$webresource:My_Clone16" LabelText="$LocLabels:MSCRM.incident.form.Clone.Button.LabelText" Sequence="0" TemplateAlias="o1" ToolTipTitle="$LocLabels:MSCRM.incident.form.Clone.Button.ToolTipTitle" ToolTipDescription="$LocLabels:MSCRM.incident.form.Clone.Button.ToolTipDescription" />
  </CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
 <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="MSCRM.incident.form.Clone.Command">
  <EnableRules/>
  <DisplayRules>
    <DisplayRule Id="MSCRM.incident.form.Clone.DisplayRule" />
  </DisplayRules>
  <Actions>
    <JavaScriptFunction FunctionName="cloneCase" Library="$webresource:My_CustomRibbonJavascript"      />
  </Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
  <DisplayRule Id="MSCRM.incident.form.Clone.DisplayRule">
    <FormStateRule State="Create" InvertResult="true" />
  </DisplayRule>
</DisplayRules>
<EnableRules/>
</RuleDefinitions>
<LocLabels>
<LocLabel Id="MSCRM.incident.form.Clone.Button.LabelText">
  <Titles>
    <Title description="Clone Case" languagecode="1033" />
  </Titles>
</LocLabel>
<LocLabel Id="MSCRM.incident.form.Clone.Button.ToolTipDescription">
  <Titles>
    <Title description="Clone Case" languagecode="1033" />
  </Titles>
</LocLabel>
<LocLabel Id="MSCRM.incident.form.Clone.Button.ToolTipTitle">
  <Titles>
    <Title description="Clone Case" languagecode="1033" />
  </Titles>
</LocLabel>

Javascript:

function GetContext() {
var _context = null;
if (typeof GetGlobalContext != "undefined")
    _context = GetGlobalContext();
else if (typeof Xrm != "undefined")
    _context = Xrm.Page.context;
return _context}

function cloneCase() {

if (Xrm.Page.data.entity.getId() == null) {
    alert('First save the record before Clone Case')

}
else {
    var CRMContext = GetContext();
    var serverUrl = CRMContext.getServerUrl();
    var caseid = Xrm.Page.data.entity.getId();
    caseid = caseid.replace('{', '').replace('}', '');

    //Below URL is for CRM online  
    var url = serverUrl + 'main.aspx?etc=112&extraqs=%3f_CreateFromId%3d%257b' + caseid + '%257d%26_CreateFromType%3d112%26etc%3d112%26pagemode%3diframe&pagetype=entityrecord';

    Window.open(url, 900, 600, 'toolbar=no,menubar=no,resizable=yes');
}
}

問題是,當我保存克隆的銷售線索時,由於我要復制的是帶有原始銷售線索ID的URL,所以在保存時,它不會另存為新銷售線索,而是保存而不是原始銷售線索具有相同的ID。 關於如何以保持URL克隆狀態的方式修改JavaScript代碼的任何想法,因為這是唯一獲得與原始副本完全相同的信息但又另存為新線索而不是Microsoft CRM中原始線索的唯一方法。 謝謝!

如果您查看此頁面 ,則會在頁面底部找到一個示例,該示例如何打開新表單並將數據發送到新表單,您可以使用該表單來預填充字段。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM