The CreatorCon Call for Content is officially open! Get started here.

UI action to copy field values from another Table into a Form without saving

AnilM99
Tera Expert

Hi Team,

How to copy field values from the incident table to the RITM without saving using the Workspace UI action button.

I need to copy attachments using the same UI action.

 

Thanks,

Anil!

5 REPLIES 5

woodyfairley
Tera Guru

What I did may be helpful for you, I created a UI Action and selected client callable, then configured the script to do the following ( I hope this pseudocode exercise is helpful) put the server steps in a script include:

  1. create an array variable to contain the interesting field names of the existing record,
  2. create an array variable to collect the values of these interesting fields,
  3. perform a GlideRecord query to find the interesting record then collect the values,
  4. perform a .initialize and .insert GlideRecord to create a new record in your interesting table,
  5. perform a value assignment using the two array variables in a while or foreach logic,
  6. use a GlideRecord to query the sys_attachment table for interesting attachments,
  7. add the new record to the attachment record (or create a new sys_attachment record for your new record using .initialize and .insert GlideRecord activities),
  8. set the interesting record as your new redirect url value so that it is open and visible,

For us, the attachment encryption algorithms sometimes prevents the attachment copies as the security logic is complex and fragile so handling attachments in your instance may also require more research and testing.

If this is helpful, please mark it helpful.

Kind Regards,

Woody

 

Ankur Bawiskar
Tera Patron
Tera Patron

@AnilM99 

simply create server side UI action and populate the RITM associated with this INC.

You can use GlideSysAttachment.copy() to copy files from INC to RITM

what did you start and where are you stuck?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you Ankur, this was the segment I could not remember. Well done!

Kind Regards,

Woody

@AnilM99 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader