You know any way to perform this requirement ? Thanks in advance for your reply", "answerCount": 1, "upvoteCount": 0, "datePublished": "2016-08-11T10:39:00.000Z", "author": { "@type": "Person", "name": "Fabio Palladino", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000CUA9PAAX", "affiliation": { "@type": "Organization", "name": "NTTDATA" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Since you're using LEX, you might want to consider using a Lightning Component that makes a callout to an @AuraEnabled Apex method. This Component would be held in a Visualforce page using Lightning Out. There's a blog about how to do this here. ( http://www.crmscience.com/single-post/2016/08/11/Buttons-and-Actions-in-the-Salesforce-Lightning-Experience )", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4FDWSA3", "datePublished": "2016-08-16T14:37:23.000Z", "author": { "@type": "Person", "name": "Jake Richter", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000BhFHKAA3", "affiliation": { "@type": "Organization", "name": "Steampunk" } } } ] } } Skip to main content
Hi All,

I need to create a custom action for LEX environment placed in a detail page of custom Object.

This action must execute a JS remote invocation to an apex class that update one field on record in context.

After this the record must be refreshed and new value of custom field displayed.

I have created:

  • An Apex controller extension for custom Object that performs field update on the record visualized (@remote method) 
  • A VF page that embed JS remote invocation to Apex method
  • A custom Action of type "Custom Visualforce"

I added the action on Object Page Layout and It works but when I click on the button I visualize, for a few seconds, a blank popup page like this:

Custom Action with not rendered VF page

I don't need to visualize any Grafical VF page I only need to perform JS invocation.

This is VF page:

<apex:page standardController="Quote__c" extensions="Test4SyncController" docType="html-5.0" standardStylesheets="false" showheader="false" sidebar="false">

<script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>

<script>

UpdateAccount();

function UpdateAccount(){

aId = '<apex:outputText value="{!Quote__c.Id}"/>';

Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.Test4SyncController.updateAccount}', aId,

function(result, event){;

if(event.status){

// Success - close the publisher and refresh the feed.

Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});

} else if (event.type === 'exception'){

console.log(result);

} else {

}

});

}

</script>

</apex:page>

You know any way to perform this requirement ?

Thanks in advance for your reply
1 resposta
0/9000