Create a button 'ADD' on the form using ui macros.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 02:36 AM
In my custom application I want to create a button ADD on the field caller, using Ui macros. please provide step by step way to create the action with xml .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2023 11:16 PM
what do you mean by Add/remove on reference field?
you can use onChange client script or UI policy to show/hide field based on another field
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 12:45 AM
Hi sir,
Actually, I created a custom application. In that I configured a reference field 'Approved By'. When I select an user I need to auto populate the user email also. I achieved this requirement by dot walking. And the task is to create buttons ADD and REMOVE on the reference field. A new user field has to create by click on the button ADD.
Note: can we achieve this requirement using Ui macros. If, Please help me in this requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 12:51 AM
but why to do this when you already have fields to show dot walked data?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:39 AM
Step1: creating a Custom application.
Step2: Configure a ref field(approved By) and email Field make to auto populate.
Step3: Create Buttons ADD and REMOVE. when we click on ADD button need to get the users list. and from the user list we can select required users. In the same way reverse action for REMOVE button(to remove the users).Using Ui macros can we achieve the requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 07:42 AM
If you want to add a Button next to a reference icon, I'd suggest you to use the ref_contributions attribute.
If instead, you want to have the Button on a separate column/row, you should do the following:
1.) Create a UI Macro (sys_ui_macro) and add a simple <button>CLICKME</button> to get started
2.) Create a UI Formatter (sys_ui_formatter), which references the UI Macro you just created
3.) Customize the Form you want to have the Button on, and add the UI Formatter there.
Example:
1.) UI Marco Example:
2.) UI Formatter Example:
3.) Add it to the form (task form for demo):
Example: