UI Action - Not setting expected values - action.openGlideRecord(inc);

Jon S_
Giga Contributor

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?

7 REPLIES 7

Alok Das
Tera Guru

Kindly use the below code and give it a try:

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);
}

You missed a quotation in "tech_zone".

Hope now it will work.

Kindly mark my answer as Correct/Helpful based on the Impact.

Regards,

Alok

Jon S_
Giga Contributor

Hi Alok - Tried that and it still does not update. Thanks for the suggestion.

Is tech_zone a valid state value on incident table??


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Correct. I've also tried other values, OOB ones, and still nothing. That is why this is so weird. If you create an INC from the Incident table, it sets the value to 'phone' but if you create an INC from the Interaction record using the Create Incident UI Action (appears after assigned to is entered and state is WIP) then it sets the value to 'walk-in' but in the UI Action script, there is not line to set that value... somehow it gets defaulted to 'walk-in' if it comes from this UI Action. I added the line to try to set it but it is either completely ignoring it or overwriting it somewhere, somehow. It's got me baffled.