'How to Read and update custom field in Marketo

I need to build a voting system in Marketo. Similar to this page

Here I don't want any form submission to take place. I just want to update some specific custom fields with vote count on clicking voting button.

Here is my plan and you can suggest if any better execution plan if you have

Step 1 - Since we are not taking email address, we will create one dummy email address and update all voting count to this contacts custom field. Please note this is purely for voting count and nothing else.

Step 2 - read the custom field values before submitting the new value using below rest API

https://Marketo-end-point-url/rest/v1/leads.json?filterType=id&filterValues=<dummy_email_address_id>&access_token=&fields=Customfield1, Customfield2, Customfield3

Here I am not sure whether we can show access_token in landing page source code or in jQuery files. It might lead to data hack. open for suggestions.

Step 3 - After reading the Customfield data, increment the count by "+1" and update it using rest api.

Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source