function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhilesh Patwal 1Abhilesh Patwal 1 

I have created a library management app and want that when i borrow a book the availabelity of book modifies to not available and when the book is returned it modifies to available. Plese help me.

James LoghryJames Loghry
Sounds pretty straight forward.

What's your data model like?  If you have a Book object, you could take a look at adding two quick actions to the book:  a "borrow" quick action that takes in the borrower's name and sets the availability to unavailable, and a "return" action that updates the availability to available.  

You could even get a bit fancy with it and have an expected date of return field on the book object, set to say 2 weeks from the time of borrowing. This expected date would allow you to fire off a process builder email alert to the borrower, letting them know it's time to return the book.
Veena GopalVeena Gopal
Hi Abhilesh,
You can have a look up relation to book object in the borrower object. So that you select a book id when the borrower takes a book.
or you can have a book-borrower junction object if the borrower can take more than one book at a time.
2 ways:
you can define a after update trigger to update the availability of the book in the borrower object or the book-borrower junction object.
OR
you can define a process builder(process builder can update between different related objects). select the borrower object and in the action  update the field in the book object to "not available"

Let me know if the answer is confusing so that i can explain in detail.
Abhilesh Patwal 1Abhilesh Patwal 1
sorry, the reply is a bit confusing. I am a newbie and have no idea of trigger provide an alternate method
Abhilesh Patwal 1Abhilesh Patwal 1
How can I create a quick action to update the available field. The datatype of Available field is Checkbox with default value as true.
Veena GopalVeena Gopal
Hi Abhilesh,
Please give some insight on what are the objects and the fields you have so that we can explain in detail.
I already gave you 2 options:
1) Trigger
and if you are finding problems with understanding trigger then
2) process builder.
so u can use any one option.  
Quick actions are buttons in the global layout so i cannot say how it will achieve your result.(no idea).
Veena.
Data Team 51Data Team 51
Hi Abhilesh,

I'm a newbie to Salesforce and was wondering how you built this tool.  I'm building a similar app, but there aren't a lot of resources...