Setting warning messages on batch validation on a custom batch
Hi all, I'm trying to figure out how to raise a warning on batch validation. Not an error, just a warning. I can't find this documented anywhere.
Comments
-
We add a user message to the specific batch table that we are working with using its store procedure.
For example, if I am working with the constituent update table and I want to add an informational message to a constituent's record, I will call the USP_BATCHCONSTITUENTUPDATEBATCHUSERMESSAGE_ADD stored procedure (usually from within the AfterFileImport() method in the import handler). You will need to pass 3 parameters into this stored procedure: BATCHCONSTITUENTUPDATEID, MESSAGETEXT, and CHANGEAGENTID.
Within the batch, the user can decide what to do with the message because it will stop the batch from committing ("Clear row message" or “Clear all”).
Hope this helps,
Matt
0 -
So I was trying to use the SYSTEMMESSAGES stored proc but I have switched to USERMESSAGES and it's still not working.
Here's my code… this is in my commit add form. (Damn, I can't seem to format as code anymore in this.. sigh)
I have verified that it successfully raises the warning as an error when RAISERROR is not commented out. I've also verified that @USR_UNC_BATCHSTUDENTIMPORTID contains the expected value. However, no row is inserted into the user messages table nor is any row visible. I feel like “successful” validation is wiping out all messages.
IF LEN(@warnings) > 0
BEGIN
SET @warnings = convert(nvarchar(max),@USR_UNC_BATCHSTUDENTIMPORTID) + ' ' + @warnings
– RAISERROR(@warnings,16,3)
exec dbo.USP_USR_UNC_BATCHSTUDENTIMPORTBATCHUSERMESSAGE_ADD
@USR_UNC_BATCHSTUDENTIMPORTID,
@warnings,
@CHANGEAGENTID
END
IF @VALIDATEONLY = 1
RETURN 00 -
Well a couple of things for us, at least. If you use the RAISERROR before you execute the stored procedure, it will roll everything back (actually tested that and it would not run the stored procedure at all - but if I commented the stored procedure, then it would run the stored procedure). The other problem that at least we had with executing this stored procedure in the COMMIT section of a batch is that Blackbaud's commit code runs first, then your code in the commit section will run. So, if the batch is successfully committed and even if the record is added to the table, since the batch has already been committed, the user message will not display in the batch. It will be added to the USER MESSAGE table, but we have found that because Blackbaud's code runs first, the batch will be committed BEFORE our code runs and the record(s) will be added to the USER MESSAGE table, but by that time, it really is irrelevant because the batch has already been committed and the message will not display in the batch. We use the USER MESSAGE table during the ADD section in the or in the import handler. You might be able to also run it as an operation BEFORE the Commit button, but we have not tested that, yet. We ended creating a ‘Validate’ button so that we could run processes BEFORE the user hits the COMMIT button because we wanted to run processes before Blackbaud runs their commit process.
0 -
Matthew, that's really interesting.
I want to use the “VALIDATEONLY” portion of the commit so I can press the “Validate” button in the batch itself.
However, if you don't RAISERROR, it seems that Blackbaud actually decides there are no validation errors and erases all items with an ORIGINCODE of “validation” from the BATCHSYSTEMMESSAGES table. So you can't insert warnings or errors that way.
I have been able to successfully add warnings and errors in my Add Form, and if I use an ORIGINCODE of “Import”, the messages show the “dismiss” option and are NOT wiped out by validation.Still, it would be nice if this stuff were documented, wouldn't it?
This does give me an idea, I'll have to see if I can raise errors and warnings with a source of “Import” in the commit form when VALIDATEONLY=1….
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 213 bbcon®
- 1.4K Blackbaud Altru®
- 403 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.6K Blackbaud Financial Edge NXT®
- 656 Blackbaud Grantmaking™
- 577 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 939 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.6K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 248 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 241 Member Lounge (Just for Fun)
- 34 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 794 Community News
- 2.9K Jobs Board
- 54 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
