Skip to content

Instantly share code, notes, and snippets.

@rapsacnz
Last active May 11, 2021 17:11
Show Gist options
  • Save rapsacnz/e813550f8fcc4e0357c2 to your computer and use it in GitHub Desktop.
Save rapsacnz/e813550f8fcc4e0357c2 to your computer and use it in GitHub Desktop.
<apex:page applyBodyTag="false" controller="YourController" extensions="LookupController" docType="html-5.0" showHeader="true" sidebar="false" standardStylesheets="false">
<html xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<head>
<apex:includeScript value="/lightning/lightning.out.js"/>
<apex:stylesheet value="{!URLFOR($Resource.SLDS0110, 'assets/styles/salesforce-lightning-design-system-vf.css')}"/>
</head>
<body >
<div class="slds">
<div class="slds-form-element slds-m-top--xx-small">
<div class="slds-m-right--x-small" id="account_lookup"></div>
</div>
</div>
</body>
<script>
function initLookup() {
$Lightning.use("c:LookupContainer", function () {
$Lightning.createComponent("c:Lookup", {
recordId: "{!contact.AccountId}",
label: "Account",
pluralLabel: "Accounts",
sObjectAPIName: "Account",
listIconSVGPath: "/resource/SLDS0110/assets/icons/standard-sprite/svg/symbols.svg#account",
listIconClass: "slds-icon-standard-account",
callback: function(){ alert('done!'); },
filter: " WHERE Name = 'Some Name' ",
required: required
}, 'account_lookup', function (cmp) {});
});
}
initLookup();
</script>
</html>
</page>
@chandra2ravi
Copy link

chandra2ravi commented May 11, 2021

can we add this on vf page button click? I tried it and not working.
<button id="test" onclick="initLookup()" >sync</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment