2

I know the numeric IDs I want to query, but I can't enter them. e.g. on entity ActivityContact, I want to use the Contact ID params, and the Activity Id.

(I'm wanting to issue this request, which will only give me back what I already know, as a way of validating that the record exists.)

On the Contact ID I get a Contact search, but I can't figure out how to bypass this to enter the numeric ID. It's not such a problem because I can always go look up the contact's name and type that in and select it.

But I'm flummoxed by the Activity Id selector. I know the Activity Id I want, but I can't type a number in (it says not found), but I don't see what I would type in to locate it any other way?

screenshot of api explorer

Is there a way to override those new GUI elements (old explorer provided a workaround)? I tried using 'other' parameter and entering activity_id manually but it's too clever and noticed this and presented the GUI again!

(I can run this in code, but I'm trying to get in to the much promoted habit of using the explorer for answers first and wondered if I was missing something.)

Thanks.

6
  • 1
    Now I have a question for you: what in your website's theme is causing the "Action" field to be crazily stretched and how can we fix it?
    – Coleman
    Aug 28, 2015 at 16:31
  • Yeah. I wondered about that too! Aug 28, 2015 at 18:04
  • @Coleman Well I'm not sure how the width of that field is supposed to be set. It seems that it has an inline style attribute setting width:226px;display:inline; but width has no effect on inline elements, and as this element contains display:block elements (which default to 100% width), seems my browser's only implimenting standard behaviour? ... changing the inline style to width:226px;display:inline-block; fixes... (same look on demo page, so not my theme) Sep 4, 2015 at 10:48
  • d46.demo.civicrm.org/civicrm/api does not have this problem, the widget is a reasonable size and doesn't have 'inline' as a style. I suspect your theme's css might be applying the 'inline' style to form elements and then select2 picks up on that and adds it to the style property when it generates the select2 from the existing element.
    – Coleman
    Sep 4, 2015 at 15:42
  • That's interesting. Using Firefox 40, the demo site you link to DOES exhibit this behaviour, and does have 'inline' (happy to send screenshot). Using Chromium, it does't and it does use 'inline-block'. Perhaps I have a weird plugin installed that does very random things to inline styles...?! Sep 4, 2015 at 17:14

1 Answer 1

3

To answer your different questions:

I don't see what I would type in to locate it any other way?

You would locate it by typing in the activity subject. Admittedly, this isn't perfect because some activities might have no subject, and therefore can't be located via autocomplete.

Is there a way to override those new GUI elements

Update: now the answer is yes :) As of CiviCRM 4.6.9 an EntityRef in the Api Explorer will accept any integer.

4
  • Just assume that any numeric input is the thing that the helper is trying to help you find? Rare case that a contact or activity subject would be a simple integer... Aug 28, 2015 at 18:08
  • 1
    Ok here's a stab at it: github.com/civicrm/civicrm-core/pull/6624
    – Coleman
    Aug 28, 2015 at 20:51
  • Fantastic! But does your regex allow for IDs>99? Should it be * not ? Aug 28, 2015 at 22:08
  • Gooood point. PR updated.
    – Coleman
    Aug 29, 2015 at 0:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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