ui Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2014 05:34 AM
I created a UI Action to create a record from an incident and it works well. However, i would like to restrict the ui action from creating a record unless saved. I need help with a script that will only create the record by saving not loading. here is the script i used to create the ui.
var pla = new GlideRecord("u_incidents");
//pla.short_description = current.short_description;
pla.company = current.company;
pla.cmdb_ci = current.cmdb_ci;
pla.priority = current.priority;
pla.parent = current.sys_id;
var sysID = pla.insert();
//current.pla_id = sysID;
var mySysID = current.update();
gs.addInfoMessage("Incident " + pla.number + " to be created");
action.setRedirectURL(pla);
action.setReturnURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2014 03:59 AM
Your pla.insert() is saving the Record on to the Database, Lose that.
var pla = new GlideRecord("u_incidents");
pla.initialize(); // Add this line to your Code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2014 04:14 AM
Do not write any query to do this.
Use below code:
Open a Form with Preset Values
Navigating by URL - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2014 08:59 AM
Hi,
If you want your button to be visible only on Saved records, you need to uncheck "Show Insert" checkbox.
Please mark answer as correct/helpful if it was really helpful
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2014 08:48 PM