+ Start a Discussion
Anil IngleAnil 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.

    function MyApp() {
        this.createOpportunity = function() {
            var custAccountId = '{!accountId}';
            sforce.one.createRecord("Opportunity", null, "defaultFieldValues:{ 'AccountId' : '"+custAccountId+"'}" );

    var app = new MyApp();

    function btnCreateOppt() {


<div style="display:{!if((rfqDetail.Opportunity__c == ''),"normal","none")};">
<apex:commandButton action="{!ViewOpportunity}" value="Create" oncomplete="btnCreateOppt();" reRender="{!if((displayErrorPopUp), 'errorPopup','redirectOppt')}">

Please let me know, if any thing mistake