4

In classic, I have a Custom button for DocuSign which looks like this. I want to convert this to lightning.

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")} 

//********* Option Declarations (Do not modify )*********// 
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var 
CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var 
CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var 
RES='';
//*************************************************// 

DST = '15f9eee9-e8d4-49c0-805e-73184eac7581'; 

//********* Page Callout (Do not modify) *********// 
window.location.href="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;

I have created a button component and added to Oppty layout. What is the way to execute following URL code since URL is different for lightning and the following URL is a classic? as well as include javascript?

Lightning Component controller

({
    doInit : function (component, event) {
        var action  = component.get("c.returnFlag1");
        action.setParams({
            "opptyId": component.get("v.recordId")
        });
        action.setCallback(this,function (a){
            var stat = a.getReturnValue();
            if (stat) {
                window.open('/'+component.get("v.recordId"));
            }else{
                alert('Please check criteria');
            }
        });
        $A.enqueueAction(action);
    }
})
3

1 Answer 1

6

Updated Lightning Component controller

({
    doInit : function (component, event) {
        var action  = component.get("c.returnFlag1");
        action.setParams({
            "opptyId": component.get("v.recordId")
        });
        action.setCallback(this,function (a){
            var stat = a.getReturnValue();

            var urlEvent = $A.get("e.force:navigateToURL");
            urlEvent.setParams({
              "url": "/apex/dsfs__DocuSign_CreateEnvelope",
              "isredirect": "true"
            });
            urlEvent.fire();

        });
        $A.enqueueAction(action);
    }
})
1
  • it is not working in community any idea about how can we achieve it without harcoding the url of that page May 16, 2019 at 10:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .