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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Alter settings via javascript api
Pages: [1]

Author Topic: Alter settings via javascript api  (Read 354 times)

niko_systopia

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 14.x
  • PHP version: 5.4.x
Alter settings via javascript api
June 05, 2014, 01:14:55 am
Hello everyone,

I'm currently trying to alter a settings entry via javascript like this:

Code: [Select]
       CRM.api('Setting', 'create', {'q': 'civicrm/ajax/rest', 'sequential': 1, 'name': 'batching.alt.6.OOFF.horizon', 'value': 8}, {success: function(data) {...}});

This fails and the following error message is returned:

Quote
civicrm/ajax/rest,batching.alt.6.OOFF.horizon,8 not valid settings

What am I doing wrong here? Which parameters does this function expect?

Thank you
Niko

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Alter settings via javascript api
June 05, 2014, 01:28:53 pm
So, your extension needs to define valid settings for the api to allow them to be set - see for example

https://github.com/eileenmcnaughton/org.civicrm.multisite/blob/master/settings/Multisite.setting.php

this hooks needs to be in your extension too https://github.com/eileenmcnaughton/org.civicrm.multisite/blob/master/multisite.php#L267
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Alter settings via javascript api

This forum was archived on 2017-11-26.