【发布时间】:2016-10-11 18:33:49
【问题描述】:
我有一个自定义工作流活动,它从我的自定义工作流活动中创造了新的机会。 我将该活动作为行动步骤。我正在使用动作,因为它有一个输出。我需要获得我创造的机会的 ID。 我使用 Process.js 从 JS Web 资源调用该操作。之后,我使用 Notify.js 通知用户机会已创建。在那个通知上,我需要有一个链接到新创建的机会的按钮。
以下是与输出参数相关的部分 C# 代码。只是要注意用于创造机会和执行更多任务的代码部分工作正常:
//define variable
[Output("Opportunity")]
[ReferenceTarget("opportunity")]
public OutArgument<EntityReference> NewOpportunity { get; set; }
//create opportunity and entity reference(i am not sure do ineed entity reference, or something else for that link)
Guid opportunityId = service.Create(opportunity);
EntityReference OppId = new EntityReference(opportunity.LogicalName, opportunityId);
//assign value to the output variable
NewOpportunity.Set(Econtext, OppId);
这里是调用action的JS代码:
function toOpportunity(){
Process.callAction("ad_opportunity",
[{
key: "Target",
type: Process.Type.EntityReference,
value: { id: Xrm.Page.data.entity.getId(), entityType: "ad_productsamplerequest" }
}],
function (param) {
//Success
Notify.add("New Opportunity was created:", "INFO", "opportunity",
[{
type: "button",
text: "Go to opportunity",
callback: function () {
}
}]);
},
function () {
// Error
alert("Opportunity was not created");
}
);
只是说,它有效,行动被调用,机会被创造,然后有通知。只是不知道如何使用操作输出参数来设置机会的链接。
【问题讨论】:
标签: javascript c# dynamics-crm crm