Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

I added a related list declarative action Submit, the button does not work

Siris
Tera Contributor

How to add functionality to the button using server script or client script, so that it updates the record state from pending to submitted.

9 REPLIES 9

Ankur Bawiskar
Tera Patron

@Siris 

basically you want Related List action which updates State for selected records?

if yes then did you check any OOTB Related List actions how they are doing

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Siris 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

sivasankaris
Tera Guru

Hi @Siris 

You can achieve this using a UI Action — that’s the cleanest and recommended way.

Go to System Definition → UI Actions and create a new one on your table.

  • ✔ Check Form button

  • ✔ Set a condition like: current.state == 'pending'

Then in the Script section (server-side):

current.state = 'submitted';
current.update();
gs.addInfoMessage("Record submitted successfully.");
action.setRedirectURL(current);
 

That’s it 😊

When the button is clicked, it will securely update the record from Pending → Submitted.

 

If this works, please mark it as helpful and please accept my solution..

@sivasankaris, I want it in workspace list view.  A simple serverscript works, but i also want the logic thats used in OOB UI action also in the workspace.  The condition part fails as of now.