You need to sign in to do that
Don't have an account?
Anil Ingle
'defaultFieldValues' is not working in sforce.one.createRecord
Hello All,
I am working in Lightning Experience. On button click we creating opportinity with passing accountId using sforce.one.createRecord.
Salesforce redirect to opportunity but doesn't carry Account Name(AccountId).
Please check the following Code.
<script>
function MyApp() {
this.createOpportunity = function() {
var custAccountId = '{!accountId}';
sforce.one.createRecord("Opportunity", null, "defaultFieldValues:{ 'AccountId' : '"+custAccountId+"'}" );
};
}
var app = new MyApp();
function btnCreateOppt() {
app.createOpportunity();
}
</script>
...
...
...
<div style="display:{!if((rfqDetail.Opportunity__c == ''),"normal","none")};">
<apex:commandButton action="{!ViewOpportunity}" value="Create" oncomplete="btnCreateOppt();" reRender="{!if((displayErrorPopUp), 'errorPopup','redirectOppt')}">
</apex:commandButton>
</div>
Please let me know, if any thing mistake
I am working in Lightning Experience. On button click we creating opportinity with passing accountId using sforce.one.createRecord.
Salesforce redirect to opportunity but doesn't carry Account Name(AccountId).
Please check the following Code.
<script>
function MyApp() {
this.createOpportunity = function() {
var custAccountId = '{!accountId}';
sforce.one.createRecord("Opportunity", null, "defaultFieldValues:{ 'AccountId' : '"+custAccountId+"'}" );
};
}
var app = new MyApp();
function btnCreateOppt() {
app.createOpportunity();
}
</script>
...
...
...
<div style="display:{!if((rfqDetail.Opportunity__c == ''),"normal","none")};">
<apex:commandButton action="{!ViewOpportunity}" value="Create" oncomplete="btnCreateOppt();" reRender="{!if((displayErrorPopUp), 'errorPopup','redirectOppt')}">
</apex:commandButton>
</div>
Please let me know, if any thing mistake