- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 10:18 PM
I would like to create a UI action like the one below and implement a spec that sets the value by default when creating a new record.
However, when I execute a UI action on the record list screen, a "No records selected" popup is output.
Can you tell me the UI action to create a new record?
var new_rec = new GlideRecord("table_name");
new_rec.initialize();
new_rec.setValue("field_name1","value1");
new_rec.setValue("field_name2","value2");
new_rec.setValue("field_name3","value3");
action.setRedirectURL(new_rec);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:07 PM
var new_rec = new GlideRecord("table_name");
new_rec.initialize();
new_rec.setValue("field_name1","value1");
new_rec.setValue("field_name2","value2");
new_rec.setValue("field_name3","value3");
action.openGlideRecord(new_rec);
The above code solved it!
I didn't use it because I thought that ".insert ()" would save the record.
I was also considering closing the record without saving it.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:39 PM
Thank you for both of you.
I couldn't explain my requirements.
Immediately after clicking the "New" button, I wanted to display the new record screen on the screen without saving the record.
I also wanted to set the field value of the new record displayed on the screen to the same value as the default value.
I created a new UI action to avoid the specification that the value is forcibly set even if it is left blank when the default value is set.