Hi, Newbie here trying to develop a basic custom app in freshsales that will pass some contact details to a webpage. I’ve followed the guides, created an app with FDK and tried some of the how to’s but without any luck.
I have a module working in the contacts menu, the index.html page loads and i can call the app.js script, however i can’t seem to get the data context and output anything to do with the current contact record.
here’s a breakdown of my simple code - hoping someone can help explain where it’s going wrong.
Manifest
{
“platform-version”: “3.0”,
“modules”: {
“common”: {
“requests”:{
}
},
"contact": {
"location": {
"contact_entity_menu": {
"url": "index.html",
"icon": "styles/images/icon.svg"
}
}
}
},
“engines”: {
“node”: “18.20.1”,
“fdk”: “9.7.1”
}
}
Contact InfoIndex.html
Contact Info
<script src="scripts/app.js">
// “app” is provided by “fresh_client.js”
app.initialized().then( async function (client)
{
let appClient = client;
document.getElementById(“output”).innerText = appClient
}
</script>
App.js
async function getCurrentEntityInfo() {
try {
const data = await client.data.get(“currentEntityInfo”);
// success output for contact
// data: { “currentEntityInfo”: { “currentEntityId”: 12, “currentEntityType”: “contact”}}
document.getElementById(“output”).innerText = data
console.log(data);
} catch (error) {
// failure operation
console.error(error);
document.getElementById(“output”).innerText = error
}
}
getCurrentEntityInfo();