I'm trying to understand how to pass a variable from the "Client controller" field to the "Body HTML template" on a Header | Footer (sp_header_footer) record. We have a widget embedded in a lot of pages so we just created the widget and then added it like this:
HTML Body template field:
<div>
<widget id="widget" options='{"button_color":"#F6A700", "home_page_id":"sysid"}'></widget>
</div>
What I'm trying to do is, instead of passing that object into the options, I want to make it dynamic so I can get the info of those variables dynamic via server->client->HTML
Trying to do this:
HTML Body template field:
<div>
<widget id="widget" options='{c.options.obj}'></widget>
</div>
Client Controller field:
api.controller=function() {
/* widget controller */
var c = this;
c.options.button_color = "#F6A700";
c.options.obj = {
"button_color":c.options.button_color,
"portal_page_id": c.options.sys_id
};
};
But I can't get it to receive this information inside the widget itself, and since the widget is scope blocked, I really need to retrieve that info on this record, since it's on the Global scope. Can someone help me, please?
Best regards!