You need to sign in to do that
Don't have an account?
Lightning Component to Replace Javascript Button
Hello! Thank you in advance for your assistance! I have been working on this for over 24 total changing the Controller and Component in small ways here and there to test and re-test, and I think I am going in circles at this point.
We have 8 custom Javascript buttons for our Cases - one per department. What these buttons do is allow the user to own the case with one click. It enters their name into a custom user lookup "owner" field for that department, updates their name to the standard Owner field, and updates the Status to Assigned.
The current, working, custom JS button is:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.CST_Owner__c = '{!$User.Id}';
caseObj.OwnerId = '{!$User.Id}';
caseObj.Status = "Assigned";
var result = sforce.connection.update([caseObj]);
window.location.href=window.location.href;
My Case Buttons Component is currently - this shows on the page and allows for button clicks and will sometimes throw an error and sometimes not but makes no changes:
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<aura:attribute name="CaseObj" type="Case" />
<lightning:button label="Own CST" onclick="{! c.owncst}"/>
</aura:component>
My Controller is currently:
({
owncst : function(component, event, helper) {
var btnClicked = event.getSource();
var CaseObj = component.get('v.CaseObj',true)
component.set('v.CaseObj.Description', "true");
}})
We have 8 custom Javascript buttons for our Cases - one per department. What these buttons do is allow the user to own the case with one click. It enters their name into a custom user lookup "owner" field for that department, updates their name to the standard Owner field, and updates the Status to Assigned.
The current, working, custom JS button is:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.CST_Owner__c = '{!$User.Id}';
caseObj.OwnerId = '{!$User.Id}';
caseObj.Status = "Assigned";
var result = sforce.connection.update([caseObj]);
window.location.href=window.location.href;
My Case Buttons Component is currently - this shows on the page and allows for button clicks and will sometimes throw an error and sometimes not but makes no changes:
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<aura:attribute name="CaseObj" type="Case" />
<lightning:button label="Own CST" onclick="{! c.owncst}"/>
</aura:component>
My Controller is currently:
({
owncst : function(component, event, helper) {
var btnClicked = event.getSource();
var CaseObj = component.get('v.CaseObj',true)
component.set('v.CaseObj.Description', "true");
}})
apex controller : component javaScript controller output :
case object not support the quick action button with lightning component
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
All Answers
apex controller : component javaScript controller output :
case object not support the quick action button with lightning component
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
but couldn't get started on the controller part esp. on the validation in the controller, can you help me on this? Thank you.
codigo del boton.
switch("{!Opportunity.StageName}"){
case "7. Apartado":
window.open("{!URLFOR("../apex/Aletc_Formato_UnidadCondominal", "")}?id={!Opportunity.Id}");
case "9. Elaboración Contrato":
window.open("{!URLFOR("../apex/Aletc_Formato_UnidadCondominal", "")}?id={!Opportunity.Id}");
break;
default:
alert("No se puede generar contrato para esta Oportunidad con desarrollo {!Opportunity.Desarrollo__c} y etapa {!Opportunity.StageName}, Solo está disponible para la etapa 9. Elaboración Contrato.");
break;
}