copy story with confirmation

Prakash_S
Tera Contributor

I have one ui action called "Copy Story" which make a copy of exiting story, now i want user consent to say yes then it should copy. if they says no, dont do anything.

I tried like below but not working.

function callMe(){
	var conf = confirm('Are you sure?');
	if(conf)
	gsftSubmit(null, g_form.getFormElement(), 'sysverb_copy_story');
}
1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @Prakash_S ,

 

Try doing like below.

function callMe(){
	var conf = confirm('Are you sure?');
	if(conf)
	gsftSubmit(null, g_form.getFormElement(), 'sysverb_copy_story');
}

if(typeof window == 'undefined')
runServerSideCode();

function runServerSideCode(){
//your server side code goes here
}

 

Also make sure below.

  1. Client checkbox has been checked.
  2. You have used correct form action name "sysverb_copy_story".

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

3 REPLIES 3

Runjay Patel
Giga Sage

Hi @Prakash_S ,

 

Try doing like below.

function callMe(){
	var conf = confirm('Are you sure?');
	if(conf)
	gsftSubmit(null, g_form.getFormElement(), 'sysverb_copy_story');
}

if(typeof window == 'undefined')
runServerSideCode();

function runServerSideCode(){
//your server side code goes here
}

 

Also make sure below.

  1. Client checkbox has been checked.
  2. You have used correct form action name "sysverb_copy_story".

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

It got resolved @Runjay Patel , Thanks for your prompt reply.

UI Action name was incorrect after changing it to "sysverb_copy_story2" it worked.

Ankur Bawiskar
Tera Patron
Tera Patron

@Prakash_S 

please share your existing UI action code to help you better

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