
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 09:45 PM
I want to be able to add a link next to the caller field on for example the Incident form, so when someone clicks on it the phone call will auto launch in our softphone.
I have already proven that if I have a link like this:
<a href="tel:5550080148">Call us at 555-008-0148</a>
The softphone will launch and try to call the number given, so what I'm looking for is how to auto populate the current callers phone number into the link eg:
<a href="tel:[current.sys_user.phone]">Call us at 555-008-0148</a>
Ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 10:28 PM
you should create UI macro and then associate it to the caller_id field
Steps below:
1) UI Macro
Name- show_phone_link
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedList('${ref}'); "
title="${gs.getMessage('Call phone')}" image="images/icons/tasks.gifx" icon="icon-phone"/>
<div id="myDiv"></div>
<script>
function showRelatedList(reference) {
var phone = g_form.getReference('caller_id').phone;
var url = 'tel:' + phone;
var mydiv = document.getElementById("myDiv");
var aTag = document.createElement('a');
aTag.setAttribute('href',url);
aTag.innerText = "Call us at 555-008-0148";
mydiv.appendChild(aTag);
}
</script>
</j:jelly>
2) update the dictionary as below for caller_id field
in the attributes section add this
To call UI Macro:-ref_contributions=show_phone_link
I have used Assigned to Field for example to show the Icon and link:
It shows the Phone icon
When user clicks on it it shows the link
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 10:00 PM
Hello,
Ref,
If answer is helpful please mark correct and helpful!
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 10:16 PM
Sorry, that just tells me how to make a tel link, which I already know. I want it to dynamically pick up the number of the user in the caller field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 10:28 PM
you should create UI macro and then associate it to the caller_id field
Steps below:
1) UI Macro
Name- show_phone_link
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_incidents_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}"
onclick="showRelatedList('${ref}'); "
title="${gs.getMessage('Call phone')}" image="images/icons/tasks.gifx" icon="icon-phone"/>
<div id="myDiv"></div>
<script>
function showRelatedList(reference) {
var phone = g_form.getReference('caller_id').phone;
var url = 'tel:' + phone;
var mydiv = document.getElementById("myDiv");
var aTag = document.createElement('a');
aTag.setAttribute('href',url);
aTag.innerText = "Call us at 555-008-0148";
mydiv.appendChild(aTag);
}
</script>
</j:jelly>
2) update the dictionary as below for caller_id field
in the attributes section add this
To call UI Macro:-ref_contributions=show_phone_link
I have used Assigned to Field for example to show the Icon and link:
It shows the Phone icon
When user clicks on it it shows the link
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2020 11:09 PM
Worked great thanks