Teams: Using Virtual Agent Actionable Approval Notification with non-global scope throws error

David Pridemor1
Tera Expert

Wanted to post this in case someone else runs across this in the future.

 

This applies to rendering approval notification details in Teams (when the user clicks 'Show details). If you're seeing the following error:

org.mozilla.javascript.JavaScriptException: Unsupported Card Template: card

 

It's because of this line of code in the "Show Approval Details" virtual agent activity (which you have to duplicate to work with because it's read-only.)

 

    return vaSystem.renderCard("card", data);

 

The affected line is on line 101 of the display custom fields scripted action:

DavidPridemor1_0-1723065729037.png

The adapter invoked by that activity does not have a "card" type. It also doesn't do any string normalization.

DavidPridemor1_1-1723065778074.png

 

You have to change the affected line from "card", to "Card" for it to match the GENERAL_CARD constant in the adapter script and for it to render properly:

 

 

 

// return vaSystem.renderCard("card", data); // This will not work
// There is no "card" in the transform method of VACommonCardAdapter
// It has to be capitalized to match the GENERAL_CARD constant for output in Microsoft Teams

// This is the working code for Microsoft Teams.
return vaSystem.renderCard("Card", data);

 

 

Including the full stack trace for search engine indexing when I inevitably forget about this and need to find it again:

