- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 11:13 PM
Hi All,
We need create a UI button named" create new" , if i click on that button i need a record to be created and saved in that table
for example :ABC is the table , in the form level i need button "create new" once i click that record should be created and saved in ABC table
thanks
sid
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 11:37 PM
You can create a UI action on that table, and you can set some fields data in newly created record if you want
var newRecord = new GlideRecord('your_table_name');
newRecord.initialize(); // Initialize a new record
newRecord.setValue('field_name', 'field_value'); // Set field values as needed
newRecord.insert(); // Insert the new record
action.setRedirectURL(current);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 11:19 PM
Hi @siddharth26
Here is a link to the ServiceNow docs on how to create a New UI Action https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/list-adminis...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 11:37 PM
You can create a UI action on that table, and you can set some fields data in newly created record if you want
var newRecord = new GlideRecord('your_table_name');
newRecord.initialize(); // Initialize a new record
newRecord.setValue('field_name', 'field_value'); // Set field values as needed
newRecord.insert(); // Insert the new record
action.setRedirectURL(current);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 12:42 AM
Hi Maddy,
thanks for the reply, could you please let me know what should write in condition in ui action and onclick in UI action
thanks
sid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 12:55 AM
Condition is used for button visibility.You can write your code in script part just below the condition.