Hej,
Jag vill ha följande input ha unique värde
Emnekode
contentdata/id
som ligger i inneholdstyper i CMS
Kan man göra det?
Tackpå förhand
Mvh
Keyvan
Hej,
Jag vill ha följande input ha unique värde
Emnekode
contentdata/id
som ligger i inneholdstyper i CMS
Kan man göra det?
Tackpå förhand
Mvh
Keyvan
Hi!
You cannot add such constraints today, but if you are using the api - you could do a query to verify it’s not stored before creating The data.
Hi,
Thanks for the quick answer.
Which API do you mean?
BR
Keyvan
With a content.query in your Parts controller.js you can search for the content first:
https://enonic.com/docs/latest/reference/index.html#content-query
If it doesn’t exists (result.total === 0) then create it with content.create:
https://enonic.com/docs/latest/reference/index.html#content-create
ok, but I am using version 4.7. Could I use these? how? where?
Oops sorry, didn’t check which category you had posted in. My bad =) That was for EXP only.
NP, so it is not possible?
Like TSI wrote, you could work with the API directly in 4.7 too. But you have to develop a Java plugin and do all the logic in there. Build it and upload it to the server. However, as far as I know you can’t intercept things inside the admin to give unique ID’s in there.
These are some resource to get you started if you’re interested anyway.
https://enonic.com/docs/4.7/plugin-overview.html
https://enonic.com/docs/4.7/building-a-plugin.html
Can also be done using a combination of xslt and http service api in 4.7