+ Start a Discussion
Florian KatenbrinkFlorian Katenbrink 

sforce.one.createRecord opens two new forms

Hey everyone,
when I call sforce.one.createRecord, then it sometimes open two new forms.
So it opens the dialog 1:
User-added image

And above this:
User-added image

This means I click cancel on the bottom one and then come to the first one. But the first one is only showing the progress bar.
I use a dropdown to select from the different record types I have ...
<div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
            New Request
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
            <apex:repeat value="{!RecTypes}" var="rec">
                <li style="text-align:left;" role="presentation">
                    <a role="menuitem" href="javascript:void(0)" onclick="createNewRequestDD('{!rec.Value}');">{!rec.Label}</a>
                </li>
        </apex:repeat>
    </ul>
</div>

... and then call a javascript function:
function createNewRequestDD(val) {
    HolidayFormsInitialExtension.getRecTypeId(
        val, 
        function(result, event){
            sforce.one.createRecord('Holiday_Form__c', result);
        }
    );
}

This behavior only occurs sometimes. Sometimes it works, sometimes it doesn't.

Best regards,
Florian