Calling Web Service method from javascript on Page load and rendering a button based on the value returned from the web service method

  • 1
  • Problem
  • Updated 4 years ago
We are trying to render a button on page load where we need to call some web service method and render button based on the value returned by the method (In this case User Record Access object as return type)
Photo of soundar raja

soundar raja

  • 238 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
So,  here is a quick sketch. 

You will create an inline resource that will perform your webservice call and then update the CSS on a partiular class based on the outcome,  or update a variable with text based on that outcome. 

Then your button will either use the CSS Class you updated,  or will run a custom snippet to load the text associated with the varialbe you set. 

There are quite a few posts on the community about webservice calls or custom Apex inclusion etc.  Search around...