({
doInit : function(component, event, helper) {
var action = component.get("c.fieldCheker");
var recordId=component.get("v.recordId");
action.setParams({
"recId" : recordId
});
action.setCallback(this, function(response){
var state = response.getState();
if(state == 'SUCCESS') {
var returnValue= response.getReturnValue()
if(returnValue!=null){
if(returnValue.Promo__c==null || returnValue.Promo__c =='undefined'){
//alert("To convert this lead, Please specify whether Marketing Promo is applied or not.\n\nYou can update this information using the 'Promo' field under 'Marketing Information' section.\n\nThank you for your co-operation.")
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
title: "Error!",
message: "To convert this lead, Please specify whether Marketing Promo is applied or not.\n\nYou can update this information using the 'Promo' field under 'Marketing Information' section.\n\nThank you for your co-operation.",
type: "Error"});
//$A.get("e.force:closeQuickAction").fire()
//dismissActionPanel.fire();
//$A.get("e.force:refreshView").fire();
//toastEvent.fire();
//$A.get("e.force:refreshView").fire();
/*var svg = component.find("svg_content");
var value = svg.getElement().innerText;
value = value.replace("<![CDATA[", "").replace("]]>", "");
svg.getElement().innerHTML = value;*/
component.set('v.myText','To convert this lead, Please specify whether Marketing \'Promo\' is applied or not.\nYou can update this information using the Promo field under \'Marketing Information\' section.\nThank you for your co-operation');
}
else if(returnValue.Flag_Type__c == 'Related'){
component.set('v.myText','You don\'t have sufficient access to convert a related lead.\nPlease swap this lead to master by clicking the swap to master button\nFor more information contact SMO team.');
}
else{
var/*var navLink = component.find("navigation");
var pageRef = {
type: 'standard__objectPage',
attributes: {
actionName: "convert",
objectApiName: 'Lead',
recordId : recordId
},
};
navLink.navigate(pageRef, true);*/
var urlString = window.location.href;
var baseURL = 'https://testaz--current.lightning.force.com';
//use apex or JS libraries to get the base URL
// urlString.substring(0, urlString.indexOf("/lightning"));
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
//ws is the relative url to the redirect screen once lead is converted. right now it will got to account page
"url": baseURL + '/lightning/cmp/runtime_sales_lead__convertDesktopConsole?leadConvert__leadId=' + recordId + 'ws=%2Flightning%2F%2FLead%2F'+recordId+'%2Fview'
});
urlEvent.fire();
}
}
}
});
if(recordId !=null && 'undefined' ){
$A.enqueueAction(action);
}
}
})
Bumped by Community user
Bumped by Community user
Bumped by Community user