CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Unable to add link to create a new relationship
Pages: [1]

Author Topic: Unable to add link to create a new relationship  (Read 1482 times)

Jameson

  • Guest
Unable to add link to create a new relationship
June 05, 2007, 07:11:14 am
I want to be able to integrate CiviCRM better with Drupal by making links to point to everything in CiviCRM. When I create a link to add a relationship type, I sometimes get an error. The link that I am using is <site>/civicrm/contact/view/rel?action=add
 
I sometimes get the following error:
Quote
Sorry. A non-recoverable error has occurred.
Could not find valid value for cid

Return to CiviCRM menu.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Unable to add link to create a new relationship
June 05, 2007, 10:11:49 am
Many links in CiviCRM occur in the context of a contact. Add a relationship is an example of this - so the correct way to format a link to "New Relationship" form is to include the contact id (cid) of the contact you are adding the relationship FOR (i.e. one side of the relationship).

<site>/civicrm/contact/view/rel?cid=85&action=add&reset=1

Note also the reset=1 parameter, which makes sure that the session is reset appropriately for this operation.

CiviCRM sometimes maintains the current contact's context in the session - and this is probably why your link works SOMETIMES w/o the cid=xx parameter.

Also note that links for contact-specific forms and tasks will need to be generated dynamically (based on the contact you want to act on).
Protect your investment in CiviCRM by  becoming a Member!

Jameson

  • Guest
Re: Unable to add link to create a new relationship
June 05, 2007, 01:34:13 pm
Unfortunately, every contact has a different cid. I have linked my Drupal users to my CiviCRM contacts. So, depending on the user, the cid changes. How do I assign the current user/contact in Drupal to the cid in the link? Is there are variable for the current user that I can assign to the cid?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Unable to add link to create a new relationship
June 05, 2007, 02:03:07 pm

You will have to use the civicrm api to retrieve the contact ID given the drupal user ID. the calls are present in api/UFGroup.php
 
crm_uf_get_match_id

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Unable to add link to create a new relationship

This forum was archived on 2017-11-26.