logo

NJP

ServiceNow - Outlook actionable messages (OAM) in embedded surveys - FIX

Import · Apr 21, 2022 · article

update on ServiceNow support ticket

had a zoom call and the servicenow engineer informed me that a code snippet was missing from the ServiceNow online documentation (ref: https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/survey-administration/task/embed-survey-in-outlook-email.html ) that needs to go in the notification:

in addition to,

need to add in:

${mail_script:asmt_assessment_instance_script}

(this loads:var html = new AssessmentUtils().getInstanceLinkHTML(current);

template.print(html);

)

it unfortunately hasn't resolved the issue so ServiceNow are continuing to investigate and advise

they have also made us aware of a few KBs:

https://support.servicenow.com/kb?id=kb%5Farticle%5Fview%5Fpopup&sysparm%5Farticle=KB0791126 https://support.servicenow.com/kb?id=kb%5Farticle%5Fview&sysparm%5Farticle=KB0750361

=======

further info from ServiceNow:

Solution proposed is : Hi Ruen, I hope you are doing well. It took me some time to set up the instance and surveys, but I was able to obtain a successful run on the first go from an in-house instance. Steps I followed to achieve this below: installed the OAM pluginin survey notification, added ${mail_script:include_survey_actionable} to notification messagein surveys, created a new survey and enabled (ticked) the Outlook Actionable Message check boxcreated a test trigger condition to trigger the survey (this however was not necessary - see step 6)publish the surveyassign the survey to user (this will trigger the survey notification regardless of trigger conditions) I referenced our Official Docs at the link below as well as few other resources (previously shared on this case) to validate the correct setup: https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/survey-administration/task/embed-survey-in-outlook-email.html KB0759780 https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0759780 When I received the notification, the whole body of the email was replaced with the actionable message and I was able to fill in the survey directly from my Outlook. For the purpose of this test I only added a mock question of type string to the actionable message which worked correctly. One thing I noticed is that the whole body of the actual notification was replaced by the actionable message. This happened because I added the mail script above (step 2) at the top of the body of the notification message. I tested this again after moving the script at the bottom and the body of the notification was displayed correctly, followed by the actionable message. Based on the successful execution above, other workarounds/solutions tried in this case can be ignored and the steps I shared with this message should be used instead. In other words, only the mail script is needed for a notification to contain the actionable message (found a total of 3 survey notifications in mojcppdev, none of which contains this script). Please let me know if the above is helpful or you have other questions I may assist you with. Should you need more guidance or would like to review the above together kindly consider sharing your availability to join me in a 30 mins Zoom session and we can go through the details on a call. If I was able to resolve your issue, please let me know by accepting the solution. Many thanks for your patience and collaboration. Best regards, Luca

Haven't tested these all recently within global/local scopes, so feel free to have a play! option 1 use an encoded query embedded in the GlideRecord , e.g. var grProf = new GlideRecord ( 'x_cls_clear_skye_i_profile' ); grProf . addQuery ( 'status=1^ owner=NULL ' ); grProf . query (); even better use the glideRecord addNotNullQuery or addNullQuery option 2 JSUtil.nil / notNil (this might be the most powerful. See this link ) example: if ( current . operation () == 'insert' && JSUtil . notNil ( current . parent ) && ! current . work_effort . nil ()) option 3 there might be times when you need to get inside the GlideRecord and perform the check there, for example if the code goes down 2 optional routes depending on null / not null can use gs.nil : var grAppr = new GlideRecord ( 'sysapproval_approver' ); var grUser = new GlideRecord ( 'sys_user' ); if ( grUser . get ( 'sys_id' , current . approver )){

Classic UI : var sURL_editparam = gs . action . getGlideURI (). getMap (). get ( ' sysparm_aparameter ' ); if ( sURL_editparam == 'true' ) { gs . addInfoMessage ( 'parameter passed ); } Portal : var sURL_editparam = $sp . getParameter ( " sysparm_aparameter " ); if ( sURL_editparam == 'true' ) { gs . addInfoMessage ( 'parameter passed ); }

Call a script include to apply a reference qualifier on a catalog item variable: - variable reference qualifier dependent on another variable selection, in this case a variable referencing sys_user (requested_for) On the catalog item form. variable name to apply ref qual filter : retail_equipment variable reference qualifier (on cmdb table ): javascript : new refqual_functions (). lostStolen_getAssignedCIs (); client-callable script include ( refqual_functions) function : lostStolen_getAssignedCIs : function (){ //--called from variable set client script, for lost/stolen request (service catalog) gs . log ( current . variables . requested_for , 'retail_lostStolen_getAssignedCIs' ); return ( 'install_statusNOT IN8,7owned_by=' + current . variables . requested_for ); //owned_by=1269b79937f1060041c5616043990e41install_statusNOT IN8,7 },

View original source

http://www.cloudminus89.com/2022/04/outlook-actionable-messages-oam-in.html