Servicenow 服务门户,为自定义小部件中的表单小部件创建“保存”按钮
我目前有一个自定义门户,其中包含自定义版本的表单小部件,该小部件没有任何 UI 操作(包括 OOTB)。
我们还有一个自定义小部件(我们称之为“操作小部件”),我们可以在其中控制记录中需要执行的所有操作。
目前,我需要在操作小部件内创建一个“保存”按钮,用户在填写表单后可以单击保存按钮来更新记录。
我无法找到任何方法让这个按钮起作用。键盘快捷键“CTRL + S”工作正常,但我不知道该快捷键调用什么类型的函数和/或方法。
如果这太复杂或不可能,我还可以一一获取字段(字段不多)并使用该信息更新记录。
你们能帮我吗?
先感谢您。
I currently have a custom portal with a custom version of the form widget that doesn't have any UI Actions (OOTB inclusive).
We also have a custom widget (let's call it "actions widget") where we control all the actions we need to take in the record.
Currently I need to create a "Save" button inside the actions widget where the user, after filling the form, can click on the save button to update the record.
I am unable to find any way to make this button work. The keyboard shortcut "CTRL + S" works perfectly but I have no idea what type of functions and/or methods this shortcut calls.
If this is too complicated or not possible I can also fetch the fields one by one (there is not a lot of them) and update the record with that information.
Can you guys assist me with this?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望回答这个问题对其他人有帮助,我将概述您需要如何解决这个问题。大致的轮廓是,您的“表单”小部件需要通过具有如下块来接受消息:
如果您想在控件小部件中具有多个按钮,则可以具有多个具有不同消息名称的处理程序,或者一个处理程序具有不同的参数。
然后,在您的控制小部件中,您需要让每个按钮通过命令(同样在客户端脚本中)发送一条消息,例如:
还有其他方法来处理它(将两个小部件嵌入到第三个小部件中,并使用 $例如,该小部件的范围而不是 $rootScope),但这是最简单的。
In the hope that answering this will be helpful to others, I'll sketch out how you would need to approach this. The broad outline is that your "form" widget needs to accept a message by having a block like:
If you want to have several buttons in your control widget, you can have multiple handlers like that, with different message names, or one handler with different parameters.
Then, in your control widget, you will need to have each button send a message through a command (again, in the client script) like:
There are other ways to handle it (embedding both widgets in a third widget, and using the $scope of that widget instead of $rootScope, for instance), but this is the simplest.