VTAP API:帮助开发人员无缝简化、检索和创新
VTAP API 提供强大的功能,使开发人员能够高效地检索、更新和管理数据,以及无缝地执行各种操作。
在本期中,我们为您提供以下示例:
使用 VTAP API 刷新记录以自动重新加载数据
使用 POST 或 PUT 方法更新记录详细信息时,更改不会自动显示在前端。这是因为这些方法会在服务器端更新数据,但除非明确指示,否则前端不会自动获取最新数据。为了确保更新的详细信息反映在前端,需要重新加载页面。
我们可以使用 VTAP API 动态刷新记录,而无需手动重新加载页面。
API: VTAP.详细信息.刷新记录();
计费示例:
VTAP.Api.Put('records', {module : ‘module_name’, id : ‘record_id’, field_name : ‘field_value’,}, (error, response) => { If (response) { VTAP.Detail.RefreshRecord(); VTAP.Utility.ShowSuccessNotification("Record Updated Successfully."); } });
VTAP.Api.Put('records', {
module : ‘module_name’,
id : ‘record_id’,
field_name : ‘field_value’,
}, (error, response) => {
If (response) {
VTAP.Detail.RefreshRecord(); VTAP.Utility.ShowSuccessNotification("Record Updated Successfully.");
}
});
文档参考链接: https://vtap.vtiger.com/platform/resources/vtap-js.html#vtap-detail-refreshrecord
使用 VTAP API 重新加载列表视图
当通过 VTAP API 从列表视图界面创建新记录时,列表视图不会自动刷新以显示新添加的记录。相反,用户必须手动重新加载页面才能查看最新数据。
VTAP API 动态刷新列表视图,无需手动重新加载页面。
API: VTAP.列表.重新加载();
VTAP.Api.Post('records', {module : 'Contacts', firstname : 'John',lastname : 'Wick', 'email' : '[email protected]'}, (error, response) => { If (response) { VTAP.Utility.ShowSuccessNotification("Record Created Successfully."); VTAP.List.Reload(); }});
VTAP.Api.Post('records', {
module : 'Contacts',
firstname : 'John',
lastname : 'Wick',
'email' : '[email protected]'
VTAP.Utility.ShowSuccessNotification("Record Created Successfully.");
VTAP.List.Reload();
文档参考链接: https://vtap.vtiger.com/platform/resources/vtap-js.html#reload
使用 VTAP API 检索当前登录用户的用户角色详细信息
可以使用 VTAP API 来检索当前登录用户的详细信息。此 API 可检索用户详细信息,例如个人信息、偏好或系统相关数据。
该API返回的信息中,特别关注用户的角色详情。
通过使用此API,开发人员可以无缝集成用户特定的功能,并根据用户的角色确保适当的授权和个性化的体验。
API 网址: “我”
VTAP.Api.Get('me', {'module': 'Users'}, (error, response) => {If (response) {const roleInfo = response.roleid; console.log(roleInfo.id); // Logs the role ID console.log(roleInfo.label); // Logs the role name}});
VTAP.Api.Get('me', {
'module': 'Users'
const roleInfo = response.roleid;
console.log(roleInfo.id); // Logs the role ID
console.log(roleInfo.label); // Logs the role name
使用 VTAP API 检索特定用户的角色详细信息
您可以通过提供用户 ID 作为参数,使用 VTAP API 检索特定用户的角色信息。
VTAP.Api.Get('records', {'module': 'Users',‘Id’: ‘user_id’}, (error, response) => {If (response) {const roleInfo = response.roleid; console.log(roleInfo.id); // Logs the role ID console.log(roleInfo.label); // Logs the role name}});
VTAP.Api.Get('records', {
'module': 'Users',
‘Id’: ‘user_id’
注册以接收最新更新!
我已阅读 私隐政策 Vtiger。