Notices



Reply
 
LinkBack Thread Tools Display Modes

Old 07-01-2008, 12:20 AM   #1 (permalink)
Troublesome Telemarketer

Join Date: Jun 2008
Posts: 4
Rep Power: 0 KameSama is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

Creating A New Action in VBA

Trying to create a new action for a specified constituent from an action screen that is already open.

Basically what I am doing is this:

Quote:
Dim constituent1 as CRecord
Set constituent1 = currentaction.constituent
constituent1.Init REApplication.SessionContext

Dim action1 As CAction
Set action1 = New CAction
action1.Init REApplication.SessionContext

action.save
This should now create a new action for the constituent right?
The error I'm getting is "Required Field Missing: Constituent"

How do I specify that I'm trying to save action1 to constituent1 as a new action??

Many thanks for any help!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 07-01-2008, 04:42 AM   #2 (permalink)
Likes to customize RE!

DavidZ's Avatar

Join Date: Jul 2006
Location: London, UK
Posts: 335
Rep Power: 3 DavidZ is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

Hi,

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
David
__________________
David Zeidman
Zeidman Development
http://www.zeidman.info

Check out my RE API blog
http://www.re-decoded.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 07-01-2008, 10:30 PM   #3 (permalink)
Troublesome Telemarketer

Join Date: Jun 2008
Posts: 4
Rep Power: 0 KameSama is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

Thanks David!

I don't know what I was thinking there.

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.

Any advice?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 07-02-2008, 08:05 AM   #4 (permalink)
Likes to customize RE!

DavidZ's Avatar

Join Date: Jul 2006
Location: London, UK
Posts: 335
Rep Power: 3 DavidZ is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

You seem to have forgotten to post the error message.

This code works fine for me. Although I gave my code a real date and didn't use a UserForm.

As an aside you should also always closedown top level objects that you initialise (and some that you don't - see here)

So that you should have at the end:

action1.Closedown
set action1 = nothing

David
__________________
David Zeidman
Zeidman Development
http://www.zeidman.info

Check out my RE API blog
http://www.re-decoded.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 07-02-2008, 08:21 AM   #5 (permalink)
Crystal Reports Guru

DrewAllen's Avatar

Join Date: May 2006
Location: Philadelphia, PA
Posts: 1,153
Rep Power: 4 DrewAllen is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- Information Edge (TIE)
- API/VBA

Quote:
Originally Posted by KameSama View Post
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Loan - Cheap Gas - Mortgage - Loans
All times are GMT -6. The time now is 10:45 AM.

Miscellaneous


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by BBpixel Team 2008 :: jvbPlugin R1012.364.1

SEO by vBSEO 3.2.0 Copyright 2008 Blackbaud User SocietyAd Management by RedTyger
Inactive Reminders By Icora Web Design

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64