2

CiviCRM 4.7.29, Wordpress 4.9.5

I am unable to do a replace in the API explorer. I can do a "get" however. The situation is that a parent registered for an event, but forgot to change the number of registrants under his registration from 1 (him) to 3 (him + 2 kids). They were under 12 yrs so I just manually entered them. However, the kids now show as Registered_by_ID = null, and I want them to be the ID of the parent.

(NOTE: Am not a developer, just a volunteer with middle level of experience.)

When I do a "get", I can find his 2 kids by participant ID. Next, in API Explorer I use Entity = Participant, Action = Replace, and I would expect that the interface would allow me to choose the Participant I want to perform the action on, followed by a field on which I want to change from one value to another. Instead, it allows me to choose 1 field and 1 value and says it is going to update the database, so I chose no. How do I know what participants this is going to change since it doesn't let me choose who? How does it know what value from -> to I want to change?

I checked the examples here but Registered_by_ID is not listed. Does that mean a replace won't work on that ?

In the end, I'm open to suggestions of either how to get the API explorer to do what I want (change the Registered_by_ID from null to the parent's ID), or else if there's some other obscure way (ie Profiles?).

Thank you.

1

I figured out one way using profiles.

CREATE A PROFILE

  1. The first 4 steps that you'll only need to do once starts with going to Administer, Customize Data & Screens, Profiles. Click Add Profile.

  2. Give it a name such as "Update Child Participant Details", add a description if you like, check "Used for" + "Standalone Form or Directory", check "Is this Profile Active". Under Advanced Settings change "Limit Listings to a specific group" to "Attendees". Leave the rest as is. Click Save.

  3. It will now ask for a Profile Field, select Participants, Registered by ID. Check "Required" (since presumably this is the whole reason you want to create this in the first place). Leave the remaining fields as they are. If you want to update another field for the child (ie dietary restrictions, etc) then click "Save and New", else click "Save" to finish. NOTE: You cannot mix fields from other records, they all have to be from "Participants". If you try to use one from "Contacts" for instance, it will give you an error in later steps.

  4. Click Preview (all fields) and your Registered by ID field and any others you created should appear. Click Done with Preview. You will only have to do this once, this completes the Profile steps.

CREATE A PARTICIPANT ID REPORT

  1. You will only need to create this report once. Go to Events, Reports, Attendee List.

  2. Checkmark Columns, add Participant ID, Registered by Participant ID, Event, Status, Role, Fee Level and Participant Fee, then click View Results. Your report should now show the parents along with their children (everyone who registered). The Fee level field should presumably identify the parents from the children assuming the fee structure is different (ie under 12 free).

  3. Click on Title and Format, change the name to something more appropriate such as "Attendee List with IDs", then on the same screen under Actions, select "Save a copy" (not Save or it will overwrite the original), parent menu can be Events, Event Reports. This is where you'll find this report later.

  4. Now that you've created your report showing the children with Registered_by_ID = null (blank), you will now know which child's record to edit. Keep this browser tab open to refer to, and open a second browser tab or window.

USING THE PROFILE AND REPORT TO EDIT THE CHILD RECORD

  1. In the new browser tab or window, open CiviCRM and go to Events, Dashboard.

  2. If you only have 1 event showing, you should see all your attendees below. If you have more than 1 event, click on "Registered" to the right of your event. You should now see all your attendees below.

  3. With the Civi Report you left open in the previous browser tab or window, you can find the name(s) of the parent and their children. You'll be focusing on the children that do not have an ID number in the field Registered_by_ID because we will want to change this from null to their parent's ID. Make a note of the child(ren) and parent.

  4. Switch back to your 2nd browser tab or window. Click the box next to the name(s) of the child(ren) that you want to associate with the parent that registered them.

  5. Click on "Actions", and choose "Update Multiple Participants" which should be at the bottom of that list. Give Civi a moment, then you should see a page called "Update Multiple Participants" with a Select Profile dropdown. Choose the Profile you created in the first steps and click Continue.

  6. The child(ren) should appear now, though unfortunately this screen does not list their participant IDs nor their parents. This is why you'll want to switch back to the other browser tab or window, obtain their parent's participant ID, and enter it into the "Registered by ID" box beside their child(ren)'s names on the 2nd browser tab or window. If you created any other fields in the profile (ie Dietary restrictions) then they will also appear here too. Click the "Update Participant(s)" button to finish.

1

Usually using the api instead of update/get you want to issue a create with the relevant ID field filled in. The api call will then update the relevant record. For participant you would want to supply the participant id.

However I'd not recommend you use the API in this manner :)

  • Is this in the API explorer? out of curiosity – JP6805 May 7 '18 at 18:54
  • Yes - Sorry I should have been clearer. The API explorer gives you interactive access to the API. But the result of using an api call via the api, or via some other method, drush cv php etc will be the same. – Luke Stewart May 7 '18 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.