[IMPLEMENTED] Generate GUID for hidden or disabled field using scripting

I want to be able to use scripting to generate a GUID for new content, but do so in a hidden field so that users cannot ever change the value.

According to @Sebastian, an extension to scripting is required:

You can mark a field as disabled and create the ID with scripting. But I have to make an extension to the scripting extension for that. Feel free to create a feature request.

It has been implemented. I have added a guid function.

It would look like this:

ctx.data.guid.iv = guid();
replace()

Thanks, Sebastian! I’ll give it a try today or tomorrow.

1 Like

Hi Sebastian. I just noticed that scripts are not supported for components.

I have a component called “section” which I use within other schemas. I want to generate a guid for each section as users add them to the schemas.

Can scripting for components be allowed? Or is there a workaround you can recommend?

It just has not been implemented. But components are part of the content directly so you can do it in the parent content.

This topic was automatically closed after 2 days. New replies are no longer allowed.