Cancelling an appointment

Posted by Rollbase User on 02-Jul-2013 12:15

I have a client that would like the appointment on the calendar to be deleted automatically after cancelling the appointment using the workflow action "cancelled". Currently, when they cancel an appointment it is still listed on the calendar. Can anyone guide me with some scripting or suggestions? Can a (object script) trigger be created to handle this process using server-side API...like rbv_api.deleteRecord(objDefName, objId) and use the trigger with the cancelled workflow action? I hope I am making sense?? Thanks!

All Replies

Posted by Admin on 10-Jul-2013 07:09

Hi Paul,



your explanation makes perfect sense. I agree, the solution involves a Workflow action that will identify when an appointment's Workflow field becomes canceled, thus launching a trigger to delete that specific record. From there, the method rbv_api.deleteRecord() should be expected to run without any problems.



I am already working on a simple Action Condition Formula and Trigger that should behave accordingly. Thanks.

Posted by Admin on 10-Jul-2013 07:42

Thanks...right now I have a few "After Delete" triggers running with the Trigger Properties set to generate an Activity Trail for (Trail Object "Related Account", etc) because the client needs to keep track of when the deletion occurred after the appointment was cancelled using the formula ('{!status#code}'== 'Cancelled');. So currently, they cancel the appointment. Then they delete the appointment and the trigger runs creating the activity history related to the trail object.

Posted by Admin on 10-Jul-2013 10:27

Paul,



thanks for your quick reply. If I understand correctly, the client must still manually cancel and delete the appointment in order to launch the trigger that will create an activity history. So in addition to automatic deletion of canceled appointments, there should also be an Activity Trail based on each canceled appointment?

Posted by Admin on 15-Jul-2013 14:46

Hi Paul,



I wanted to confirm whether or not you were able to achieve a custom trigger to automatically delete a cancelled appointment. If you'd like, with your Login ID and Company Name, I could log into the application and observe the formula. Alternatively, you could provide an Application XML so that I may import the application and observe the formula from my own Rollbase instance.



To export the Application XML, simply navigate to SETUP > APPLICATIONS SETUP > *Application name* > More Actions... > Generate XML > Generate XML, the result of this process should produce an XML file.



Feel free to send either the login information or Application XML file to cprak@progress.com.



Thank you,

Corey Prak

Posted by Admin on 18-Jul-2013 13:44

Unfortunately, I do not have permission to generate the xml

Posted by Admin on 19-Jul-2013 06:24

Hello Paul,



that's not a problem at all. If you would still like my assistance, could you please explain the situation of the issue thus far?



Thanks,

Corey Prak

Posted by Admin on 20-Jul-2013 09:21

I have a client that uses a workflow called "Cancel Appointment" to cancel the appointment. In the CRM the appointment shows as cancelled but on the Calendar the appointment still exists. However, when you view it on the calendar it does say it was cancelled. My client wants to cancel the appointment using the workflow in place and upon cancelling would like the appointment deleted off the calendar and create an activity history for tracking purposes. The client wants this all to occur in one step. Currently, I am using an onDelete trigger to keep a history because the client has to then delete the appointment off the calendar after it was cancelled and this approach retains the history of the appointment.

Posted by Admin on 22-Jul-2013 07:39

Hi Paul,



thanks for the update. It seems that the only feature left to implement is the automatic deletion of appointments; I'm currently working on a trigger which will behave accordingly. Ideally, this trigger could be incorporated into your Workflow. I will reply with an update and sample code for the trigger as soon as possible.



Thank you,

Corey Prak

Posted by Admin on 22-Jul-2013 07:42

Thanks for all your assistance. I appreciate it.

Posted by Admin on 22-Jul-2013 07:51

Hello Paul,



thanks for your quick reply, and you're very welcome. I was just wondering of whether your client's appointment object type is of "To-Do" or "Meeting". Functionality isn't hindered in any case, but I would like to be certain and make sure my appointment object is of the same type.



So far, everything seems to be coming together smoothly. I've been able to identify which appointments have a Workflow Status of "Cancelled". From there, I would like to extract the ID of the record and use the Rollbase API to delete them. Please let me know if there are updates on your end as well.



Thanks,

Corey Prak





Posted by Admin on 22-Jul-2013 07:52

Thanks...they do appointments, to-do's, and meetings...hope that helps?



Paul

Posted by Admin on 22-Jul-2013 07:57

Paul,



I apologize, I meant for the second type to be "Meeting" instead of "Appointment". I will create the trigger with both object types in mind.



Thanks,

Corey Prak

Posted by Admin on 22-Jul-2013 14:51

Hello Paul,



I was able to delete an appointment upon changing the Workflow Status to "Cancelled". However, once the change is saved, Rollbase will display an error message.



Upon saving the change, Rollbase will attempt to refresh the page of the deleted record. Because the record no longer exists, an error will occur. Since this is a custom trigger that negatively affects Rollbase's behavior, the solution must be modified.



The trigger I have created is simple, but probably not efficient. Upon a Workflow Status change to "Cancelled", the following code will determine the specific appointment to be deleted and return it's name:



/*Query results as a two dimensional array.*/

var toBeDeleted = rbv_api.selectQuery("SELECT name, id FROM todo WHERE status='Cancelled' ", 100);



/*ID of cancelled appointment.*/

apptID = toBeDeleted[0][1];



/*Delete the record of object "todo" which has an ID of apptID.*/

rbv_api.deleteRecord("todo", apptID);



/*Return name of deleted appointment record;*/

r

Posted by Admin on 22-Jul-2013 14:53

Thanks I will check it out...much appreciated!

This thread is closed