I am planning to develop a profile for updating job assignment records. What I am not clear about is how to load an assignment record using either System ID or Import ID. Since job assignments do not have a loadbyfield method, there must be another way. I think I could use the Item Method and pass IOM the System ID for each assignment? Has anyone used the API to access job assignments?
Hi Chinh Quan,
Our next release of IOM due for release early next month has a TON of improvements and additions for volunteer functionality (we think it's pretty much anything anyone could ask for). If you'd like a beta version to see what is coming we can arrange that for you.
Thanks very much for contributing to the IOM API forum!!
I originally tried this, but it did not work.
Then I checked out Blackbaud knowledgebase BB703331 How to write code to edit a job assignment
which had sample code. This works inside RE as the host. to make it work with IOM, you'll need to change
oRec.Init REApplication.SessionContext to oRec.Init(import.SessionContext)
essentially you load up the Constituent, then look through all Constituent's JobAssignments (maybe you want to compare with JobAssignmentID to be 100% sure), then edit the fields you want to edit
the code is in VBA, so you'll need to tidy up for .net of IOM.
Dim oJob As CJob
Dim oJA As CJobAssignment
Dim oVol As CVolunteer
Dim oRec As CRecord
Set oRec = New CRecord
Set oVol = oRec.Volunteer
' Set oJAs = oVol.Assignments
For Each oJA In oVol.Assignments
If "" & oJA.Fields(JobAssignment_fld_DEPARTMENT) = "Business Support" And _
"" & oJA.Fields(JobAssignment_fld_END_DATE) = "" Then
oJA.Fields(JobAssignment_fld_NOTES) = "Testing, 1, 2, 3"
Else: End If
Set oJA = Nothing
Set oRec = Nothing