The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Create tasks from form onsubmit

allen_pitts
Giga Expert

Hello implement community,

 

A new server request has been implemented in the Service Catalog.

To get new server requests out of the emails and hallway conversations

the Service Catalog item was kept simple so it could be implemented

immediately. Right now the Service Catalog item creates a Request,

a Request Item, a Notification and a Request Task.

 

The task and notification goes to the engineer that coordinates new servers   who

then uses an application developed for this purpose called Operational

Projects or Ops Projects. The engineer creates nine tasks associated

with the Ops Project.

 

The tasks would be created from the OnSubmit event at the Ops Project

form when the field labeled 'Project Type' equals "New Server'.

Business rule condition
u_ops_project.u_project_type.indexOf("New System") == 0

Several of the fields from the Ops Project form will auto populate

in the Ops Projects Tasks.

 

If the Sys Admin training is remembered correctly, the way to get the
tasks created by the system would be a business rule as opposed to a client script

because the script must run at the server to create the tasks.

Any tips, tricks or pitfalls? Syntax for creating tasks in business rule?

Thank

 

Allen Pitts
LHP Hospital Group

1 ACCEPTED SOLUTION

domaners
Kilo Guru

Personally I would recommend using a Workflow to handle this type of activity, as you can template your individual tasks without the need for using code. However, if you do need to script these events, use a Glide Record to create the tasks. Article:



GlideRecord - ServiceNow Wiki



Cheers, Adam


View solution in original post

10 REPLIES 10

Allen,



It should be in there. Try going to System Logs > Script Log Statements and searching for it there. Be aware, there will be LOTS of entries here so filter accordingly.


SN.PNG


I just tested it on a Demo instance and found it there.


SN.PNG


Uncheck the "Client callable" field, as this may be stopping your business rule from running. The client callable field is only required for Global business rules that would get called from a client action, for instance a list filter.


Hello Adam,



Thanks.
That made it work.



Allen Pitts
LHP Hospital Group


Didn't notice the Client Callable...my bad.


Hello Derek



Your input is appreciated.



Allen Pitts