- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 01:57 AM
I have done Servicenow to Whatspp integration :
I have randomly chosen the Use case : I have created a UI macro and placed beside the caller field of incident form.When anyone click on whatspp icon it redirect to selected caller whatspp and send a incident details to him/her.
But I want to show whatspp icon on change of caller field.
Below is my code.
Can someone Please help me?
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<a><img src="whatsppicon.png" width="70%" height="70%" onclick="whatsppWindow('${ref}')"></img></a>
<script>
function whatsppWindow(reference)//incident.caller_id
{
var demotext;
var mob;
var incSysid = g_form.getUniqueValue();
alert(incSysid);
var refVal= reference.split('.');
var fieldName=refVal[1];
var sysId=g_form.getValue(fieldName);//Get caller Sys_id
var user=new GlideRecord('sys_user');
if(user.get(sysId))
{
mob=user.mobile_phone.toString();
}
var incident=new GlideRecord('incident');
if(incident.get(incSysid))
{
demotext = "Hi " + user.first_name + ",\nYour Incident Number is: " + incident.number + '\nYour Issue Description is: ' + incident.short_description;
}
mob=mob.replace(/[^0-9]+/gi,'');
if(mob)
{
open('https://wa.me/'+mob+'?text='+encodeURIComponent(demotext),'_top');
}
}
</script>
</j:jelly>​
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 02:56 AM
let the icon be there always and anyhow based on what value is present in the field the same will be picked up in the UI macro
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 02:56 AM
let the icon be there always and anyhow based on what value is present in the field the same will be picked up in the UI macro
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 02:59 AM
Thanks for the Suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 03:05 AM
@Ankur Bawiskar
Can you suggest me more use cases on servicenow to Whatspp integration?
Regards
Tejas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 03:13 AM
I haven't implemented it for any customer, so cannot share any.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader