Clone Functionality
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2024 08:11 AM
Want to have a clone UI action kind of functionality where I will ask few field values in a UI page, and apart from those field values I want to copy the rest of the fields as it is.
I want to know how can I write a gliderecord query that will take in few fields as a user input and rest will be a copy from the current record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2024 02:07 AM
Could you please provide more details, what is your use case.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2024 02:46 AM - edited ‎06-18-2024 02:47 AM
You can use below script to copy all data from one record to another and override ui page fields as I mentioned in script.
Note : I have created example for incident, you can change table name based on your requirement.
var current=new GlideRecord("incident");
if(current.get("9e7f9864532023004247ddeeff7b121f")){
var grIncident=new GlideRecord("incident");
grIncident.initialise();
//Copu current record data to new record
for (var data in current){
grIncident[data]=current[data];
}
grIncident["ui_page_field_1"]="test 1";
grIncident["ui_page_field_2"]="test 2";
grIncident.insert();
}
Regards,
Abhijit
ServiceNow MVP