如何给SAP Cloud for Customer UI上的字段添加自定义校验逻辑

简介: 如何给SAP Cloud for Customer UI上的字段添加自定义校验逻辑

There is a good blog SAP Cloud for Customer Phone Number Parsing and Formatting which gives a detail explanation about the parse logic of phone number parse logic in C4C. By default it allows the Alphanumeric Value to be entered, the reason of this behavior is explained in note 2525818 – In an Account and Contact, the Phone Number Allows Alphanumeric Value.


However, at least in China, a valid mobile phone number only consists of pure numeric values. The requirement of local customer is whenever the value other than pure number is maintained, the error message will be popped up and the save is terminated.


The fulfilled scenario is: for example if I input an “A” character in Mobile field and press save button, error message is raised:image.pngHere below is how to achieve this custom validation logic in Cloud Application Studio.

Create an extension field phoneInvalidRel in BO BusinessPartnerRelationship, and declare the error message to be raised when invalid digit is detected.image.pngImplement BeforeSave event. This event is responsible to check whether the mobile phone number consists of pure numeric value and set the check result into extension field phoneInvalidRel, which will be used by onSave Validation later.image.pngImplement OnSave validation, and simply use the check result stored in extension field phoneInvalidRel.image.pngIn the runtime, when I enter “A” in mobile phone field and save, first the BeforeSave event is triggered,image.pngAnd then the onSave Validation is called.image.pngThe above implementation could only cover the scenario that end user directly changes the mobile phone number which is technically modelled in BO BusinessPartnerRelationship. There is another possibility that end user will also changes the field on Root node of BO BusinessPartner, as a result the same logic should be done again on BO BusinessPartner as well.image.pngBeforeSave implementation on BusinessPartner Root node:image.pngOnSave Validation on BusinessPartner Root node:image.png


相关文章
|
19天前
|
前端开发 开发者 C#
深度解析 Uno Platform 中的 MVVM 模式:从理论到实践的全方位指南,助你轻松掌握通过 C# 与 XAML 构建高效可维护的跨平台应用秘籍
【8月更文挑战第31天】本文详细介绍如何在优秀的跨平台 UI 框架 Uno Platform 中实施 MVVM(Model-View-ViewModel)模式,通过一个简单的待办事项列表应用演示其实现过程。MVVM 模式有助于分离视图层与业务逻辑层,提升代码组织性、易测性和可维护性。Uno Platform 的数据绑定机制使视图与模型间的同步变得高效简便。文章通过构造 `TodoListViewModel` 类及其相关视图,展示了如何解耦视图与模型,实现动态数据绑定及命令处理,从而提高代码质量和开发效率。通过这一模式,开发者能更轻松地构建复杂的跨平台应用。
26 0
|
1月前
|
JavaScript 前端开发
Vue实现Element UI框架的自定义输入框或下拉框在输入时对列表选项进行过滤,以及右键列表选项弹出菜单进行删除
本文介绍了如何在Vue框架结合Element UI库实现自定义输入框或下拉框,在输入时对列表选项进行过滤,并支持右键点击列表选项弹出菜单进行删除的功能。
26 0
|
2月前
|
数据安全/隐私保护
Element UI 密码输入框--可切换显示隐藏,自定义图标
Element UI 密码输入框--可切换显示隐藏,自定义图标
122 0
|
2月前
Element UI 【表格合计】el-table 实战范例 -- 添加单位,自定义计算逻辑
Element UI 【表格合计】el-table 实战范例 -- 添加单位,自定义计算逻辑
142 0
|
4月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
|
4月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
|
4月前
|
Web App开发 数据采集 前端开发
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
|
4月前
|
XML 存储 数据格式
SAP UI5 控件 customData 属性的应用介绍
SAP UI5 控件 customData 属性的应用介绍
|
4月前
|
前端开发 JavaScript API
SAP UI5 sap.ui.require.toUrl 的作用介绍
SAP UI5 sap.ui.require.toUrl 的作用介绍
|
4月前
|
搜索推荐
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版