I am completely new on this topic! In Salesforce I've created a custom button that links to the following site: https://studio.dashboard.mdl.io/api/Report/GetReportView?rn=contact-management-redshift&ai=679&si=105612&token=dd06fc87-7247-42e5-bc26-208e180a322e

I am not worried about first two items(ai=679&si=105612) since they can be hard coded but the token expires after 2 hours, I do have the PHP code to get the new token but I don't know how to modify or edit the button to get the refresh or get the new token.Would you please advise!

  • Store them in a custom setting
    – Eric
    Apr 22 '17 at 7:58

There are several ways to accomplish this. All the ways require some sort of Salesforce side code. I am not sure how much you are aware of that.

  1. You could create a visualforce page in Salesforce which will open after clicking of button, This page will have an option to refresh the token and after refreshing the token you could store somewhere in custom setting, then you can open the above link.

  2. The other way is creating a batch process which will run in every 2 hour to get the token from your PHP site. It will store this token in custom setting, which you will refer in your button's code.

For above solutions you would need to expose API to grab the token from outside. Then you will write code in salesforce and consume this api to grab the token.

  • Thank you so much for your answer, I am in the process of learning Salesforce! So what you meant is to get the token Apr 23 '17 at 8:17
  • What you meant is to create a new page in visualforce that contains the php code and get the token, store it in a custom field (how to do that?) and add that Salesforce custom field to the button link. Am I getting it right? Apr 23 '17 at 8:21
  • @KathyKhalessi Visualforce is itself a language like PHP. In salesforce when we write client side code we write it in a visualforce page. You could write a javascript/jquery code in this page to get the token if you find that easier for you but you can't write php code in visualforce page.
    – Mr.Frodo
    Apr 23 '17 at 13:32
  • Thanks again for the reply, if I choose the second option, how should I create a batch process in Salesforce? Sorry to bother you! Apr 24 '17 at 17:14
  • @KathyKhalessi You can refer this Trailhead Module for writing batches.
    – Mr.Frodo
    Apr 25 '17 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.