How to get previous record details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:18 AM
Hello Community,
we have custom UI action in custom application "Copy Required Fields" and if we click the UI action we want redirect to new record and need to copy previous values to new record and it's should not save and we already aware we placed the logic in Script include and send the information to client side through on click function.
We are looking the way how to send previous record to server side so that we will add remaining logic to pull and populate required field details in new record
and also once we click the UI action it' should be redirected new record in same window without saving
It would be great help if anyone provide guidance for this.
Thanks,
Nagesh
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:22 AM
Hi,
Try adding below script in your UI Action and modify field names according to your requirement.
var newRec = new GlideRecord(current.getTableName());
newRec.newRecord();
newRec.short_description = current.short_description;
newRec.description = current.description;
newRec.update();
action.setRedirectURL(newRec);
And below is the example of Copying current record without Insert().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:28 AM
Thanks for the response ankur and we are looking the way to place the logic in client &server side.In future we will get request to add more fields to copy in new record.
Thanks,
Nagesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:39 AM
Hi,
For that may be you can make some custom logic like "Copy Change" functionality.
For that there is a property where whatever the fields are required to be copied can be put, And whatever the fields are present in the property gets copied for the "Copy Change" functionality. May be you can refer the OOTB Copy Change functionality and build your custom solution like that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 04:45 AM
Something like below image:
You can make you custom property and put the attributes of your custom table from where you want to copy.
Now Glide the property where you will check what fields you have to copy and pass them to you copy code instead of hardcoded fields.
By using this if in future you need to add some more fields then you can add them in the property instead of modifying the code.
Please mark correct if it helps you to build your logic.