JavaScript evaluation error on:(function execute(inputs, outputs) { var LOGGER = new sn_va_teams.VAMSTeamsLogger('VAMSTeamsAdapterCardOutboundTransformer'); try { LOGGER.debug("Teams Card Outbound Transformer Inputs:{0}", JSON.stringify(inputs)); var inputBuilder = new sn_va_adapter.VACommonInputBuilder(inputs, LOGGER); var cardHelper = new sn_va_teams.MSTeamsCardOutboundHelper(inputBuilder); var commonCardAdapter = new sn_va_adapter.VACommonCardAdapter(cardHelper, inputBuilder); outputs.result = commonCardAdapter.transform(); LOGGER.debug("Teams Card Outbound Transformer Outputs:{0}", JSON.stringify(outputs)); } catch (e) { LOGGER.error("Error in default card outbound transformer : ", e); throw e; }})(inputs, outputs);: org.mozilla.javascript.JavaScriptException: Unsupported Card Template: card (Process Automation.ee6aba0f538210102f40ddeeff7b12dc; line 12): org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1248) org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1030) org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:161) com.glide.caller.gen.Process_Automation_ee6aba0f538210102f40ddeeff7b12dc.call(Unknown Source) com.glide.script.ScriptCaller.call(ScriptCaller.java:22) org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160) org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:3058) org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2981) org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1720) org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1030) org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:161) com.glide.caller.gen.Process_Automation_ee6aba0f538210102f40ddeeff7b12dc.call(Unknown Source) com.glide.script.ScriptCaller.call(ScriptCaller.java:22) org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160) org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:725) org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:4024) org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173) com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:412) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:223) com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:141) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:364) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:251) com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:230) com.snc.process_flow.operation.GlidePFScriptEvaluator.runScript(GlidePFScriptEvaluator.java:49) com.snc.process_flow.operation.script.ScriptOperationBase.runScript(ScriptOperationBase.java:50) com.snc.process_flow.operation.script.ScriptOperation.run(ScriptOperation.java:75) com.snc.process_flow.engine.Operation.execute(Operation.java:208) com.snc.process_flow.engine.restricted_caller_access.ExecuteWithCallerAccessTracking.executeWithMetaStack(ExecuteWithCallerAccessTracking.java:21) com.snc.process_flow.engine.ProcessEngine.executeOps(ProcessEngine.java:647) com.snc.process_flow.engine.ProcessEngine.runInternal(ProcessEngine.java:544) com.snc.process_flow.engine.ProcessEngine.run(ProcessEngine.java:521) com.snc.process_flow.engine.ProcessEngine.runWithExecutionResult(ProcessEngine.java:535) com.snc.process_flow.engine.ProcessAutomation.runWithExecutionResult(ProcessAutomation.java:113) com.snc.process_flow.engine.QuickProcessAutomation.run(QuickProcessAutomation.java:323) com.snc.process_flow.engine.QuickProcessAutomation.runFlow(QuickProcessAutomation.java:193) com.snc.process_flow.engine.QuickProcessAutomation.runFlow(QuickProcessAutomation.java:178) com.glide.plan.runners.FlowObjectExecutor.executeInternalQuick(FlowObjectExecutor.java:162) com.glide.plan.runners.FlowObjectExecutor.lambda$executeQuick$1(FlowObjectExecutor.java:66) com.glide.sys.Transaction.executeWithTimeout(Transaction.java:3358) com.glide.plan.runners.FlowObjectExecutor.executeQuick(FlowObjectExecutor.java:66) com.glide.plan.runners.FlowObjectAPI.executeQuick(FlowObjectAPI.java:132) com.glide.plan.runners.FlowObjectAPI.executeQuick(FlowObjectAPI.java:117) com.glide.cs.qlue.module.custom.CustomAdapterIntegrationHubServiceImpl.invokeAction(CustomAdapterIntegrationHubServiceImpl.java:47) com.glide.cs.qlue.module.custom.CustomAdapterServiceImpl.transformResponse(CustomAdapterServiceImpl.java:929) com.glide.cs.qlue.module.custom.CustomAdapterServiceImpl.getMessage(CustomAdapterServiceImpl.java:664) com.glide.cs.qlue.module.custom.CustomAdapterServiceImpl.sendMessages(CustomAdapterServiceImpl.java:422) com.glide.cs.qlue.module.coma.MessageBatchingSession.sendAll(MessageBatchingSession.java:225) com.glide.cs.qlue.module.coma.MessageBatchingSession.send(MessageBatchingSession.java:163) com.glide.cs.qlue.module.coma.MessageSender.send(MessageSender.java:276) com.glide.cs.qlue.module.coma.MessageServiceImpl.sendMessage(MessageServiceImpl.java:601) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.onPrompt(QuestionAnswerInteraction.java:1423) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.handleFieldState(QuestionAnswerInteraction.java:878) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.processField(QuestionAnswerInteraction.java:811) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.askInfoAboutFld(QuestionAnswerInteraction.java:553) com.glide.cs.qlue.module.taco.TaskStateManager.onGatherData(TaskStateManager.java:321) com.glide.cs.qlue.module.taco.TaskStateManager.executeStep(TaskStateManager.java:222) com.glide.cs.qlue.module.taco.TaskStateManager.execute(TaskStateManager.java:195) com.glide.cs.qlue.module.taco.TaskStateManager.initialize(TaskStateManager.java:396) com.glide.cs.qlue.module.taco.TaskImpl.initialize(TaskImpl.java:193) com.glide.cs.qlue.module.taco.ConversationImpl.initializeTask(ConversationImpl.java:433) com.glide.cs.qlue.module.taco.ConversationImpl.initializeTask(ConversationImpl.java:415) com.glide.cs.qlue.module.taco.ConversationImpl.initTopic(ConversationImpl.java:1477) com.glide.cs.qlue.module.taco.ConversationImpl.pushTopicOnStack(ConversationImpl.java:1663) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.askInfoAboutFld(QuestionAnswerInteraction.java:579) com.glide.cs.qlue.module.taco.TaskStateManager.onGatherSingleData(TaskStateManager.java:328) com.glide.cs.qlue.module.taco.TaskStateManager.onGatherData(TaskStateManager.java:317) com.glide.cs.qlue.module.taco.TaskStateManager.executeStep(TaskStateManager.java:222) com.glide.cs.qlue.module.taco.TaskStateManager.execute(TaskStateManager.java:195) com.glide.cs.qlue.module.taco.TaskImpl.execute(TaskImpl.java:197) com.glide.cs.qlue.module.taco.QuestionAnswerInteraction.receive(QuestionAnswerInteraction.java:251) com.glide.cs.qlue.module.taco.ConversationImpl.receive(ConversationImpl.java:517) com.glide.cs.qlue.module.coma.RichControlMessageProcessor.receiveControl(RichControlMessageProcessor.java:347) com.glide.cs.qlue.module.coma.RichControlMessageProcessor.receiveControl(RichControlMessageProcessor.java:267) com.glide.cs.qlue.module.coma.RichControlMessageProcessor.process(RichControlMessageProcessor.java:237) com.glide.cs.qlue.module.coma.MessageServiceImpl.processMessage(MessageServiceImpl.java:636) com.glide.cs.qlue.module.coma.MessageServiceImpl.receiveMessage0(MessageServiceImpl.java:328) com.glide.cs.qlue.module.coma.MessageServiceImpl.receiveMessage(MessageServiceImpl.java:194) com.glide.cs.qlue.module.coma.MessageServerMessageHandler.handleConsumerTextMessage(MessageServerMessageHandler.java:130) com.glide.cs.qlue.module.coma.MessageServerMessageHandler.handleMessage(MessageServerMessageHandler.java:55) com.glide.cs.qlue.module.custom.CustomAdapterServiceImpl.sendInboundMessage(CustomAdapterServiceImpl.java:754) com.glide.cs.qlue.module.worker.CustomAdapterRequestProcessor.continueConversation(CustomAdapterRequestProcessor.java:1045) com.glide.cs.qlue.module.worker.CustomAdapterRequestProcessor.process0(CustomAdapterRequestProcessor.java:523) com.glide.cs.qlue.module.worker.CustomAdapterRequestProcessor.process(CustomAdapterRequestProcessor.java:379) com.glide.cs.qlue.module.worker.Processor.lambda$process$3(Processor.java:211) com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35) com.glide.cs.qlue.module.worker.Worker$TransactionExecutor.execute(Worker.java:311) com.glide.cs.qlue.module.worker.Processor.process(Processor.java:211) com.glide.cs.qlue.module.worker.Processor.processMessageContext(Processor.java:71) com.glide.cs.qlue.module.worker.Worker.lockAndProcessMessage(Worker.java:242) com.glide.cs.qlue.module.worker.Worker.processMessage(Worker.java:178) com.glide.cs.qlue.module.worker.Worker.run(Worker.java:141)

0 REPLIES 0