Retrieve Object Type from Serverless function of a Custom CRM Card

Hi,

I’m develping a Custom CRM Card and it requires to pass the Object Type in to the Card’s serverless function. But, still I couldn’t find a way to retrieve the object type from the serverless function context.

serverless.json file

crm-card.json

crm-card.js

exports.main = async (context, sendResponse) => {
 const { hs_object_id } = context.propertiesToSend;

 sendResponse({
 sections: [
 {
 type: 'button',
 text: 'Open',
 onClick: {
 type: 'IFRAME',
 width: 1300,
 height: 748,
 uri: `https://example.com/media?hsObjectType=<PASS_HERE>`,
 },
 },
 ],
 });
};

Needs to pass the object type in to the crm-card.js file.

Hello @RandikaDissa

I think object type is passed to the serverless function in the properties To Send context variable.

Try changing the send Response function to this

sendResponse({
 sections: [
 {
 type: 'button',
 text: 'Open',
 onClick: {
 type: 'IFRAME',
 width: 1300,
 height: 748,
 uri: `https://example.com/media?hsObjectType=${objectType}`,
 },
 },
 ],
});

This will pass the object type to the URL of the iframe, so that the iframe knows what type of object to display.

For better you can check this: Accounts Dashboard | HubSpot