- Topics: Active | Unanswered
Pages: 1
Topic closed
#1 2012-05-04 09:50:04
- **_mikesowerbutts_**
Custom fields on a Curriculum
Hi,
I am trying to create custom fields on a Curriculum via the API. I know this can be done through the Connect UI for Users, but I cant see anywhere to achieve the same thing for any other object type (i.e. a Curriculum or a Course)
I am making a call to the api like this:
MYCONNECTSERVERURL?action=custom-field-update&account-id=1747692&object-type=object-type-sco&permission-id=manage&name=ID&field-type=text&is-required=false&is-primary=false&session=breezepqe93pufxp4s6xy
which returns this:
<?xml version="1.0" encoding="utf-8"?>
<results><status code="ok"/><field account-id="1747692" is-primary="false" is-required="false" field-id="1747693" object-type="object-type-sco" display-seq="1" field-type="text" permission-id="manage"><name>ID</name></field></results>
I then update the custom field like this:
MYCONNECTSERVERURL?action=custom-field-update&account-id=1747692&field-id=1747694&object-type=object-type-sco&name=ProgramTypeID&value=0&is-primary=false&session=breezepqe93pufxp4s6xy
and get this as a response:
<?xml version="1.0" encoding="utf-8"?>
<results><status code="ok"/><field account-id="1747692" is-primary="false" field-id="1747694" object-type="object-type-sco" display-seq="3"><name>ProgramTypeID</name></field></results>
Which all looks ok to me, but when i make a "sco-expanded-contents" call on the Curriculum i am updating (which I am referencing in the "account-id" portion of the query string when I make the API calls) I dont get the custom field back, nor can i see it in the Connect UI when i view that Curriculum.
I have been researching this topic all day, and although I can make a workaround using a seperate DB to store any "custom field" information, though it would seem a quite long winded approach if this functionality is already built into Connect as the documentation hints it is, given that there are multiple acceptable "object-type" values.
What makes me think it might not be is that every reference I can find to custom fields within Connect relates specifically to the context of a User object, but nothing else, and there is also a screen in the Administration section of the Connect UI to allow an admin to add/edit custom fields.
So is the documentation just misleading me?
Or am i doing something wrong when making my calls to the API? and if so, what am I doing wrong?
Any help is appreciated!
Thanks,
Mike
Offline
#2 2012-05-09 08:00:05
- **_dendrophile_**
Re: Custom fields on a Curriculum
I am using the APi directly from PHP. What I have learned is that field ids have to be prefixed with x-. If you call the custom-fields action and look at the response, you'll see the field ids all have this prefix. When you call custom-field-update the field id that you get back does not have this prefix. The docs for acl-field-update do document field-id as needing x-.
(I've been doing AC development for about a week, so I might be hopelessly way off. I have been able to create custom fields on meetings, though.)
HTH,
Dendrophile
Offline
Pages: 1
Topic closed