UI Action - Not setting expected values - action.openGlideRecord(inc);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2019 10:58 AM
Hello. I'm trying to modify a UI Action to set a value when creating an INC from an Interaction record (Walk-Up Experience) and there seems to be something that I'm missing. What's weird is that it's not only not updating the new line to set the Contact Source but it's setting the value differently than our default value from just creating an INC from the INC table.
Here is the updated script from the 'Create Incident' UI Action on the Interaction table:
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.contact_type = tech_zone; //added to set contact source
inc.short_description = current.short_description;
action.openGlideRecord(inc);
}
I added tech_zone as a value on the Contact Source on the INC table. I've tried adding quotes as well, no luck.
What's weird is that when you run the UI Action from the Interaction table, it sets the Contact Source=Walk-In but if I'm on the Incident table and create an INC it sets the Contact Source, as expected, to Phone. I can't find anything on the INC table that would be making this determination.
Is there something else going on/mapping that is happening between this UI Action and the actual insert on the INC table?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2019 10:58 AM
Please navigate to the dictionary of the desired field and under the "Choice" related list please verify the value of the choice which you wish to get set, For example: OOB for state "On Hold" the value is "3".
I tested the above in my personal instance and it's working. Request you to please make sure you are entering the value of the choice not the label.
Kindly mark my answer as Correct/Helpful based on the Impact.
Regards,
Alok

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2019 11:25 PM
If I was able to answer your query, Kindly mark the answer as correct and close this thread from the unsolved queue.
Regards,
Alok Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2020 02:13 AM
Hello Jon S.,
A bit late, but I might have a solution which will hopefully help others experiencing the same issue.
If your column (in this case "contact_type" on the incident table) has a default value in the Dictionary Entry, it will use the default value rather than the value being set in the UI Action script. The solution is to add a GlideRecord insert() call before using action.openGlideRecord() in the UI Action i.e.:
if(current.update()){
var inc = new GlideRecord("incident");
inc.initialize();
inc.caller_id = current.opened_for;
inc.contact_type = "tech_zone"; //added to set contact source
inc.short_description = current.short_description;
inc.insert();
action.openGlideRecord(inc);
}
This will commit the values set in the UI Action script before opening the newly created Incident record, otherwise you will open a new record that uses defaults over the scripted values.
I hope this helps.
Regards,
Dean Page