How to pass field value from UI action to another form field value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 03:39 AM
Hi Team,
I have a requirement wherein when we click on a UI action it should open another form and copy the value in Contact field which is a reference field from current form to the new form of same field type.
Below URL is getting opened which is a new record creation form:
The redirecting is happening fine,its the copying of value of contact field from the current form to the same field type on new form I need to achieve.
Can you assist?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 03:46 AM
Hi @Community Alums
follow this link
https://www.servicenow.com/community/developer-forum/copying-field-within-ui-action/m-p/2808324
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 04:29 AM
Can you share the code you are using in the ui action?
Something like this should just work:
createCopy();
function createCopy() {
var newRecord = new GlideRecord("your_table");
newRecord.initialize();
newRecrod.contact = current.contact;
newRecord.insert();
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:16 PM - edited 06-20-2024 09:43 PM
Actually I do not need to insert record after routing to a new Page. I need to just copy the value after I click on UI Action.Below is the code wherein I am routing to the New record creation page. Now my requirement is once its routed to below URL as mentioned, it should copy the field value.
Say I am on Form A with a field called as 'Contact'. Once I click on UI action, it should copy the field value of 'contact' from Form A to same field type on 'Form B' .The new page which gets opened below is the New record creation page with some fields and the interested field is 'contact'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:52 PM
Thanks My issue is resolved by updating URL as