You need to sign in to do that
Don't have an account?
Varun MK
I want to set a field inside a object to true (Ref line : all.SoftDelete__c === true; inside Server Contorller.
But it is not working as expected, Can any1 suggest what I am doing wrong ?
Lightning : Field Access in Server Side Controller
COMPONENT :- <aura:attribute name="allegato" type="PT_Allegato__c" default="{'sobjectType':'PT_Allegato__c', 'SoftDelete__c': false}"/> <lightning:buttonIcon iconName="utility:delete" variant="error" alternativeText="Elimina" onclick="{!c.deleteToBin}" size="medium"/> SERVER SIDE CONTROLLER :- deleteToBin : function(component, event, helper) { alert('Are you sure to delete?') console.log('SoftDelete__c'); var all = component.get("v.allegato"); var soft = component.get("v.allegato.SoftDelete__c"); all.SoftDelete__c === true; component.set("v.allegato",all); component.set("v.soft",true); component.set("v.allegato.SoftDelete__c",true); } })Hello !
I want to set a field inside a object to true (Ref line : all.SoftDelete__c === true; inside Server Contorller.
But it is not working as expected, Can any1 suggest what I am doing wrong ?
The code which you mentioned above is the component or browser side code. I see that there is no logic to call apex code above. please design as mentioned below
1. you have to write an apex class with object update logic
2. refer that class and method in your lightning component
3. In the deleteToBin method of client side controller you have to invoke server side method by passing id of that record and the field value you need to update
4. Take care of the object update logic in the server side apex code
Try this approach and post back in case if you see any issues.
Naveen
Team codengine.in