2013-06-13 6 views
0

Microsoft CRM에서 리드를 복제하는 복제 단추를 만들어야 내 사용자가 일부 데이터를 수정하여 저장할 수 있습니다.리드 ID를 CRM에서 복제 한 후 동적으로 변경하는 방법은 무엇입니까?

Webresource :

<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> 

자바 스크립트 :

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 대신 동일한 ID를 저장하므로 원본 리드의 ID로 URL을 저장합니다. URL을 복제하는 방식으로 내 JavaScript 코드를 수정하는 방법에 대한 아이디어는 원래 정보와 똑같은 정보를 복사 할 수있는 유일한 방법이지만 Microsoft에서 원본이 아닌 새로운 리드로 저장하는 유일한 방법입니다. CRM. 감사합니다.

답변

1

this page을 살펴보면 새 양식을 열고 필드를 미리 채우는 데 사용할 수있는 데이터를 새 양식으로 보낼 수있는 방법의 페이지 하단에 예제가 있습니다.

관련 문제