Record Locks???

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
bpolak
Posts: 28
Joined: Thu Jan 24, 2008 2:47 pm

Record Locks???

Post by bpolak »

Can anyone help me figure out how to lock a particular record once it's opened by a user? I have built a small application that allows users to open up the "Next available customer" - determined by a query that says "If customer.dontcall = No". Once they open the next customer, they can call them and log the call into the application. Once they are done logging it in, the customer.dontcall flag is set to 'Yes' so the customer won't be brought up again.

The problem I'm having is that the "next available customer" is pulling up when User1 logs in as well as when User2 logs in. So User1 logs in, clicks to get the next customer, and makes a phone call to them. While that use is on the phone with the customer, User2 logs in and clicks to find the "next available customer". If User1 has not completed and logged his call, User2 will pull see the same customer pull up. After the call is completed, the next record pulls up (as it was intended).

Can anyone help me figure out how to handle this? I don't see any ability to use record locks here... maybe there is a work around? I've thought about putting some kind of Yes/No item in the customer object called "Locked" but I can't figure out how to trigger that to be "locked" when a user opens that record... HELP!?!?!?
Rem
Posts: 216
Joined: Wed Oct 03, 2007 8:58 am
Location: Sweden
Contact:

Post by Rem »

Hi!

I think you can use the option "Use rule during initialisation" to make sure the dontcall is set when opening form and not when saving.

However I see the problem if the query is run by two users at the same time and it takes a while before they click on it to open it. I think perhaps you would make some kind of test as well first thing when you open the form to check for this.

Another way to solve it would be to run a process witch marks customers as "my customers", tag them with the regularusers name or whatever and then open them one by one. This should be foolproof!

Good luck!

/Rem
bpolak
Posts: 28
Joined: Thu Jan 24, 2008 2:47 pm

Post by bpolak »

Hey Rem,

That's actually very helpful. The second option won't work for me but I do have a question about the "Use rule during initialisation" option. So I have a business object called "customer" and another object called "call". When a user creates a new "call" for a customer, I want to have the "don'tcall" flag set to yes in the customer record. I've been playing with rules both on the customer object as well as the call object. For some reason, I can't get either to set that flag in the "customer" object. Can you offer any advice on how that should work?

The "call" rule I have just says: Call.Customer.DontCall='Yes'
The "customer" rule I have says: Customer.DontCall='Yes'
Both rules are setup to run during initialisation

Sorry... I'm new to this software...

Any help you can give would be greatly appreciated!
Rem
Posts: 216
Joined: Wed Oct 03, 2007 8:58 am
Location: Sweden
Contact:

Post by Rem »

When you say you can´t get the flag set do you mean before or after the user press save? (my guess is that you mean before, and if that is the case read on ..)

I probably would make a process that:

1. find your customer
2. sets the flag
3. open the form

That way the flag will allready be set when the form is opened. Exactly how you should write the process I don´t know but I beleive it can be done.

I had a similar issue with printing BO:s. My problem was that once I started to print I wanted to make sure no one else created new items until I could verify that the printout was OK. I solved it this way, by setting the flag first. And, by the way, I changed my flag to a number which I then increase for every printout (for tracking purposes). Unprinted BO:s I gave the number -1.

/Rem
bpolak
Posts: 28
Joined: Thu Jan 24, 2008 2:47 pm

Post by bpolak »

Thanks for the additional help. That sounds like it will work. But I'm new to AwareIM and don't fully understand the processes just yet. Can you give me an example of what the code in that process should look like?
Post Reply