
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 09:38 AM
Hi Experts,
I'm using a UI action on a from to "copy" some of the fields and to new record that is to be created on a completely independent table.
Could anyone please help me with this?
Something like this I had in mind ... but missing the // CODE ??? part
****
function clickedReview() {
gsftSubmit(null, g_form.getFormElement(), 'action_name');
}
// Code that runs without 'onclick'
// Ensure call to server side function with no browser errors
if (typeof window == 'undefined')
createNew();
function createnew() {
// CODE ????
current.update();
gs.addInfoMessage(gs.getMessage("Record added"));
action.setRedirectURL(current);
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 09:48 AM
Hi,
You can use the below Script in your UI Action
Script:
var x= new GlideRecord("change_request"); //Replace your Desired Target Table
x.initialize();
x.short_description = current.short_description;
x.assignment_group='Enter Sys Id';
x.insert();
action.setRedirectURL(current);
gs.addInfoMessage('Record <a href ="/Table_Name.do?sysparm_query=number%3D' + x.number + '">'+ x.number +'</a>'+ 'has been created.');
Similarly you can have other fields as it has been mentioned for Short Description and Assignment Group. In the above screenshot Replace Demand with your Table Name on which you want this UI Action to be present on the form.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 09:48 AM
Hi,
You can use the below Script in your UI Action
Script:
var x= new GlideRecord("change_request"); //Replace your Desired Target Table
x.initialize();
x.short_description = current.short_description;
x.assignment_group='Enter Sys Id';
x.insert();
action.setRedirectURL(current);
gs.addInfoMessage('Record <a href ="/Table_Name.do?sysparm_query=number%3D' + x.number + '">'+ x.number +'</a>'+ 'has been created.');
Similarly you can have other fields as it has been mentioned for Short Description and Assignment Group. In the above screenshot Replace Demand with your Table Name on which you want this UI Action to be present on the form.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 09:53 AM
Try below
ta = new GlideRecord('table_name');
ta.fieldname1= current.fieldname1;
ta.fieldname2= current.fieldname2;
ta.fieldname3= current.fieldname3;
ta.fieldname4= current.fieldname4;
ta.insert();
action.setRedirectURL(ta);
Please mark this response as correct or helpful if it assisted you with your question.