Redirect to Constituent from Task

Hi,  I have many years of experience as a developer, but only three months of experience working with BlackBaud.  


I have created a task that loads an EditDataForm which uses a SearchSpec and Translation Spec with a few stored procedures.  I am restoring a deleted constituent using Audit Tables.   Everything is executing as desired, however, when the work is complete I want to redirect to the constituent I just restored. I have not been able to figure this out.   


If I configure the Post-ActionType to go to the constituent page and hard code a random constituent ID as an expression I can redirect after my task is completed.  I can't figure out how to pass the constituent ID back to the Post-Action (or otherwise access it). 


If I were writing an application from scratch, redirecting to the page would be done in code, and would be a piece of cake.   I've wondered if I should be adding code to my UIModel in the on saved event.  This doesn't seem quite right, but maybe it's the way to go.


Any suggestions?


Thank you,


Ernie

Comments

  • Phil Higgs
    Phil Higgs New Member
    Ninth Anniversary Kudos 1 Name Dropper Participant
    Hi, the "Add constituent" task re-directs to the Constituent Page as a Post-Action, but with no context, I assume it uses the Added record as context. Have you tried using "None" as context on your task ?
  • Ernest Noa
    Ernest Noa New Member
    Fifth Anniversary Kudos 1 Name Dropper Participant
    Hi Phil,


    I have tried it configured as you suggested, with the context set to "None"  This does not work.   My edit form, search lists and stored procedures pass around an audit record ID.   Although the constituent ID is part of this record, it's not explicitly passed back and forth by me.   Clearly this needs to happen.   Even if I create a field on my edit form to hold this value, how do I use it?  How does my task consume it and redirect the user to the target constituent?


    Thank you for the suggestion. 


    Ernie
  • Hey Phil,


    Ultimately what you suggested was the right answer.  I had to re-select my add form, although I could not tell you why.   After reselecting the add form and using the configuration you suggested, everything worked just fine.  I appreciate your help.


    Thank you,


    Ernie Noa
  • HI Ernie

    Good to know ! What you have built sounds to me like it should have a wider audience. We have had a few instances where we have merged constituents, and then needed to reverse the decision. If the record is deleted in the merge, then using your method from the audit trail would be a good way to get the constituent back again. Are you also looking at other tables to restore data from ?

     
  • Hi Phil,


    Restoring deleted or merged data wasn't too bad.   Figuring out if a record had been merged, and unmerging records that were incorrectly merged required using the CONSTITUENTMERGEOPERATIONS table.  Here is a tsql code snippet:

     
      FROM CONSTITUENTMERGEOPERATIONS cmo

      INNER JOIN ADDRESSAUDIT aaBEFORE on cmo.SOURCEID = aaBEFORE.CONSTITUENTID

                                  AND aaBefore.AuditType = 'BEFORE UPDATE'

      INNER JOIN ADDRESSAUDIT aaAFTER on cmo.TARGETID = aaAFTER.CONSTITUENTID

                                  AND aaAfter.AuditType = 'AFTER UPDATE'

      INNER JOIN CONSTITUENTAUDIT ca on cmo.SOURCEID = ca.AUDITRECORDID

      WHERE   aaBEFORE.AUDITRECORDID = aaAFTER.AUDITRECORDID

      AND        aaBEFORE.AUDITKEY = aaAFTER.AUDITKEY 

      AND        aaBEFORE.CONSTITUENTID  = @TARGETCONSTITUENTID 

      and        aaBEFORE.CONSTITUENTID != aaAFTER.CONSTITUENTID



    I have written something similar for each audit table I want to restore from.    


    Hope this is useful.


    Ernie

Categories