We are a group of users of Blackbaud products and are not affiliated with Blackbaud. We'd love to have you join our community to help and be helped in getting the most from your Blackbaud software.
Register now to join us to get independant advice on your system, connect with 3rd party consultants to help you maximize your database and have a real alternative to the official Blackbaud website.
What you are doing doesn't really make sense. You need to create the action (as you do in the second part of the code) and then assign a constituent object id to it.
Code:
Dim action1 As CAction
Set action1 = New CAction
action1.Init REApplication.SessionContext
action1.Fields(ACTION_fld_RECORDS_ID) = currentaction.constituent.Fields(RECORDS_fld_ID)
'There are other mandatory fields that should go hear such as action type etc.
action.save
The syntax is now sound and should work fine using this:
Code:
Dim action1 As CAction
Set action1 = New CAction
action1.Init REApplication.SessionContext
action1.Fields(ACTION_fld_RECORDS_ID) = constituent1.Fields(RECORDS_fld_ID)
action1.Fields(ACTION_fld_TYPE) = "Telemarketing Call Out"
action1.Fields(ACTION_fld_CATEGORY) = "Task/Other"
action1.Fields(ACTION_fld_DATE) = UserForm1.TextBox1.Text
action1.Fields(ACTION_fld_STATUS) = "Pending"
action1.Save ' get the annoying error here
But when I try and save my new action I'm getting this annoying error that I just plain don't understand. Reads as follows:
The only thing I can think of is that it could be because I don't have supervisor access. But a normal user like me can create new actions manually, so that doesn't make sense.
The foreign key constraint helps to ensure database integrity. Basically, it is saying that the FK_ACTION_1 (which is the action1.Fields(ACTION_fld_RECORDS_ID) ) does not exist in the table "dbo.RECORDS" in the column 'ID'. The most common reason for this is that you are using the wrong ID field. The constituent ID on the action needs to be the constituent's RE System ID. You'll probably want to use some method to determine what value you are passing to the action.
Drew
__________________ J. Drew Allen
Children's Hospital of Philadelphia
Crystal Reports and SQL Server Consultant
It is better to live your destiny imperfectly than to live an imitation of somebody else's life with perfection.