如何使用 Cloud for Customer里的ABSL代码调用Web service
需求:在C4C UI里创建web service(maintain ticket),然后通过ABSL代码消费。
1. 创建一个新的Communication Arrangement
基于Manage Tickets这个标准的Communication Scenario创建一个Communication Arrangement:
因为我是在当前C4C系统上的ABSL里调用当前C4C系统提供的Web Service,所以Communication System选择Local:
当然这个Local的communication system也是需要在这个地方自己创建一个的:
Authentication method可以维护成"User ID and Password", 给该创建的arrangement维护communication user的password:
将该Arrangement的WSDL下载到本地。
2. 在Cloud Studio里创建一个新的External Web Service Integration:
将第一步下载的WSDL文件夹加载进去:
点击finish,在Studio里能看到自动生成了两个文件。
双击.csd(communication scenario definition), 将Communication Type改为A2X改为:
切换到Services tab, 选择Custom Outbound Services->JerryTicket2->MaintainBundle
激活之后,在Communication Scenario的列表里也能看到JerryTicket2这个communication scenario了。
3. 基于前一步创建的communication scenario JerryTicket2创建一个Communication arrangement。至此C4C配置完成。
ABSL代码如下:
import ABSL;
import AP.CRM.Global;
import AP.Common.GDT;
var ticketReq: JerryTicket2.MaintainBundle.Request;
var SerReq : JerryTicket2.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest ;
var SrvReqItem : JerryTicket2.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.Item;
SerReq.actionCode = "06";
SerReq.ID = this.ID;
var counter = 0;
while(counter < 500)
{
SrvReqItem.actionCode = "01"; //Create Item
SrvReqItem.Description.content = "Add item from WS" ;
SrvReqItem.ProductID.content = "P120100";
SrvReqItem.RequestedQuantity.content = 1.0;
SrvReqItem.RequestedQuantity.unitCode = "EA";
SrvReqItem.UserServiceTransactionProcessingTypeCode = "SRP0";
SerReq.Item.Add(SrvReqItem);
counter = counter + 1;
}
ticketReq.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.Add(SerReq);
var response = Library::JerryTicket2.MaintainBundle(ticketReq,"","JerryTicket2");
CRM, C4C和Hybris的工作流简介
CRM的例子
Step by Step to debug IC inbox workflow WS14000164
C4C
-
Custom recipient determination in workflow rule done on Account BO
-
Automatically send an Email notification to line manager via Workflow in Account application
Hybris
Hybris workflow的框架实现代码在这个folder里:
而应用层面使用的workflow,和ABAP workflow一样有所谓workflow template的概念。下图是ABAP workflow template的一个例子:
Hybris workflow:
也是通过impex定义的:
impex 中包括 WorkflowTemplate, WorkflowActionTemplate, WorkflowDecisionTemplate, WorkflowActionTemplateLinkTemplateRelation 这四种类型的model
1. 一个workflow至少有3三 种类型(start/normal/end)的 action
2. 一个action最少有一种decision
3. 一个decision 可以通过 WorkflowActionTemplateLinkTemplateRelation 链接到下一个action上 直到结束节点 end.
创建workflow及触发decision:
public void autoCreateWorkFlow(PrincipalModel principal, KeyInfoModel info) {
validateParameterNotNull(principal, "principal model cannot be null");
UserModel admin = userService.getUserForUID(ADMIN_CODE);
WorkflowTemplateModel workflowTemplate = workflowTemplateService.getWorkflowTemplateForCode(workflowTemplateCode);
//create a new workflow for given workflowtemplate
final WorkflowModel workflow = workflowService.createWorkflow(workflowTemplate, admin);
//add attachment for workflow
final WorkflowItemAttachmentModel attachment = modelService.create(WorkflowItemAttachmentModel.class);
AbstractOrderEntryModel orderEntry = info.getOrderEntry();
attachment.setItem(info.getOrderEntry());
attachment.setWorkflow(workflow);
attachment.setCode(orderEntry.getPk()+"_OrderEntry");
this.modelService.save(attachment);
this.modelService.refresh(attachment);
workflow.setAttachments(Collections.singletonList(attachment));
workflowProcessingService.startWorkflow(workflow);
this.autoDoStartDecision(workflow, admin);
}
- 点赞
- 收藏
- 关注作者
评论(0)