0

We override the standard lead convert for this custom VF page. I was not the one who created this and am not VF savvy yet. I need the task section to not be required and I need to add a field onto the convert page. Looking at the VF page code, I cannot determine how I would do that.

!-- Use this page to override the standard Lead Convert action. This page will
     check a checkbox field on the Lead record; checking that checkbox will
     cause the Lead to not meet the workflow rule's criteria, which will remove
     the Lead from the workflow queue, and allow it to be converted. -->
<apex:page standardController="Lead" > 

<apex:form >
    <div style="visibility:hidden;">
        <apex:inputField value="{!Lead.Cancel_Workflow__c}" id="cancelWorkflow" style="visibility:hidden; "/>
    </div>

<apex:actionFunction name="quickSave" action="{!quickSave}" oncomplete="standardConvert();"/>
    <apex:actionFunction name="standardConvert"
      action="{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}" oncomplete="return false;"/>

<script language="JavaScript">

    // When the page finishes loading, do the default window.onload action,
    // then call our fixLead() function.
    var previousOnload = window.onload;
    window.onload = function() {
        if (previousOnload) previousOnload();
        fixLead();
    }

    // Edit the Lead to set the Cancel Workflow flag.
    // When quickSave() finishes, it will redirect to the default Convert action.
    function fixLead() {
        var elemCancelWorkflow = document.getElementById('{!$Component.cancelWorkflow}');
        elemCancelWorkflow.checked = true;
        quickSave();
    }

</script>
</apex:form>
</apex:page>
2

Usually I would say something like "Go over to the trailhead, learn some VF, make a few changes" - but this isn't the standard convert page, or a custom convert page.

// When quickSave() finishes, it will redirect to the default Convert action.

Read the comments at the start of the page - this "page" removes a lead from a workflow, and then bounces the user over to the actual convert page. Judging from the comments & redirect pattern, the actual convert page is unchanged from the standard version, your developer just added a page to preform some javascript on before redirect there. Its a neat fix, but doesn't help you at all.

You'll have to rebuild the entire convert page from scratch, and then change the page the javascript redirects to. Judging from your post, you'll either need to learn (a lot) about apex and visualforce (Trailhead) or hire another developer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.