+ Start a Discussion
Raouf Ben HassineRaouf Ben Hassine 

Create cookie readable from standard pages

Hello,

 

Is it possible to create a cookie from a VF page controller and have it be readable from triggers launched from standard pages?

For example, let's say we have a VF page named DemoPage with controller DemoController. There is an action on DemoController that when invoked creates a cookie named demo_cookie.

Now, a user submits a change on an account record. In the trigger for the account records I need to read demo_cookie.

I have my domain enabled for the organization.

Is there a way to make this happen?

Thanks

ShivankurShivankur (Salesforce Developers) 
Hi Raouf,

You can set cookies with help of Cookie Class:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_classes_sites_cookie.htm

Please follow the code example given over the standard documentation to implement according to your business logic.

Hope above information helps. Please mark as Best Answer so that it can help others in future.

​​​​​​​Thanks.