I am new to Scaleforce. I created a new app, added three custom objects (Client, Property, Client_Property) and created tabs for them. So now CRUD is working correctly but I want to change Available field in the Property object to false (type of this field is boolean) when adding a new record to the Client_Property object using a trigger in the Client_Property object.
Design of trigger seems to me like that:
- Get the Property Id field from the Property field in Client_Property object and save in some variable (id_clpr).
- Make SQL request like this: SELECT Available FROM Property WHERE id_clpr = Propery Id.
- And then change the field to false and somehow commit it.
trigger ChangeAvailable on Client_Property__c (before insert) {
//initialize variable to store Property Id
//find Property field
for(Client_Property__c cp : Trigger.New){
//get Property Id from Property field
}
//Make SQL request to Property object, get appropriate record, change value of
//Available field to false
}
Could you suggest solution, please?